diff --git a/.github/workflows/elixir.yml b/.github/workflows/elixir.yml new file mode 100644 index 0000000..8bd8d36 --- /dev/null +++ b/.github/workflows/elixir.yml @@ -0,0 +1,81 @@ +name: Elixir CI + +on: + push: + branches: + - master + paths: + - ".github/workflows/*" + - "**/*.ex" + - "**/*.exs" + - "**/*.eex" + - "mix.lock" + - "coveralls.json" + pull_request: + branches: + - master + paths: + - ".github/workflows/*" + - "**/*.ex" + - "**/*.exs" + - "**/*.eex" + - "mix.lock" + - "coveralls.json" + +jobs: + lint: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Elixir + uses: erlef/setup-beam@v1 + with: + otp-version: '27.0.1' + elixir-version: '1.17.2' + + - name: Restore deps cache + uses: actions/cache@v4 + with: + path: | + deps + _build + key: ${{ runner.os }}-deps-${{ hashFiles('**/mix.lock') }}-git-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-deps-${{ hashFiles('**/mix.lock') }} + ${{ runner.os }}-deps + + - name: Install package dependencies + run: mix deps.get + + - name: Remove compiled application files + run: mix clean + + - name: Compile dependencies + run: mix compile + env: + MIX_ENV: test + + - name: Run tests + run: mix test --trace + env: + MIX_ENV: test + + - name: Check code coverage + run: mix coveralls + env: + MIX_ENV: test + + - name: Upload coverage to coveralls + run: mix coveralls.github + env: + MIX_ENV: test + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Check code formatting + run: mix check + + - name: Run Credo linter + run: mix credo --strict