Skip to content

Commit

Permalink
ci changes
Browse files Browse the repository at this point in the history
  • Loading branch information
brianberlin committed Mar 11, 2024
1 parent a51284c commit b14cada
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 490 deletions.
56 changes: 23 additions & 33 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,20 @@ env:
MIX_ENV: test
OTP_VERSION_SPEC: "26.0"
ELIXIR_VERSION_SPEC: "1.15"
CACHE_KEY:
CACHE_RESTORE_KEY:

jobs:
test:

runs-on: ubuntu-latest

steps:
- name: Environment
run: |
echo "CACHE_KEY=deps-${{ runner.os }}-${{ env.OTP_VERSION_SPEC }}-${{ env.ELIXIR_VERSION_SPEC }}-${{ hashFiles('mix.lock') }}" >> $GITHUB_ENV
echo "CACHE_RESTORE_KEY=deps-${{ runner.os }}-${{ env.OTP_VERSION_SPEC }}-${{ env.ELIXIR_VERSION_SPEC }}-" >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@v2

Expand All @@ -31,12 +38,13 @@ jobs:
env:
ImageOS: ubuntu20

- name: Restore Deps Cache
- name: Restore Cache
uses: actions/cache/restore@v3
id: deps-cache
id: cache
with:
path: deps
key: deps-${{ runner.os }}-${{ env.OTP_VERSION_SPEC }}-${{ env.ELIXIR_VERSION_SPEC }}-${{ hashFiles('mix.lock') }}
path: "*"
key: ${{ env.CACHE_KEY }}
restore-keys: ${{ env.CACHE_RESTORE_KEY }}

- name: Restore Build Cache
uses: actions/cache/restore@v3
Expand All @@ -50,14 +58,12 @@ jobs:
id: plt-cache
with:
key: plt-${{ runner.os }}-${{ env.OTP_VERSION_SPEC }}-${{ env.ELIXIR_VERSION_SPEC }}
path: priv/plts
path: plts

- name: Install Mix Dependencies
if: steps.deps-cache.outputs.cache-hit != 'true'
run: mix deps.get

- name: Compile
if: steps.build-cache.outputs.cache-hit != 'true'
run: mix compile

- name: Check Formatting
Expand All @@ -67,16 +73,14 @@ jobs:
run: mix credo --strict

- name: Run Tests
run: mix test --cover --export-coverage default
run: mix test --cover

- name: Run Coverage Reporter
run: |
mix coverage_reporter \
--github-token ${{ secrets.GITHUB_TOKEN }} \
--pull-number ${{ github.event.number }} \
--repository ${{ github.repository }} \
--head-branch ${{ github.head_ref }} \
--commit-sha ${{ github.sha }}
- name: Code Coverage
uses: peek-travel/coverage-reporter@v3
if: github.event_name == 'pull_request'
with:
lcov_path: cover/**-lcov.info
coverage_threshold: 90

- name: Create Coverage Report Artifact
uses: actions/upload-artifact@v3
Expand All @@ -85,30 +89,16 @@ jobs:
path: cover/reports/coverage_report.txt

- name: Create PLTs
if: steps.plt-cache.outputs.cache-hit != 'true'
run: MIX_ENV=dev mix dialyzer --plt

- name: Run dialyzer
run: MIX_ENV=dev mix dialyzer --format github

- name: Save Build Cache
uses: actions/cache/save@v3
uses: actions/cache/save@v4
with:
path: _build
key: build-${{ runner.os }}-${{ env.OTP_VERSION_SPEC }}-${{ env.ELIXIR_VERSION_SPEC }}-${{ hashFiles('mix.lock') }}

- name: Save Deps Cache
uses: actions/cache/save@v3
with:
path: deps
key: deps-${{ runner.os }}-${{ env.OTP_VERSION_SPEC }}-${{ env.ELIXIR_VERSION_SPEC }}-${{ hashFiles('mix.lock') }}

- name: Save PLT cache
id: plt-cache-save
uses: actions/cache/save@v3
with:
path: priv/plts
key: plt-${{ runner.os }}-${{ env.OTP_VERSION_SPEC }}-${{ env.ELIXIR_VERSION_SPEC }}
path: "*"
key: ${{ env.CACHE_KEY }}

- name: Create Dependabot Branch
uses: peterjgrainger/[email protected]
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,5 @@ npm-debug.log

priv/plts

cover
plts
Loading

0 comments on commit b14cada

Please sign in to comment.