Skip to content

Commit

Permalink
Added GitHub Actions workflow to check format and run tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Gaurav1924 committed Jul 29, 2024
1 parent 83acc0c commit 3df0736
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/check-format-and-test.yml
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

0 comments on commit 3df0736

Please sign in to comment.