Norma CI #259
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
name: Norma CI | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
workflow_dispatch: | |
schedule: | |
- cron: '0 8 * * *' # Midnight PST (8:00 UTC) | |
jobs: | |
format: | |
name: Auto-format Code | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
- name: Set up Julia | |
uses: julia-actions/setup-julia@v1 | |
with: | |
version: '1.11' # Adjust as needed | |
- name: Install JuliaFormatter | |
run: julia -e 'using Pkg; Pkg.add("JuliaFormatter"); Pkg.update()' | |
- name: Run JuliaFormatter with Spaces | |
run: julia -e 'using JuliaFormatter; format(".")' | |
- name: Commit formatted files (if needed) | |
run: | | |
git config --global user.name "github-actions[bot]" | |
git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
git add -A | |
if git diff --cached --exit-code; then | |
echo "No formatting changes needed." | |
else | |
BRANCH_NAME=${GITHUB_REF#refs/heads/} | |
echo "Detected branch: $BRANCH_NAME" | |
git switch "$BRANCH_NAME" 2>/dev/null || git checkout -B "$BRANCH_NAME" | |
git commit -m "Auto-format code using JuliaFormatter (spaces only)" | |
git push origin "$BRANCH_NAME" | |
fi | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
test: | |
name: Run Tests | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest] | |
julia-version: ["1.10", "1.11"] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
- name: Set up Julia | |
uses: julia-actions/setup-julia@v1 | |
with: | |
version: ${{ matrix.julia-version }} | |
- name: Remove existing Manifest.toml | |
run: rm -f Manifest.toml | |
- name: Install dependencies | |
run: julia --project=. -e 'using Pkg; Pkg.instantiate()' | |
- name: Run tests | |
run: julia --project=. -e 'using Pkg; Pkg.test()' |