Files
Calabi-Yau-Period-Geometry/.gitea/workflows/ci.yml
T

49 lines
1.5 KiB
YAML

name: CI
on:
push:
branches: ["**"]
pull_request:
branches: ["**"]
jobs:
lint:
runs-on: ubuntu-latest
# Custom image (see .gitea/ci-image/Dockerfile): the official
# sagemath/sagemath image is amd64-only and this runner is arm64, and
# ruff/pytest are baked in here so jobs don't reinstall them every run.
container:
image: gitea.piribauer.ch/julian/sage-ci:latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Preparse .sage files
# Turns each *.sage file into real Python (*.sage.py) so ruff can
# parse it, and prepends the `from sage.all import *` that `sage`
# normally injects at runtime, so Sage's globals (ZZ, var, matrix, ...)
# resolve instead of looking like undefined names.
run: .gitea/preparse.sh
- name: ruff check
# --no-respect-gitignore: *.sage.py is gitignored (it's generated, see
# the previous step) but that's exactly what we need to lint here.
# `python` here is the conda env's own interpreter -- it already has
# sage/ruff/pytest importable, `sage --python` isn't a real flag on
# the conda-forge sage CLI.
run: python -m ruff check --no-respect-gitignore .
test:
runs-on: ubuntu-latest
needs: lint
container:
image: gitea.piribauer.ch/julian/sage-ci:latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Run tests
run: python -m pytest tests/