Merge pull request #45 from sebasgo/dependabot/hex/phoenix_live_view-… #76
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: | |
| jobs: | |
| setup: | |
| name: Setup | |
| runs-on: ubuntu-latest | |
| env: | |
| MIX_ENV: test | |
| outputs: | |
| otp-version: ${{ steps.beam.outputs.otp-version }} | |
| elixir-version: ${{ steps.beam.outputs.elixir-version }} | |
| 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 --force | |
| check-formatting: | |
| name: Check Formatting | |
| runs-on: ubuntu-latest | |
| needs: setup | |
| 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 | |
| env: | |
| OTP_VERSION: ${{ needs.setup.outputs.otp-version }} | |
| ELIXIR_VERSION: ${{ needs.setup.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: Check Formatting | |
| run: mix format --check-formatted | |
| check-unused-deps: | |
| name: Check Unused Dependencies | |
| runs-on: ubuntu-latest | |
| needs: setup | |
| 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 | |
| env: | |
| OTP_VERSION: ${{ needs.setup.outputs.otp-version }} | |
| ELIXIR_VERSION: ${{ needs.setup.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: Check unused deps | |
| run: mix deps.unlock --check-unused | |
| credo: | |
| name: Credo Static Code Analysis | |
| runs-on: ubuntu-latest | |
| needs: setup | |
| 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 | |
| env: | |
| OTP_VERSION: ${{ needs.setup.outputs.otp-version }} | |
| ELIXIR_VERSION: ${{ needs.setup.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: Credo | |
| run: mix credo | |
| test: | |
| name: Run Tests | |
| runs-on: ubuntu-latest | |
| needs: setup | |
| env: | |
| MIX_ENV: test | |
| services: | |
| postgres: | |
| image: postgres:17 | |
| env: | |
| POSTGRES_USER: postgres | |
| POSTGRES_PASSWORD: postgres | |
| POSTGRES_DB: dev_round | |
| ports: | |
| - 5432:5432 | |
| options: >- | |
| --health-cmd pg_isready | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| 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 | |
| env: | |
| OTP_VERSION: ${{ needs.setup.outputs.otp-version }} | |
| ELIXIR_VERSION: ${{ needs.setup.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: Run Tests | |
| run: mix test --exclude ldap | |
| ci: | |
| name: CI | |
| runs-on: ubuntu-latest | |
| needs: [check-formatting, check-unused-deps, credo, test] | |
| if: always() | |
| steps: | |
| - name: Fail if any check failed | |
| if: contains(needs.*.result, 'failure') | |
| run: exit 1 |