Merge pull request #71 from PostHog/tom/pat #165
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: CI | |
| on: | |
| push: | |
| branches: [master] | |
| pull_request: | |
| jobs: | |
| test: | |
| name: Build and test | |
| runs-on: ubuntu-latest | |
| # This is a complicated set of strategies, but Elixir has a complicated set of supported versions. | |
| # See https://hexdocs.pm/elixir/compatibility-and-deprecations.html | |
| # See https://hexdocs.pm/elixir/compatibility-and-deprecations.html#between-elixir-and-erlang-otp | |
| strategy: | |
| matrix: | |
| elixir: ["1.17.x", "1.18.x"] | |
| otp: ["25.x", "26.x", "27.x", "28.x"] | |
| exclude: | |
| # Elixir 1.17 doesn't support OTP 28 | |
| - elixir: "1.17.x" | |
| otp: "28.x" | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Set up Elixir | |
| uses: erlef/setup-beam@v1 | |
| with: | |
| elixir-version: ${{ matrix.elixir }} | |
| otp-version: ${{ matrix.otp }} | |
| - name: Restore dependencies cache | |
| uses: actions/cache@v3 | |
| with: | |
| path: deps | |
| key: ${{ runner.os }}-mix-${{ hashFiles('**/mix.lock') }}-${{ matrix.elixir }}-${{ matrix.otp }} | |
| # Fallback to same elixir version, then same lockfile, then any cache | |
| restore-keys: | | |
| ${{ runner.os }}-mix-${{ hashFiles('**/mix.lock') }}-${{ matrix.elixir }}- | |
| ${{ runner.os }}-mix-${{ hashFiles('**/mix.lock') }}- | |
| ${{ runner.os }}-mix- | |
| - name: Install dependencies | |
| run: mix deps.get | |
| - name: Run tests | |
| run: mix test | |
| static-checks: | |
| name: Static checks | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Set up Elixir | |
| uses: erlef/setup-beam@v1 | |
| with: | |
| elixir-version: 1.18.3 | |
| otp-version: 27.3 | |
| - name: Restore dependencies cache | |
| uses: actions/cache@v3 | |
| with: | |
| path: deps | |
| key: ${{ runner.os }}-mix-${{ hashFiles('**/mix.lock') }}-1.18.3-27.3 | |
| # Fallback to same elixir version, then same lockfile, then any cache | |
| restore-keys: | | |
| ${{ runner.os }}-mix-${{ hashFiles('**/mix.lock') }}-1.18.3- | |
| ${{ runner.os }}-mix-${{ hashFiles('**/mix.lock') }}- | |
| ${{ runner.os }}-mix- | |
| - name: Install dependencies | |
| run: mix deps.get | |
| - name: Check formatting | |
| run: mix format --check-formatted | |
| - name: Run static checks | |
| run: mix credo --strict |