-
-
Notifications
You must be signed in to change notification settings - Fork 64
89 lines (82 loc) · 3.43 KB
/
pythonapp.yml
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
# 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
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
python-version: ['3.8', '3.9', '3.10', '3.11']
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Lint with flake8
run: |
python -m pip install flake8
flake8 --statistics .
- name: Check documentation style
run: |
python -m pip install pydocstyle
python -m pydocstyle ufl/
- name: Install UFL
run: python -m pip install .[ci]
- name: Run unit tests
run: |
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.8' }}
env:
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
run: coveralls
- name: Build documentation
run: |
cd doc/sphinx
make html
- name: Upload documentation artifact
uses: actions/upload-artifact@v3
with:
name: doc-${{ matrix.os }}-${{ matrix.python-version }}
path: doc/sphinx/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.8 }}
uses: actions/checkout@v3
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.8 }}
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.8 }}
run: |
cd docs
git rm -r --ignore-unmatch ufl/${{ env.VERSION_NAME }}
mkdir -p ufl/${{ env.VERSION_NAME }}
cp -r ../doc/sphinx/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.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/ufl@${{ github.sha }}"
git push