-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added GitHub Actions workflow to check format and run tests
- Loading branch information
1 parent
83acc0c
commit 3df0736
Showing
1 changed file
with
37 additions
and
0 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,37 @@ | ||
name: Check Format and Run Tests | ||
|
||
on: | ||
pull_request: | ||
paths: | ||
- '**/*.ex' | ||
- '**/*.exs' | ||
- 'mix.exs' | ||
- '.formatter.exs' | ||
|
||
jobs: | ||
format-and-test: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Elixir | ||
uses: erlef/setup-elixir@v2 | ||
with: | ||
elixir-version: '1.14' | ||
otp-version: '25' | ||
|
||
- name: Install dependencies | ||
run: mix deps.get | ||
|
||
- name: Check code formatting | ||
run: | | ||
mix format --check-formatted | ||
if [ $? -ne 0 ]; then | ||
echo "Code is not formatted correctly. Please run 'mix format' and commit your changes." | ||
exit 1 | ||
fi | ||
- name: Run tests | ||
run: mix test |