|
1 | 1 | name: "CI"
|
2 |
| -on: ["push", "pull_request"] |
| 2 | +on: |
| 3 | + - push |
| 4 | + - pull_request |
3 | 5 |
|
4 | 6 | jobs:
|
5 | 7 | test_and_build:
|
6 |
| - name: "Build mix release" |
7 |
| - runs-on: "ubuntu-latest" |
| 8 | + runs-on: "ubuntu-20.04" |
| 9 | + name: "Elixir ${{ matrix.elixir }} test" |
| 10 | + strategy: |
| 11 | + fail-fast: false |
| 12 | + matrix: |
| 13 | + include: |
| 14 | + # Test on all supported releases. Compatibility matrix from |
| 15 | + # https://hexdocs.pm/elixir/1.12/compatibility-and-deprecations.html |
| 16 | + # |
| 17 | + # These pin to the lowest supported OTP for each elixir release. |
| 18 | + - { elixir: '1.10', otp: '21' } |
| 19 | + - { elixir: '1.11', otp: '21' } |
| 20 | + - { elixir: '1.12', otp: '22' } |
| 21 | + - { elixir: '1.13', otp: '22' } |
| 22 | + - { elixir: '1.14', otp: '23', update-deps: true } |
8 | 23 | steps:
|
9 |
| - - run: | |
10 |
| - wget https://packages.erlang-solutions.com/erlang-solutions_2.0_all.deb && sudo dpkg -i erlang-solutions_2.0_all.deb |
11 |
| - sudo apt-get update |
12 |
| - sudo apt-get install --allow-downgrades esl-erlang=1:24.3.3-1 inotify-tools |
13 |
| - mkdir $HOME/elixir && cd $HOME/elixir |
14 |
| - wget https://github.com/elixir-lang/elixir/releases/download/v1.11.4/Precompiled.zip |
15 |
| - unzip Precompiled.zip |
16 |
| - echo "$HOME/elixir/bin" >> $GITHUB_PATH |
17 |
| - - uses: actions/checkout@v1 |
18 |
| - - run: | |
19 |
| - mix local.hex --force |
20 |
| - mix local.rebar --force |
21 |
| - mix deps.get |
22 |
| - mix lint |
23 |
| - # mix test |
| 24 | + - uses: actions/checkout@v3 |
| 25 | + |
| 26 | + - name: Setup dependency cache |
| 27 | + uses: actions/cache@v3 |
| 28 | + with: |
| 29 | + path: | |
| 30 | + deps |
| 31 | + # TODO: Can this take a constant key instead? |
| 32 | + key: ${{ matrix.elixir }}-${{ hashFiles('mix.lock') }} |
| 33 | + |
| 34 | + - name: Setup binary cache |
| 35 | + uses: actions/cache@v3 |
| 36 | + with: |
| 37 | + path: | |
| 38 | + _build |
| 39 | + priv/plts |
| 40 | + key: ${{ matrix.elixir }} |
| 41 | + |
| 42 | + - name: Setup beam |
| 43 | + uses: erlef/setup-beam@v1 |
| 44 | + with: |
| 45 | + elixir-version: ${{ matrix.elixir }} |
| 46 | + otp-version: ${{ matrix.otp }} |
| 47 | + |
| 48 | + - name: Unlock dependencies for latest |
| 49 | + if: ${{ matrix.update-deps }} |
| 50 | + run: mix deps.unlock --all |
| 51 | + |
| 52 | + - name: Fetch dependencies |
| 53 | + run: mix deps.get |
| 54 | + |
| 55 | + - name: Run linters |
| 56 | + run: mix lint |
| 57 | + |
| 58 | + # TODO: Tests should pass on the main branch. |
| 59 | + # - name: Run tests |
| 60 | + # run: mix test |
0 commit comments