diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..24d1e9e --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,56 @@ +name: CI + +on: + push: + +jobs: + test: + name: Test app + runs-on: ubuntu-latest + env: + MIX_ENV: test + + steps: + - uses: actions/checkout@v4 + + - uses: erlef/setup-beam@v1 + id: beam + with: + version-file: .tool-versions + version-type: strict + + - name: Restore the deps and _build cache + uses: actions/cache@v4 + id: restore-cache + env: + OTP_VERSION: ${{ steps.beam.outputs.otp-version }} + ELIXIR_VERSION: ${{ steps.beam.outputs.elixir-version }} + MIX_LOCK_HASH: ${{ hashFiles('**/mix.lock') }} + with: + path: | + deps + _build + key: ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-mixlockhash-${{ env.MIX_LOCK_HASH }} + + - name: Install mix dependencies + if: steps.restore-cache.outputs.cache-hit != 'true' + run: mix deps.get + + - name: Compile dependencies + if: steps.restore-cache.outputs.cache-hit != 'true' + run: mix deps.compile + + - name: Compile + run: mix compile --warnings-as-errors --force + + - name: Check Formatting + run: mix format --check-formatted + + - name: Check unused deps + run: mix deps.unlock --check-unused + + - name: Credo + run: mix credo + + - name: Run Tests + run: mix test \ No newline at end of file