Skip to content

Make a Merge() call allow not-yet-recognized new fields in P4Info files #104

Make a Merge() call allow not-yet-recognized new fields in P4Info files

Make a Merge() call allow not-yet-recognized new fields in P4Info files #104

Workflow file for this run

name: Test
on:
pull_request:
branches:
- main
push:
branches:
- main
jobs:
test:
runs-on: ubuntu-latest
# Local registry where we output p4lang/p4runtime-sh so that it can be used
# to build p4lang/p4runtime-sh-dev.
services:
registry:
image: registry:2
ports:
- 5000:5000
steps:
- name: Check-out code
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
driver-opts: network=host
- name: Login to DockerHub if needed
if: ${{ github.repository == 'p4lang/p4runtime-shell' && github.event_name == 'push' }}
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push p4lang/p4runtime-sh to local registry
uses: docker/build-push-action@v6
with:
context: .
tags: localhost:5000/p4lang/p4runtime-sh
push: true
cache-from: type=gha,scope=p4runtime-sh
cache-to: type=gha,scope=p4runtime-sh,mode=max
- name: Build and export p4lang/p4runtime-sh-dev to Docker
uses: docker/build-push-action@v6
with:
context: .
file: Dockerfile.dev
build-args: BASE_IMAGE=localhost:5000/p4lang/p4runtime-sh:latest
load: true
tags: p4lang/p4runtime-sh-dev
cache-from: |
type=registry,ref=localhost:5000/p4lang/p4runtime-sh
type=gha,scope=p4runtime-sh-dev
cache-to: type=gha,scope=p4runtime-sh-dev,mode=max
- name: Check Python code formatting
run: docker run p4lang/p4runtime-sh-dev bash -c "source venv/bin/activate && flake8 p4runtime_sh config_builders"
- name: Run unit tests and upload code coverage
run: |
ci_env=`bash <(curl -s https://codecov.io/env)`
docker run $ci_env p4lang/p4runtime-sh-dev bash -c "source venv/bin/activate && nose2 --with-coverage p4runtime_sh config_builders && codecov"
- name: Build and push p4lang/p4runtime-sh to Dockerhub if needed
if: ${{ github.repository == 'p4lang/p4runtime-shell' && github.event_name == 'push' }}
uses: docker/build-push-action@v6
with:
context: .
push: true
tags: p4lang/p4runtime-sh