diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..3ff7523 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,62 @@ +name: Elixir CI + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +permissions: + contents: read + +jobs: + test: + runs-on: ubuntu-22.04 + env: + MIX_ENV: test + steps: + - uses: actions/checkout@v4 + - uses: erlef/setup-elixir@v1 + with: + elixir-version: '1.16.2-otp-26' + otp-version: '26.2.3' + - uses: actions/cache@v4 + id: mix-cache + with: + path: deps + key: ${{ runner.os }}-mix-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }} + - if: steps.mix-cache.outputs.cache-hit != 'true' + run: mix deps.get + - run: mix test + + lint: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v4 + - uses: erlef/setup-beam@v1 + with: + elixir-version: '1.16.2-otp-26' + otp-version: '26.2.3' + - uses: erlef/setup-elixir@v1 + with: + elixir-version: '1.16.2-otp-26' + otp-version: '26.2.3' + - uses: actions/cache@v4 + id: mix-cache + with: + path: deps + key: ${{ runner.os }}-mix-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }} + - if: steps.mix-cache.outputs.cache-hit != 'true' + run: mix deps.get + - run: mix format --check-formatted + - run: mix credo --strict + - uses: actions/cache@v4 + id: plt-cache + with: + path: priv/plts + key: ${{ runner.os }}-plts-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }} + - if: steps.plt-cache.outputs.cache-hit != 'true' + run: | + mkdir -p priv/plts + mix dialyzer --plt + - run: mix dialyzer --no-check --halt-exit-status