Add a mix task generating dependency-free unit conversions for embedd… #309
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: Elixir CI | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| env: | |
| MIX_ENV: test | |
| LOCALIZE_DEFAULT_LOCALE: en | |
| permissions: | |
| contents: read | |
| jobs: | |
| # Publish the locale data version to R2 before any test job runs. | |
| # `mix test` downloads locale ETFs pinned to the version in | |
| # priv/localize/localize_patch_version — the same path users take — | |
| # so an unpublished version must be generated and uploaded first. | |
| # When the version is already on R2 this is a quick no-op check. | |
| # Fork PRs have no access to the R2 secrets, so they skip the | |
| # check and test against whatever data version is already published. | |
| publish-locales: | |
| name: Publish locale data | |
| if: github.event_name == 'push' || !github.event.pull_request.head.repo.fork | |
| uses: ./.github/workflows/upload-locales.yml | |
| secrets: inherit | |
| test: | |
| name: "Elixir ${{ matrix.elixir }} / OTP ${{ matrix.otp }}${{ matrix.lint && ' (lint)' || '' }}" | |
| runs-on: ubuntu-latest | |
| needs: publish-locales | |
| if: ${{ !cancelled() && (needs.publish-locales.result == 'success' || needs.publish-locales.result == 'skipped') }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| # Elixir 1.17 — supports OTP 25–27 | |
| - elixir: "1.17-otp-26" | |
| otp: "26" | |
| - elixir: "1.17-otp-27" | |
| otp: "27" | |
| # # Elixir 1.18 — supports OTP 25–27 | |
| - elixir: "1.18-otp-26" | |
| otp: "26" | |
| - elixir: "1.18-otp-27" | |
| otp: "27" | |
| # Elixir 1.19 — supports OTP 26–28 | |
| - elixir: "1.19-otp-26" | |
| otp: "26" | |
| - elixir: "1.19-otp-27" | |
| otp: "27" | |
| - elixir: "1.19-otp-28" | |
| otp: "28" | |
| # Elixir 1.20 — supports OTP 27–29 | |
| - elixir: "1.20.2-otp-27" | |
| otp: "27" | |
| - elixir: "1.20.2-otp-28" | |
| otp: "28" | |
| - elixir: "1.20.2-otp-29" | |
| otp: "29" | |
| lint: true | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| - name: Set up Elixir | |
| uses: erlef/setup-beam@v1 | |
| with: | |
| elixir-version: ${{ matrix.elixir }} | |
| otp-version: ${{ matrix.otp }} | |
| - name: Restore dependency cache | |
| uses: actions/cache@v5 | |
| with: | |
| path: | | |
| deps | |
| _build | |
| key: mix-${{ matrix.elixir }}-${{ matrix.otp }}-${{ hashFiles('mix.lock') }} | |
| restore-keys: | | |
| mix-${{ matrix.elixir }}-${{ matrix.otp }}- | |
| - name: Install dependencies | |
| run: mix deps.get | |
| - name: Check formatting | |
| if: matrix.lint | |
| run: mix format --check-formatted | |
| - name: Run credo | |
| if: matrix.lint | |
| run: mix credo --strict | |
| - name: Compile (warnings as errors) | |
| run: mix compile --warnings-as-errors | |
| - name: Run tests | |
| if: ${{ !matrix.lint }} | |
| run: mix test | |
| - name: Run tests with coverage | |
| if: matrix.lint | |
| run: mix test --cover | |
| - name: Restore PLT cache | |
| if: matrix.lint | |
| uses: actions/cache@v5 | |
| with: | |
| path: _build/dev/dialyxir_* | |
| key: plt-${{ matrix.elixir }}-${{ matrix.otp }}-${{ hashFiles('mix.lock') }} | |
| restore-keys: | | |
| plt-${{ matrix.elixir }}-${{ matrix.otp }}- | |
| - name: Run dialyzer | |
| if: matrix.lint | |
| env: | |
| MIX_ENV: dev | |
| run: mix dialyzer | |
| - name: Check docs | |
| if: matrix.lint | |
| env: | |
| MIX_ENV: release | |
| run: mix docs --warnings-as-errors |