Skip to content

Reenable Windowa test (#724) #4600

Reenable Windowa test (#724)

Reenable Windowa test (#724) #4600

Workflow file for this run

# 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: FFCx CI
on:
push:
branches:
- "**"
tags:
- "v*"
pull_request:
branches:
- main
workflow_dispatch:
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
python-version: ['3.9', '3.10', '3.11', '3.12']
include:
- os: windows-2022
python-version: '3.11'
- os: macos-latest
python-version: '3.12'
steps:
- name: Checkout FFCx
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Export GitHub Actions cache environment variables (Windows)
if: runner.os == 'Windows'
uses: actions/github-script@v7
with:
script: |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
- name: Install dependencies (non-Python, Linux)
if: runner.os == 'Linux'
run: |
sudo apt-get install -y graphviz libgraphviz-dev ninja-build pkg-config
- name: Install dependencies (non-Python, macOS)
if: runner.os == 'macOS'
run: brew install ninja pkg-config
- name: Install FEniCS dependencies (Python, Unix)
if: runner.os == 'Linux' || runner.os == 'macOS'
run: |
pip install git+https://github.com/FEniCS/ufl.git
pip install git+https://github.com/FEniCS/basix.git
- name: Install FEniCS dependencies (Python, Windows)
if: runner.os == 'Windows'
env:
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"
run: |
pip install git+https://github.com/FEniCS/ufl.git
pip install -v git+https://github.com/FEniCS/basix.git --config-settings=cmake.args=-DINSTALL_RUNTIME_DEPENDENCIES=ON --config-settings=cmake.args=-DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake
- name: Install FFCx (Linux, with optional dependencies)
if: runner.os == 'Linux'
run: pip install .[ci,optional]
- name: Install FFCx (macOS, Windows)
if: runner.os != 'Linux'
run: pip install .[ci]
- name: Static check with mypy
run: mypy ffcx/
- name: ruff checks
run: |
ruff check .
ruff format --check .
- name: Run units tests
run: python -m pytest -n auto --cov=ffcx/ --junitxml=junit/test-results-${{ matrix.os }}-${{ matrix.python-version }}.xml test/
- name: Upload to Coveralls
if: ${{ github.repository == 'FEniCS/ffcx' && github.head_ref == '' && matrix.os == 'ubuntu-latest' && matrix.python-version == '3.8' }}
env:
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
run: coveralls
continue-on-error: true
- name: Upload pytest results
uses: actions/upload-artifact@v4
with:
name: pytest-results-${{ matrix.os }}-${{ matrix.python-version }}
path: junit/test-results-${{ matrix.os }}-${{ matrix.python-version }}.xml
# Use always() to always run this step to publish test results
# when there are test failures
if: always()
- name: Setup cl.exe (Windows)
if: runner.os == 'Windows'
uses: ilammy/msvc-dev-cmd@v1
- name: Run FFCx demos
run: |
pytest demo/test_demos.py
- 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/ffcx' && ( github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/') ) && runner.os == 'Linux' && matrix.python-version == 3.8 }}
uses: actions/checkout@v4
with:
repository: "FEniCS/docs"
path: "docs"
ssh-key: "${{ secrets.SSH_GITHUB_DOCS_PRIVATE_KEY }}"
- name: Set version name
if: ${{ github.repository == 'FEniCS/ffcx' && ( github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/') ) && runner.os == 'Linux' && matrix.python-version == 3.8 }}
run: |
echo "VERSION_NAME=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Copy documentation into repository
if: ${{ github.repository == 'FEniCS/ffcx' && ( github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/') ) && runner.os == 'Linux' && matrix.python-version == 3.8 }}
run: |
cd docs
git rm -r --ignore-unmatch ffcx/${{ env.VERSION_NAME }}
mkdir -p ffcx/${{ env.VERSION_NAME }}
cp -r ../doc/build/html/* ffcx/${{ env.VERSION_NAME }}
- name: Commit and push documentation to FEniCS/docs
if: ${{ github.repository == 'FEniCS/ffcx' && ( github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/') ) && runner.os == 'Linux' && matrix.python-version == 3.8 }}
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/ffcx@${{ github.sha }}"
git push