-
Notifications
You must be signed in to change notification settings - Fork 2
77 lines (69 loc) · 2.33 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
---
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.0', '22.1', '22.2', '22.3',
'23.0', '23.1', '23.2', '23.3',
'24.0', '24.1', '24.2', '24.3',
'25.0', '25.1', '25.2', '25.3',
'26.0', '26.1', '26.2'
]
os: ['ubuntu-20.04']
steps:
- name: Checkout
uses: actions/checkout@v3
- 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: Set dynamic env (1)
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: Set dynamic env (2)
run: |
echo "build_cache_prefix_with_hash=${{env.build_cache_prefix}}-hash-${{hashFiles('rebar.lock')}}" >> "$GITHUB_ENV"
- name: Restore cached build artifacts
uses: actions/cache/restore@v3
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
- name: Run Checks
run: make check
- name: Save build artifacts to cache
if: always()
uses: actions/cache/save@v3
with:
path: _build
key: ${{env.build_cache_prefix_with_hash}}-${{github.run_number}}