1 name: Build and push containers
11 BUILDBOT_VERSION: 3.11.1
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: Lint with flake8
44 run: flake8 phase*/master.cfg
46 - name: Stylecheck with black
47 run: black phase1/master.cfg
50 name: Build and Test container
51 runs-on: ubuntu-latest
58 fail-fast: ${{ github.event_name == 'pull_request' }}
61 - container_flavor: master
62 container_verify_string: "buildmaster configured in /master"
63 - container_flavor: worker
64 container_test_command: "--env BUILDWORKER_NAME=X --env BUILDWORKER_PASSWORD=Y"
65 container_verify_string: "worker configured in /builder"
69 uses: actions/checkout@v4
71 - name: Environment variables
73 echo "GIT_SHA_SHORT=${GITHUB_SHA::${{ env.GITHUB_SHA_LEN }}}" >> $GITHUB_ENV
75 - name: Build container and export it to local Docker
76 uses: docker/build-push-action@v5
79 tags: local/${{ matrix.container_flavor }}
80 file: docker/build${{ matrix.container_flavor }}/Dockerfile
82 BUILDBOT_VERSION=${{ env.BUILDBOT_VERSION }}
83 OPENWRT_VERSION=${{ env.GIT_SHA_SHORT }}
85 - name: Test ${{ matrix.container_flavor }} Docker container
87 docker run --detach ${{ matrix.container_test_command }} --name test-${{ matrix.container_flavor }} local/${{ matrix.container_flavor }}
90 cram --verbose "tests/cram/${{ matrix.container_flavor }}"
94 if: github.event_name != 'pull_request' || github.repository_owner != 'openwrt'
95 runs-on: ubuntu-latest
98 environment: production
111 uses: actions/checkout@v4
113 - name: Environment variables
115 echo "GIT_SHA_SHORT=${GITHUB_SHA::${{ env.GITHUB_SHA_LEN }}}" >> $GITHUB_ENV
119 uses: docker/metadata-action@v5
121 images: name=ghcr.io/${{ github.repository }}/build${{ matrix.container_flavor }}-v${{ env.BUILDBOT_VERSION }}
123 - name: Login to GitHub Container Registry
124 uses: docker/login-action@v3
127 username: ${{ github.actor }}
128 password: ${{ secrets.GITHUB_TOKEN }}
130 - name: Build container again and push it
131 uses: docker/build-push-action@v5
134 tags: ${{ steps.meta.outputs.tags }}
135 labels: ${{ steps.meta.outputs.labels }}
136 file: docker/build${{ matrix.container_flavor }}/Dockerfile
138 BUILDBOT_VERSION=${{ env.BUILDBOT_VERSION }}
139 OPENWRT_VERSION=${{ env.GIT_SHA_SHORT }}