Update Elixir deps #138
This file contains 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: Test & Audit | |
on: | |
push: | |
branches: | |
- main | |
- ci | |
- ci-* | |
pull_request: | |
branches: | |
- main | |
env: | |
ELIXIR_VERSION: "1.16.2" | |
OTP_VERSION: "26.2.2" | |
RUST_VERSION: "1.78.0" | |
jobs: | |
build_test: | |
name: Build Test | |
runs-on: ubuntu-20.04 | |
env: | |
MIX_ENV: test | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Elixir | |
uses: erlef/setup-beam@v1 | |
with: | |
elixir-version: ${{ env.ELIXIR_VERSION }} | |
otp-version: ${{ env.OTP_VERSION }} | |
version-type: "strict" | |
- name: Cache deps | |
uses: actions/cache@v3 | |
with: | |
path: deps | |
key: ${{ runner.os }}-test-deps-v1-${{ hashFiles('**/mix.lock', '.tool-versions') }} | |
- name: Cache cargo | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cargo/registry | |
~/.cargo/git | |
native/specter_nif/target | |
priv/native | |
key: ${{ runner.os }}-test-cargo-v2-${{ hashFiles('**/Cargo.lock') }}-${{ env.RUST_VERSION }} | |
- name: Cache _build | |
uses: actions/cache@v3 | |
with: | |
path: _build | |
key: ${{ runner.os }}-test-build-v1-${{ hashFiles('**/mix.lock', '.tool-versions') }} | |
- name: Install dependencies | |
run: mix deps.get | |
working-directory: . | |
- name: Compile for test | |
run: mix compile --force --warnings-as-errors | |
working-directory: . | |
build_dev: | |
name: Build Dev | |
runs-on: ubuntu-20.04 | |
env: | |
MIX_ENV: dev | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Elixir | |
uses: erlef/setup-beam@v1 | |
with: | |
elixir-version: ${{ env.ELIXIR_VERSION }} | |
otp-version: ${{ env.OTP_VERSION }} | |
version-type: "strict" | |
- name: Set up Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: ${{ env.RUST_VERSION }} | |
override: true | |
- name: Cache deps | |
uses: actions/cache@v3 | |
with: | |
path: deps | |
key: ${{ runner.os }}-dev-deps-v1-${{ hashFiles('**/mix.lock', '.tool-versions') }} | |
- name: Cache cargo | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cargo/registry | |
~/.cargo/git | |
native/specter_nif/target | |
priv/native | |
key: ${{ runner.os }}-dev-cargo-v2-${{ hashFiles('**/Cargo.lock') }}-${{ env.RUST_VERSION }} | |
- name: Cache _build | |
uses: actions/cache@v3 | |
with: | |
path: _build | |
key: ${{ runner.os }}-dev-build-v1-${{ hashFiles('**/mix.lock', '.tool-versions') }} | |
- name: Install dependencies | |
run: mix deps.get | |
working-directory: . | |
- name: Compile for dev | |
run: mix compile --force --warnings-as-errors | |
working-directory: . | |
test: | |
name: Test | |
needs: build_test | |
runs-on: ubuntu-20.04 | |
env: | |
MIX_ENV: test | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Elixir | |
uses: erlef/setup-beam@v1 | |
with: | |
elixir-version: ${{ env.ELIXIR_VERSION }} | |
otp-version: ${{ env.OTP_VERSION }} | |
version-type: "strict" | |
- name: Set up Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: ${{ env.RUST_VERSION }} | |
override: true | |
- name: Cache deps | |
uses: actions/cache@v3 | |
with: | |
path: deps | |
key: ${{ runner.os }}-test-deps-v1-${{ hashFiles('**/mix.lock', '.tool-versions') }} | |
- name: Cache cargo | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cargo/registry | |
~/.cargo/git | |
native/specter_nif/target | |
priv/native | |
key: ${{ runner.os }}-test-cargo-v2-${{ hashFiles('**/Cargo.lock') }}-${{ env.RUST_VERSION }} | |
- name: Cache _build | |
uses: actions/cache@v3 | |
with: | |
path: _build | |
key: ${{ runner.os }}-test-build-v1-${{ hashFiles('**/mix.lock', '.tool-versions') }} | |
- name: Run tests | |
run: mix test --color --warnings-as-errors | |
working-directory: . | |
credo_and_dialyxir: | |
name: Credo + Dialyxir | |
needs: build_test | |
runs-on: ubuntu-20.04 | |
env: | |
MIX_ENV: test | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Elixir | |
uses: erlef/setup-beam@v1 | |
with: | |
elixir-version: ${{ env.ELIXIR_VERSION }} | |
otp-version: ${{ env.OTP_VERSION }} | |
version-type: "strict" | |
- name: Cache deps | |
uses: actions/cache@v3 | |
with: | |
path: deps | |
key: ${{ runner.os }}-test-deps-v1-${{ hashFiles('**/mix.lock', '.tool-versions') }} | |
- name: Cache cargo | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cargo/registry | |
~/.cargo/git | |
native/specter_nif/target | |
priv/native | |
key: ${{ runner.os }}-test-cargo-v2-${{ hashFiles('**/Cargo.lock') }}-${{ env.RUST_VERSION }} | |
- name: Cache _build | |
uses: actions/cache@v3 | |
with: | |
path: _build | |
key: ${{ runner.os }}-test-build-v1-${{ hashFiles('**/mix.lock', '.tool-versions') }} | |
- name: Cache PLTs | |
uses: actions/cache@v3 | |
with: | |
path: priv/plts | |
key: ${{ runner.os }}-test-dialyxir-v1-${{ hashFiles('**/mix.lock', '.tool-versions') }} | |
- name: Credo | |
run: mix credo --strict | |
working-directory: . | |
- name: Run dialyzer | |
run: mix dialyzer | |
working-directory: . | |
audit: | |
name: Audit | |
needs: build_dev | |
runs-on: ubuntu-20.04 | |
env: | |
MIX_ENV: dev | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Elixir | |
uses: erlef/setup-beam@v1 | |
with: | |
elixir-version: ${{ env.ELIXIR_VERSION }} | |
otp-version: ${{ env.OTP_VERSION }} | |
version-type: "strict" | |
- name: Cache deps | |
uses: actions/cache@v3 | |
with: | |
path: deps | |
key: ${{ runner.os }}-dev-deps-v1-${{ hashFiles('**/mix.lock', '.tool-versions') }} | |
- name: Cache cargo | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cargo/registry | |
~/.cargo/git | |
native/specter_nif/target | |
priv/native | |
key: ${{ runner.os }}-dev-cargo-v2-${{ hashFiles('**/Cargo.lock') }}}-${{ env.RUST_VERSION }} | |
- name: Cache _build | |
uses: actions/cache@v3 | |
with: | |
path: _build | |
key: ${{ runner.os }}-dev-build-v1-${{ hashFiles('**/mix.lock', '.tool-versions') }} | |
- name: Check Elixir formatting | |
run: mix format --check-formatted | |
working-directory: . | |
- name: Check for unused dependencies | |
run: mix deps.unlock --check-unused | |
working-directory: . | |
- name: Audit deps | |
run: mix deps.audit | |
working-directory: . | |
publish: | |
name: Publish to Hex | |
if: github.ref == 'refs/heads/main' | |
needs: | |
- test | |
- credo_and_dialyxir | |
- audit | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Elixir | |
uses: erlef/setup-beam@v1 | |
with: | |
elixir-version: ${{ env.ELIXIR_VERSION }} | |
otp-version: ${{ env.OTP_VERSION }} | |
version-type: "strict" | |
- name: Cache deps | |
uses: actions/cache@v3 | |
with: | |
path: deps | |
key: ${{ runner.os }}-dev-deps-v1-${{ hashFiles('**/mix.lock', '.tool-versions') }} | |
- name: Cache cargo | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cargo/registry | |
~/.cargo/git | |
native/specter_nif/target | |
priv/native | |
key: ${{ runner.os }}-dev-cargo-v2-${{ hashFiles('**/Cargo.lock') }}}-${{ env.RUST_VERSION }} | |
- name: Cache _build | |
uses: actions/cache@v3 | |
with: | |
path: _build | |
key: ${{ runner.os }}-dev-build-v1-${{ hashFiles('**/mix.lock', '.tool-versions') }} | |
- name: Publish to Hex | |
uses: synchronal/hex-publish-action@v3 | |
with: | |
name: specter | |
key: ${{ secrets.HEX_PM_KEY }} |