Merge branch 'master' into indiamai/integrate-fuse #1523
This file contains hidden or 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
# This workflow will install Python dependencies, run tests and lint | |
# with a single version of Python For more information see: | |
# https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions | |
name: UFL CI | |
on: | |
push: | |
branches: | |
- "**" | |
tags: | |
- "**" | |
pull_request: | |
branches: | |
- main | |
# Weekly build on Mondays at 8 am | |
schedule: | |
- cron: "0 8 * * 1" | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13', '3.14-dev'] | |
steps: | |
- uses: actions/checkout@v5 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Lint with ruff | |
run: | | |
pip install ruff | |
ruff check . | |
ruff format --check . | |
- name: Install UFL | |
run: python -m pip install .[ci] | |
- name: Lint with mypy | |
run: | | |
mypy -p ufl | |
mypy test/ | |
cd test/ | |
mypy ../demo/ | |
- name: Run unit tests | |
# Run tests twice, coverage raises warnings, thus does not pass with -W error | |
run: | | |
python -m pytest -W error -n auto test/ | |
python -m pytest -n auto --cov=ufl/ --junitxml=junit/test-results-${{ matrix.os }}-${{ matrix.python-version }}.xml test/ | |
- name: Upload to Coveralls | |
if: ${{ github.repository == 'FEniCS/ufl' && github.head_ref == '' && matrix.os == 'ubuntu-latest' && matrix.python-version == '3.12' }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }} | |
run: coveralls | |
- name: Build documentation | |
run: | | |
cd doc | |
make html | |
- name: Upload documentation artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: doc-${{ matrix.os }}-${{ matrix.python-version }} | |
path: doc/build/html/ | |
retention-days: 2 | |
if-no-files-found: error | |
- name: Checkout FEniCS/docs | |
if: ${{ github.repository == 'FEniCS/ufl' && ( github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/') ) && runner.os == 'Linux' && matrix.python-version == 3.12 }} | |
uses: actions/checkout@v5 | |
with: | |
repository: "FEniCS/docs" | |
path: "docs" | |
ssh-key: "${{ secrets.SSH_GITHUB_DOCS_PRIVATE_KEY }}" | |
- name: Set version name | |
if: ${{ github.repository == 'FEniCS/ufl' && ( github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/') ) && runner.os == 'Linux' && matrix.python-version == 3.12 }} | |
run: | | |
echo "VERSION_NAME=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV | |
- name: Copy documentation into repository | |
if: ${{ github.repository == 'FEniCS/ufl' && ( github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/') ) && runner.os == 'Linux' && matrix.python-version == 3.12 }} | |
run: | | |
cd docs | |
git rm -r --ignore-unmatch ufl/${{ env.VERSION_NAME }} | |
mkdir -p ufl/${{ env.VERSION_NAME }} | |
cp -r ../doc/build/html/* ufl/${{ env.VERSION_NAME }} | |
- name: Commit and push documentation to FEniCS/docs | |
if: ${{ github.repository == 'FEniCS/ufl' && ( github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/') ) && runner.os == 'Linux' && matrix.python-version == 3.12 }} | |
run: | | |
cd docs | |
git config --global user.email "[email protected]" | |
git config --global user.name "FEniCS GitHub Actions" | |
git add --all | |
git commit --allow-empty -m "Python FEniCS/ufl@${{ github.sha }}" | |
git push |