|
| 1 | +name: Reusable Build Images |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_call: |
| 5 | + inputs: |
| 6 | + build-backend: |
| 7 | + required: true |
| 8 | + type: boolean |
| 9 | + description: "Whether backend images should be built" |
| 10 | + build-frontend: |
| 11 | + required: true |
| 12 | + type: boolean |
| 13 | + description: "Whether frontend images should be built" |
| 14 | + python-version: |
| 15 | + required: true |
| 16 | + type: string |
| 17 | + description: "Python version to use" |
| 18 | + os: |
| 19 | + required: true |
| 20 | + type: string |
| 21 | + description: "Runner OS to use" |
| 22 | + outputs: |
| 23 | + backend-artifact-name: |
| 24 | + description: "Name of the backend artifact" |
| 25 | + value: ${{ jobs.build-test-images.outputs.artifact-name }} |
| 26 | + frontend-artifact-name: |
| 27 | + description: "Name of the frontend artifact" |
| 28 | + value: ${{ jobs.build-test-images-frontend.outputs.artifact-name }} |
| 29 | + |
| 30 | +jobs: |
| 31 | + build-test-images: |
| 32 | + if: ${{ inputs.build-backend }} |
| 33 | + timeout-minutes: 30 |
| 34 | + runs-on: ${{ inputs.os }} |
| 35 | + outputs: |
| 36 | + artifact-name: docker-buildx-images-${{ runner.os }}-${{ github.sha }}-backend |
| 37 | + steps: |
| 38 | + - uses: actions/checkout@v4 |
| 39 | + - name: setup docker buildx |
| 40 | + id: buildx |
| 41 | + uses: docker/setup-buildx-action@v3 |
| 42 | + with: |
| 43 | + driver: docker-container |
| 44 | + - name: expose github runtime for buildx |
| 45 | + uses: crazy-max/ghaction-github-runtime@v3 |
| 46 | + - name: show system environs |
| 47 | + run: ./ci/helpers/show_system_versions.bash |
| 48 | + - name: build images |
| 49 | + run: | |
| 50 | + export DOCKER_IMAGE_TAG=$(exec ci/helpers/build_docker_image_tag.bash) |
| 51 | + mkdir --parents /${{ runner.temp }}/build |
| 52 | + make build local-dest=/${{ runner.temp }}/build exclude=static-webserver |
| 53 | + - name: upload build artifacts |
| 54 | + uses: actions/upload-artifact@v4 |
| 55 | + with: |
| 56 | + name: docker-buildx-images-${{ runner.os }}-${{ github.sha }}-backend |
| 57 | + path: /${{ runner.temp }}/build |
| 58 | + |
| 59 | + build-test-images-frontend: |
| 60 | + if: ${{ inputs.build-frontend }} |
| 61 | + timeout-minutes: 30 |
| 62 | + runs-on: ${{ inputs.os }} |
| 63 | + outputs: |
| 64 | + artifact-name: docker-buildx-images-${{ runner.os }}-${{ github.sha }}-frontend |
| 65 | + steps: |
| 66 | + - uses: actions/checkout@v4 |
| 67 | + - name: setup docker buildx |
| 68 | + id: buildx |
| 69 | + uses: docker/setup-buildx-action@v3 |
| 70 | + with: |
| 71 | + driver: docker-container |
| 72 | + - name: expose github runtime for buildx |
| 73 | + uses: crazy-max/ghaction-github-runtime@v3 |
| 74 | + - name: show system environs |
| 75 | + run: ./ci/helpers/show_system_versions.bash |
| 76 | + - name: build images |
| 77 | + run: | |
| 78 | + export DOCKER_IMAGE_TAG=$(exec ci/helpers/build_docker_image_tag.bash) |
| 79 | + mkdir --parents /${{ runner.temp }}/build |
| 80 | + make build local-dest=/${{ runner.temp }}/build target=static-webserver |
| 81 | + - name: upload build artifacts |
| 82 | + uses: actions/upload-artifact@v4 |
| 83 | + with: |
| 84 | + name: docker-buildx-images-${{ runner.os }}-${{ github.sha }}-frontend |
| 85 | + path: /${{ runner.temp }}/build |
0 commit comments