-
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.
* Set up for releasing to hex * Test against earliest and latest versions * Support earlier Elixir versions * Add missing params to test * We don't care about old formatters/dialyzer * Try removing cache to address BEAM mismatch * Allow running the checks locally * Make sure Elixir/OTP versions don't share cache * Update .github/workflows/publish-hex.yml Co-authored-by: Jason Pollentier <802805+grossvogel@users.noreply.github.com> * Older versions already checked in other workflows This would have also caused the pubish command to be run twice --------- Co-authored-by: Jason Pollentier <802805+grossvogel@users.noreply.github.com>
- Loading branch information
1 parent
3c5cd24
commit d5137c7
Showing
6 changed files
with
110 additions
and
10 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,47 @@ | ||
name: Publish to Hex | ||
|
||
on: | ||
release: | ||
types: [published] | ||
|
||
jobs: | ||
publish: | ||
runs-on: ubuntu-22.04 | ||
name: Publish to Hex | ||
env: | ||
HEX_API_KEY: ${{ secrets.HEX_API_KEY }} | ||
MIX_ENV: test | ||
strategy: | ||
matrix: | ||
include: | ||
- otp: "26" | ||
elixir: "1.16" | ||
steps: | ||
- name: Set up Elixir | ||
uses: erlef/setup-beam@v1 | ||
with: | ||
otp-version: ${{matrix.otp}} | ||
elixir-version: ${{matrix.elixir}} | ||
|
||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
# We want to use the newest deps here, since library users will not be | ||
# locked to our mix.lock versions | ||
- name: Install dependencies | ||
run: mix deps.unlock --all && mix deps.get | ||
|
||
- name: Compile and fail on warnings | ||
run: mix compile --warnings-as-errors | ||
|
||
- name: Check formatting | ||
run: mix format --check-formatted | ||
|
||
- name: Check function specs with Dialyzer | ||
run: mix dialyzer | ||
|
||
- name: Run tests | ||
run: mix test | ||
|
||
- name: Publish to Hex | ||
run: mix hex.publish --yes |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
echo "Running pre-push checks (skip with --no-verify)..." | ||
|
||
interrupt() { | ||
echo "\n" | ||
echo "Trapped the INT signal, exiting..." | ||
# https://tldp.org/LDP/abs/html/exitcodes.html | ||
exit 130 | ||
} | ||
|
||
print_skip_message() { | ||
echo "\n" | ||
echo "Checks failed, see above. You can skip them by running git push --no-verify." | ||
} | ||
|
||
trap interrupt INT | ||
# Ensure the skip message is printed when the script exits | ||
trap '[[ $? -ne 0 ]] && print_skip_message' EXIT | ||
|
||
mix format --check-formatted | ||
if [ $? -ne 0 ]; then | ||
exit 1 | ||
fi | ||
|
||
mix dialyzer | ||
if [ $? -ne 0 ]; then | ||
exit 1 | ||
fi | ||
|
||
mix test | ||
if [ $? -ne 0 ]; then | ||
exit 1 | ||
fi |
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