Allow for CI to pass on OTP 27 once it's released #188
This file contains 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: Tests and Checks | |
on: | |
push: | |
branches: | |
- master | |
- develop | |
pull_request: | |
branches: | |
- master | |
- develop | |
workflow_dispatch: | |
jobs: | |
ci: | |
name: > | |
Run checks and tests over ${{matrix.otp_vsn}} and ${{matrix.os}} | |
runs-on: ${{matrix.os}} | |
strategy: | |
matrix: | |
otp_vsn: ['22.3', '23.3', '24.3', '25.3', '26.0', '26.1', '26.2'] | |
os: ['ubuntu-20.04', 'windows-2019'] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- id: otp-version-to-rebar3-version | |
name: "Read #{OTP version => rebar3 version} map" | |
uses: juliangruber/read-file-action@v1 | |
with: | |
path: ./.github/workflows/otp_version_to_rebar3_version.json | |
- id: setup-beam | |
name: Setup BEAM | |
uses: erlef/setup-beam@v1 | |
with: | |
otp-version: ${{matrix.otp_vsn}} | |
# rebar3-version: https://stackoverflow.com/a/64405821 | |
rebar3-version: | | |
${{ fromJson(steps.otp-version-to-rebar3-version.outputs.content)[matrix.otp_vsn] }} | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
- name: "Non-Windows: set dynamic env (1)" | |
if: ${{runner.os != 'Windows'}} | |
run: | | |
echo "prev_github_run_number=$((${{github.run_number}} - 1))" >> "$GITHUB_ENV" | |
echo "build_cache_prefix=_build-cache-for-os-${{runner.os}}-otp-${{matrix.otp_vsn}}-rebar3-${{steps.setup-beam.outputs.rebar3-version}}" >> "$GITHUB_ENV" | |
- name: "Non-Windows: set dynamic env (2)" | |
if: ${{runner.os != 'Windows'}} | |
run: | | |
echo "build_cache_prefix_with_hash=${{env.build_cache_prefix}}-hash-${{hashFiles('rebar.lock')}}" >> "$GITHUB_ENV" | |
- name: "Windows: set dynamic env (1)" | |
if: ${{runner.os == 'Windows'}} | |
run: | | |
# https://github.com/actions/runner-images/issues/5251#issuecomment-1071030822 | |
echo "prev_github_run_number=$(${{github.run_number}} - 1)" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
echo "build_cache_prefix=_build-cache-for-os-${{runner.os}}-otp-${{matrix.otp_vsn}}-rebar3-${{steps.setup-beam.outputs.rebar3-version}}" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
- name: "Windows: set dynamic env (2)" | |
if: ${{runner.os == 'Windows'}} | |
run: | | |
echo "build_cache_prefix_with_hash=${{env.build_cache_prefix}}-hash-${{hashFiles('rebar.lock')}}" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
- name: Restore cached build artifacts | |
uses: actions/cache/restore@v4 | |
with: | |
path: _build | |
key: ${{env.build_cache_prefix_with_hash}}-${{env.prev_github_run_number}} | |
restore-keys: |- | |
${{env.build_cache_prefix_with_hash}}- | |
${{env.build_cache_prefix}}- | |
- name: Run Tests | |
run: make test | |
env: | |
MAXMIND_LICENSE_KEY: ${{ secrets.MAXMIND_LICENSE_KEY }} | |
- name: Run Checks | |
run: make check | |
- name: Save build artifacts to cache | |
if: always() | |
uses: actions/cache/save@v4 | |
with: | |
path: _build | |
key: ${{env.build_cache_prefix_with_hash}}-${{github.run_number}} |