|
| 1 | +name: Continuous Integration |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ master ] |
| 6 | + pull_request: |
| 7 | + branches: [ master ] |
| 8 | + |
| 9 | +env: |
| 10 | + MIX_ENV: test |
| 11 | + |
| 12 | +jobs: |
| 13 | + test: |
| 14 | + |
| 15 | + runs-on: ubuntu-latest |
| 16 | + continue-on-error: ${{ matrix.development }} |
| 17 | + strategy: |
| 18 | + matrix: |
| 19 | + elixir: ['1.10.x', '1.11.x'] |
| 20 | + otp: ['21.3.x', '22.2.x', '23.0.x'] |
| 21 | + development: [false] |
| 22 | + include: |
| 23 | + - elixir: 'master' |
| 24 | + otp: '21.3.x' |
| 25 | + development: true |
| 26 | + |
| 27 | + steps: |
| 28 | + - uses: actions/checkout@v2 |
| 29 | + |
| 30 | + - name: Setup elixir |
| 31 | + uses: actions/setup-elixir@v1 |
| 32 | + with: |
| 33 | + elixir-version: ${{ matrix.elixir }} # Define the elixir version [required] |
| 34 | + otp-version: ${{ matrix.otp }} # Define the OTP version [required] |
| 35 | + |
| 36 | + - name: Retrieve Mix Dependencies Cache |
| 37 | + uses: actions/cache@v1 |
| 38 | + id: mix-cache #id to use in retrieve action |
| 39 | + with: |
| 40 | + path: deps |
| 41 | + key: ${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-mix-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }} |
| 42 | + |
| 43 | + - name: Install Mix Dependencies |
| 44 | + if: steps.mix-cache.outputs.cache-hit != 'true' |
| 45 | + run: | |
| 46 | + mix local.rebar --force |
| 47 | + mix local.hex --force |
| 48 | + mix deps.get |
| 49 | + - name: Check Formatting |
| 50 | + run: mix format --check-formatted |
| 51 | + if: matrix.elixir == '1.11.x' |
| 52 | + |
| 53 | + - name: Check Compile Warnings |
| 54 | + run: mix compile --warnings-as-errors |
| 55 | + |
| 56 | + - name: Run Tests |
| 57 | + run: mix test |
| 58 | + |
| 59 | + - name: Retrieve PLT Cache |
| 60 | + uses: actions/cache@v1 |
| 61 | + id: plt-cache |
| 62 | + if: matrix.elixir == '1.11.x' |
| 63 | + with: |
| 64 | + path: priv/plts |
| 65 | + key: ${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-plts-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }} |
| 66 | + |
| 67 | + - name: Create PLTs |
| 68 | + if: steps.plt-cache.outputs.cache-hit != 'true' && matrix.elixir == '1.11.x' |
| 69 | + run: | |
| 70 | + mkdir -p priv/plts |
| 71 | + mix dialyzer --plt |
| 72 | + - name: Run dialyzer |
| 73 | + run: mix dialyzer --no-check --halt-exit-status |
| 74 | + if: matrix.elixir == '1.11.x' |
0 commit comments