-
-
Notifications
You must be signed in to change notification settings - Fork 46
173 lines (152 loc) · 6.53 KB
/
Copy pathpythonapp.yml
File metadata and controls
173 lines (152 loc) · 6.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
# 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]
merge_group:
branches: [main]
workflow_dispatch:
# Weekly build on Mondays at 8 am
schedule:
- cron: "0 8 * * 1"
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: ["windows-2022", "ubuntu-latest", "macos-latest"]
python-version: ["3.11", "3.12", "3.13", "3.14"]
permissions:
packages: write
env:
VCPKG_EXE: C:/vcpkg/vcpkg
FEED_URL: https://nuget.pkg.github.com/FEniCS/index.json
VCPKG_BINARY_SOURCES: "clear;nuget,https://nuget.pkg.github.com/FEniCS/index.json,readwrite"
steps:
- name: Add NuGet sources
if: runner.os == 'Windows'
shell: pwsh
run: |
.$(${{ env.VCPKG_EXE }} fetch nuget) `
sources add `
-Source "${{ env.FEED_URL }}" `
-StorePasswordInClearText `
-Name GitHubPackages `
-UserName "${{ env.USERNAME }}" `
-Password "${{ secrets.GITHUB_TOKEN }}"
.$(${{ env.VCPKG_EXE }} fetch nuget) `
setapikey "${{ secrets.GITHUB_TOKEN }}" `
-Source "${{ env.FEED_URL }}"
- name: Checkout FFCx
uses: actions/checkout@v7
- name: Load environment variables (Unix)
if: runner.os != 'Windows'
run: cat .github/workflows/fenicsx-refs.env >> $GITHUB_ENV
- name: Load environment variables (Windows)
if: runner.os == 'Windows'
run: cat .github/workflows/fenicsx-refs.env >> $env:GITHUB_ENV
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies (non-Python, Linux)
if: runner.os == 'Linux'
run: |
sudo apt-get install -y graphviz libgraphviz-dev ninja-build pkg-config libblas-dev liblapack-dev
- name: Install dependencies (non-Python, macOS)
if: runner.os == 'macOS'
run: brew install ninja
- name: Install FEniCS dependencies (Python, Unix)
if: runner.os == 'Linux' || runner.os == 'macOS'
run: |
pip install git+https://github.com/${{ env.ufl_repository }}.git@${{ env.ufl_ref }}
pip install git+https://github.com/${{ env.basix_repository }}.git@${{ env.basix_ref }}
- name: Install FEniCS dependencies (Python, Windows)
if: runner.os == 'Windows'
run: |
pip install git+https://github.com/${{ env.ufl_repository }}.git@${{ env.ufl_ref }}
pip install -v git+https://github.com/${{ env.basix_repository }}.git@${{ env.basix_ref }} --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: ruff checks
run: |
ruff check .
ruff format --check .
- name: Static check with mypy
run: mypy -p ffcx
- name: Run unit tests
run: >
python -m pytest -vs test/
-n auto
-W error
--cov=ffcx/
--junitxml=junit/test-results-${{ matrix.os }}-${{ matrix.python-version }}.xml
- name: Upload to Coveralls
if: ${{ github.repository == 'FEniCS/ffcx' && github.head_ref == '' && matrix.os == 'ubuntu-latest' && matrix.python-version == '3.12' }}
env:
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
run: coveralls
continue-on-error: true
- name: Upload pytest results
uses: actions/upload-artifact@v7
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 -vs demo/test_demos.py -W error
- name: Build documentation
run: |
cd doc
python -m sphinx -W -b html source/ build/html/
- name: Upload documentation artifact
uses: actions/upload-artifact@v7
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.12 }}
uses: actions/checkout@v7
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.12 }}
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.12 }}
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.12 }}
run: |
cd docs
git config --global user.email "fenics@github.com"
git config --global user.name "FEniCS GitHub Actions"
git add --all
git commit --allow-empty -m "Python FEniCS/ffcx@${{ github.sha }}"
git push