1 name: Build and push containers
11 BUILDBOT_VERSION: 3.9.0
15 group: ${{ github.workflow }}-${{ github.ref }}
16 cancel-in-progress: ${{ github.event_name == 'pull_request' }}
20 name: Test with Python ${{ matrix.python-version }}
21 runs-on: ubuntu-latest
31 uses: actions/checkout@v4
33 - uses: actions/setup-python@v5
35 python-version: ${{ matrix.python-version }}
37 - name: Install dependencies
38 run: pip install -r requirements-dev.txt
40 - name: Lint with ruff
41 run: ruff phase*/master.cfg
43 - name: Stylecheck with black
44 run: black phase1/master.cfg
47 name: Build and Test container
48 runs-on: ubuntu-latest
55 fail-fast: ${{ github.event_name == 'pull_request' }}
58 - container_flavor: master
59 container_verify_string: "buildmaster configured in /master"
60 - container_flavor: worker
61 container_test_command: "--env BUILDWORKER_NAME=X --env BUILDWORKER_PASSWORD=Y"
62 container_verify_string: "worker configured in /builder"
66 uses: actions/checkout@v4
68 - name: Environment variables
70 echo "GIT_SHA_SHORT=${GITHUB_SHA::${{ env.GITHUB_SHA_LEN }}}" >> $GITHUB_ENV
72 - name: Build container and export it to local Docker
73 uses: docker/build-push-action@v5
76 tags: local/${{ matrix.container_flavor }}
77 file: docker/build${{ matrix.container_flavor }}/Dockerfile
79 BUILDBOT_VERSION=${{ env.BUILDBOT_VERSION }}
80 OPENWRT_VERSION=${{ env.GIT_SHA_SHORT }}
82 - name: Test ${{ matrix.container_flavor }} Docker container
84 docker run --detach ${{ matrix.container_test_command }} --name test-${{ matrix.container_flavor }} local/${{ matrix.container_flavor }}
87 cram --verbose "tests/cram/${{ matrix.container_flavor }}"
91 if: github.event_name != 'pull_request' || github.repository_owner != 'openwrt'
92 runs-on: ubuntu-latest
95 environment: production
108 uses: actions/checkout@v4
110 - name: Environment variables
112 echo "GIT_SHA_SHORT=${GITHUB_SHA::${{ env.GITHUB_SHA_LEN }}}" >> $GITHUB_ENV
116 uses: docker/metadata-action@v5
118 images: name=ghcr.io/${{ github.repository }}/build${{ matrix.container_flavor }}-v${{ env.BUILDBOT_VERSION }}
120 - name: Login to GitHub Container Registry
121 uses: docker/login-action@v2
124 username: ${{ github.actor }}
125 password: ${{ secrets.GITHUB_TOKEN }}
127 - name: Build container again and push it
128 uses: docker/build-push-action@v5
131 tags: ${{ steps.meta.outputs.tags }}
132 labels: ${{ steps.meta.outputs.labels }}
133 file: docker/build${{ matrix.container_flavor }}/Dockerfile
135 BUILDBOT_VERSION=${{ env.BUILDBOT_VERSION }}
136 OPENWRT_VERSION=${{ env.GIT_SHA_SHORT }}