Skip to content

Commit 3684864

Browse files
committed
Update CI/CD to new tox workflow
1 parent a99622a commit 3684864

File tree

1 file changed

+41
-39
lines changed

1 file changed

+41
-39
lines changed

.github/workflows/ci-build.yml

Lines changed: 41 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -8,70 +8,62 @@ on:
88
branches:
99
- main
1010

11+
env:
12+
MAIN_PYTHON_VERSION: '3.10'
13+
1114
jobs:
12-
pre-commit:
13-
name: Pre-commit checks
14-
runs-on: ubuntu-latest
1515

16+
style:
17+
name: Code style
18+
runs-on: ubuntu-latest
1619
steps:
1720
- uses: actions/checkout@v2
18-
- name: Setup Python
21+
- name: Set up Python
1922
uses: actions/setup-python@v2
2023
with:
21-
python-version: '3.10'
22-
- name: Install pre-commit requirements
24+
python-version: ${{ env.MAIN_PYTHON_VERSION }}
25+
- name: Install dependencies
2326
run: |
24-
pip install pre-commit~=2.16.0
27+
python -m pip install --upgrade pip tox
28+
- name: Test with tox
29+
run: tox -e style
2530

26-
- name: Run pre-commit
27-
run: |
28-
pre-commit run --all-files || ( git status --short ; git diff ; exit 1 )
29-
30-
docs_build:
31+
docs:
32+
name: Documentation
3133
runs-on: ubuntu-latest
32-
34+
needs: docs-style
3335
steps:
3436
- uses: actions/checkout@v2
3537

36-
- name: Setup Python
37-
uses: actions/setup-python@v2.2.2
38+
- name: Set up Python
39+
uses: actions/setup-python@v2
3840
with:
39-
python-version: 3.8
41+
python-version: ${{ env.MAIN_PYTHON_VERSION }}
4042

41-
- name: Install diagrams dependencies
43+
- name: Install system dependencies
4244
run: |
4345
sudo apt-get update
44-
sudo apt-get install nodejs npm graphviz
46+
sudo apt-get install -y texlive-latex-extra latexmk nodejs npm graphviz
4547
npm install -g @mermaid-js/mermaid-cli
4648
47-
- name: Build HTML Documentation
49+
- name: Install Python dependencies
4850
run: |
49-
pip install -r requirements_docs.txt --disable-pip-version-check
50-
make -C doc html SPHINXOPTS="-W"
51-
touch doc/build/html/.nojekyll
52-
echo "dev.docs.pyansys.com" > doc/build/html/CNAME
53-
54-
- name: Deploy to gh-pages on main
55-
if: github.ref == 'refs/heads/main'
56-
uses: JamesIves/[email protected]
57-
with:
58-
token: ${{ secrets.github_token }}
59-
branch: gh-pages
60-
folder: doc/build/html
61-
clean: true
62-
single-commit: true
63-
51+
python -m pip install --upgrade pip tox
52+
53+
- name: Build HTML documentation
54+
run: tox -e doc
55+
6456
- name: Build PDF Documentation
6557
run: |
6658
sudo apt update
6759
sudo apt-get install -y texlive-latex-extra latexmk
6860
make -C doc latexpdf
6961
70-
- name: Upload HTML Documentation
62+
- name: Upload HTML documentation
7163
uses: actions/[email protected]
7264
with:
7365
name: HTML-Documentation
74-
path: doc/build/html
66+
path: .tox/doc_out_html/
7567
retention-days: 7
7668

7769
- name: Upload PDF Documentation
@@ -81,17 +73,27 @@ jobs:
8173
path: doc/build/latex/*.pdf
8274
retention-days: 7
8375

84-
Release:
76+
- name: Deploy to gh-pages
77+
if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
78+
uses: JamesIves/[email protected]
79+
with:
80+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
81+
BRANCH: gh-pages
82+
FOLDER: .tox/doc_out_html/
83+
CLEAN: true
84+
SINGLE_COMMIT: true
85+
86+
release:
8587
if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
86-
needs: docs_build
88+
needs: [style, docs]
8789
runs-on: ubuntu-latest
8890
steps:
8991
- uses: actions/checkout@v2
9092

9193
- name: Set up Python
9294
uses: actions/setup-python@v1
9395
with:
94-
python-version: 3.8
96+
python-version: ${{ env.MAIN_PYTHON_VERSION }}
9597

9698
- uses: actions/download-artifact@v2
9799

0 commit comments

Comments
 (0)