-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
71802c4
commit 37084df
Showing
4 changed files
with
118 additions
and
3 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
name: Elixir Package | ||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- "main" | ||
paths: | ||
- "eventsub.json" | ||
- "packages/elixir/**" | ||
jobs: | ||
call-test: | ||
uses: ./.github/workflows/elixir-test.yml | ||
|
||
build-and-publish: | ||
name: Build and Publish | ||
needs: call-test | ||
runs-on: ubuntu-latest | ||
steps: | ||
- run: echo "TODO - Build package" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
name: Elixir Test | ||
on: | ||
workflow_call: | ||
pull_request: | ||
branches: | ||
- "main" | ||
paths: | ||
- "eventsub.json" | ||
- "packages/elixir/**" | ||
jobs: | ||
test: | ||
name: Test | ||
runs-on: ${{matrix.os}} | ||
strategy: | ||
matrix: | ||
os: ["ubuntu-latest"] | ||
elixir: ["1.16.x"] | ||
otp: ["26.x"] | ||
steps: | ||
# Setup. | ||
- name: Checkout repo | ||
uses: actions/checkout@v3 | ||
with: | ||
sparse-checkout: "packages/elixir" | ||
sparse-checkout-cone-mode: false | ||
|
||
- name: Set up Elixir | ||
id: beam | ||
uses: erlef/setup-beam@v1 | ||
with: | ||
elixir-version: ${{matrix.elixir}} | ||
otp-version: ${{matrix.otp}} | ||
|
||
# Build cache. | ||
- name: Build cache | ||
uses: actions/cache/restore@v3 | ||
with: | ||
path: _build | ||
key: build-${{matrix.os}}-${{matrix.otp}}-${{matrix.elixir}}-${{ hashFiles('lib/**/*.ex') }} | ||
restore-keys: build-${{matrix.os}}-${{matrix.otp}}-${{matrix.elixir}}- | ||
|
||
# Get and compile elixir deps. | ||
- name: Elixir Deps cache | ||
uses: actions/cache/restore@v3 | ||
with: | ||
path: deps | ||
key: mix-${{ matrix.os }}-${{ matrix.elixir }}-${{ matrix.otp }}-${{ hashFiles('**/mix.lock') }} | ||
restore-keys: mix-${{ matrix.os }}-${{ matrix.elixir }}-${{ matrix.otp }}- | ||
- run: mix deps.get | ||
- run: mix deps.compile | ||
|
||
# Compile :dev and :test. | ||
- run: MIX_ENV=dev mix compile --warnings-as-errors | ||
- run: MIX_ENV=test mix compile | ||
|
||
# Check for unused dependencies. | ||
- run: mix deps.unlock --check-unused | ||
|
||
# Check code quality and style. | ||
- run: mix format --check-formatted | ||
- run: mix credo | ||
|
||
- run: mix test --warnings-as-errors | ||
|
||
# Restore Dialyzer cache | ||
- name: Restore PLT cache | ||
uses: actions/cache/restore@v3 | ||
id: plt_cache | ||
with: | ||
path: priv/plts | ||
key: plt-${{ matrix.os }}-${{ matrix.elixir }}-${{ matrix.otp }} | ||
restore-keys: plt-${{ matrix.os }}-${{ matrix.elixir }}-${{ matrix.otp }} | ||
|
||
# Create PLTs if no cache was found | ||
- name: Create PLTs | ||
if: steps.plt_cache.outputs.cache-hit != 'true' | ||
run: mix dialyzer --plt | ||
|
||
# By default, the GitHub Cache action will only save the cache if all steps in the job succeed, | ||
# so we separate the cache restore and save steps in case running dialyzer fails. | ||
- name: Save PLT cache | ||
id: plt_cache_save | ||
uses: actions/cache/save@v3 | ||
if: steps.plt_cache.outputs.cache-hit != 'true' | ||
with: | ||
key: | | ||
plt-${{ runner.os }}-${{ steps.beam.outputs.otp-version }}-${{ steps.beam.outputs.elixir-version }}-${{ hashFiles('**/mix.lock') }} | ||
path: | | ||
priv/plts | ||
- name: Run dialyzer | ||
run: mix dialyzer --format github |
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
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