Skip to content

Commit cdc2c7e

Browse files
committed
Update CI/CD workflows to use Elixir 1.18 and OTP 27; add pre-commit hook for automatic code formatting
1 parent 68d2b67 commit cdc2c7e

File tree

3 files changed

+33
-4
lines changed

3 files changed

+33
-4
lines changed

.githooks/pre-commit

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/bin/sh
2+
3+
# Store files that are about to be committed
4+
staged_files=$(git diff --cached --name-only --diff-filter=d | grep .ex$)
5+
6+
if [ -n "$staged_files" ]; then
7+
echo "Running mix format on staged Elixir files..."
8+
9+
# Run mix format
10+
mix format
11+
12+
# Add the formatted files back to staging
13+
echo "$staged_files" | while read file; do
14+
if [ -f "$file" ]; then
15+
git add "$file"
16+
fi
17+
done
18+
fi
19+
20+
# Run format check to ensure everything is formatted
21+
mix format --check-formatted
22+
if [ $? -ne 0 ]; then
23+
echo "❌ Code must be properly formatted before committing."
24+
echo "Please stage the formatting changes and try again."
25+
exit 1
26+
fi
27+
28+
echo "✅ Code formatting check passed."
29+
exit 0

.github/workflows/ci.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ jobs:
1818
- name: Set up Elixir
1919
uses: erlef/setup-beam@v1
2020
with:
21-
elixir-version: '1.14.x'
22-
otp-version: '25.x'
21+
elixir-version: '1.18.x'
22+
otp-version: '27.x'
2323

2424
- name: Cache deps
2525
uses: actions/cache@v3

.github/workflows/release.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ jobs:
1515
- name: Set up Elixir
1616
uses: erlef/setup-beam@v1
1717
with:
18-
elixir-version: '1.14.x'
19-
otp-version: '25.x'
18+
elixir-version: '1.18.x'
19+
otp-version: '27.x'
2020

2121
- name: Install dependencies
2222
run: mix deps.get

0 commit comments

Comments
 (0)