chore: bump OTP versions #201
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build docker images | |
| concurrency: | |
| group: test-${{ github.ref }} | |
| cancel-in-progress: true | |
| on: | |
| pull_request: | |
| jobs: | |
| sanity-checks: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4 | |
| - name: Check workflow files | |
| env: | |
| ACTIONLINT_VSN: 1.6.25 | |
| run: | | |
| wget https://github.com/rhysd/actionlint/releases/download/v${ACTIONLINT_VSN}/actionlint_${ACTIONLINT_VSN}_linux_amd64.tar.gz | |
| tar zxf actionlint_${ACTIONLINT_VSN}_linux_amd64.tar.gz actionlint | |
| # TODO: enable shellcheck when all the current issues are fixed | |
| ./actionlint -color -shellcheck= | |
| prepare: | |
| runs-on: ubuntu-latest | |
| needs: | |
| - sanity-checks | |
| outputs: | |
| matrix: ${{ steps.versions.outputs.matrix }} | |
| steps: | |
| - uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4 | |
| - name: Get target OTP and Elixir versions | |
| id: versions | |
| run: | | |
| #!/bin/bash | |
| versions="$(grep -E "^\+\sOTP-.*" ./RELEASE.md | \ | |
| sed -E 's/\+\sOTP-([0-9.-]*),Elixir-([0-9.]*).*/{"otp":"\1","elixir":"\2"}/g' | \ | |
| jq -sc .)" | |
| platforms='[ | |
| "ubuntu24.04", | |
| "ubuntu22.04", | |
| "ubuntu20.04", | |
| "ubuntu18.04", | |
| "debian13", | |
| "debian12", | |
| "debian11", | |
| "el9", | |
| "el8", | |
| "el7", | |
| "amzn2", | |
| "amzn2023", | |
| "alpine3.15.1", | |
| "alpine3.21.3" | |
| ]' | |
| arhitectures='["amd64", "arm64"]' | |
| matrix="$(jq -cn \ | |
| --argjson versions "$versions" \ | |
| --argjson platforms "$platforms" \ | |
| --argjson arhitectures "$arhitectures" \ | |
| '[ | |
| $versions[] as $version | | |
| $platforms[] as $platform | | |
| $arhitectures[] as $arch | | |
| { | |
| base_image_vsn: "5.0", | |
| otp: $version.otp, | |
| elixir: $version.elixir, | |
| platform: $platform, | |
| arch: $arch | |
| } | |
| ]')" | |
| echo "matrix=$matrix" | tee -a $GITHUB_OUTPUT | |
| build: | |
| name: ${{ matrix.platform }} ${{ matrix.arch }} OTP-${{ matrix.otp }} Elixir-${{ matrix.elixir }} | |
| runs-on: ${{ github.repository_owner == 'emqx' && format('aws-ubuntu22.04-{0}', matrix.arch) || (matrix.arch == 'arm64' && 'ubuntu-22.04-arm' || 'ubuntu-22.04') }} | |
| needs: | |
| - prepare | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: ${{ fromJSON(needs.prepare.outputs.matrix) }} | |
| steps: | |
| - uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4 | |
| - uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 # v4.0.2 | |
| with: | |
| aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
| aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
| aws-region: ${{ secrets.AWS_DEFAULT_REGION }} | |
| - uses: docker/login-action@e92390c5fb421da1463c202d546fed0ec5c39f20 # v3.1.0 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ github.token }} | |
| - name: define base tag | |
| id: base_tag | |
| run: | | |
| TAG="${{ matrix.platform }}-${{ matrix.arch }}" | |
| echo "tag=${TAG}" | tee -a $GITHUB_OUTPUT | |
| echo "image=ghcr.io/${{ github.repository }}/base-${{ matrix.base_image_vsn }}:${TAG}" | tee -a $GITHUB_OUTPUT | |
| - name: Get cache | |
| run: aws s3 sync s3://docker-buildx-cache/emqx-builder/${{ steps.base_tag.outputs.tag }} /tmp/.docker-buildx-cache | |
| - uses: docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3 # v3.0.0 | |
| - uses: docker/setup-buildx-action@d70bba72b1f3fd22344832f00baa16ece964efeb # v3.3.0 | |
| with: | |
| driver-opts: network=host | |
| - name: Build and load docker image | |
| uses: docker/build-push-action@2cdde995de11925a030ce8070c3d77a52ffcf1c0 # v5.3.0 | |
| with: | |
| platforms: "linux/${{ matrix.arch }}" | |
| load: true # Load the image to the runner's docker daemon | |
| tags: test-image:latest | |
| cache-from: type=local,src=/tmp/.docker-buildx-cache,mode=max | |
| build-args: | | |
| BUILD_FROM=${{ steps.base_tag.outputs.image }} | |
| OTP_VERSION=${{ matrix.otp }} | |
| ELIXIR_VERSION=${{ matrix.elixir }} | |
| BUILD_WITHOUT_QUIC=${{ startsWith(matrix.otp, '24') && 1 || '' }} | |
| EMQTT_BENCH_VERSION=${{ startsWith(matrix.otp, '24') && '0.4.5' || '' }} | |
| LUX_VERSION=${{ startsWith(matrix.otp, '24') && 'lux-2.6' || '' }} | |
| file: ./Dockerfile | |
| context: . | |
| - name: Test OTP 27 Image (Rust Toolchain should be installed) | |
| if: startsWith(matrix.otp, '27') | |
| run: | | |
| docker run --rm test-image:latest bash -c 'rustup toolchain list' | \ | |
| grep "1.88.0" | |
| - name: Test non-OTP 27 Image (Rust Toolchain should NOT be installed) | |
| if: "!startsWith(matrix.otp, '27')" | |
| run: | | |
| docker run --rm test-image:latest bash -c 'rustup toolchain list' | \ | |
| grep "no installed toolchains" |