-
Notifications
You must be signed in to change notification settings - Fork 3
87 lines (82 loc) · 2.58 KB
/
test_docs.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
name: Test ✔️ and document 📄
on:
push:
branches:
- main
jobs:
test:
name: Test ✔️
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v3
- name: Install micromamba
uses: mamba-org/setup-micromamba@v1
with:
environment-file: environment.yml
init-shell: bash
generate-run-shell: true
- name: Set up dependencies
run: |
poetry install --without dev,doc --no-root
shell: micromamba-shell {0}
- name: Install Adelie
run: pip install -e .
shell: micromamba-shell {0}
- name: Move Mosek license
run: |
mkdir -p $HOME/mosek
cp docs/mosek/mosek.lic $HOME/mosek
- name: Run tests
run: python3 -m pytest tests
shell: micromamba-shell {0}
doc:
name: Document 📄
runs-on: ubuntu-latest
permissions:
contents: write # IMPORTANT: mandatory for pushing to gh-pages
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v3
- name: Install micromamba
uses: mamba-org/setup-micromamba@v1
with:
environment-file: environment.yml
init-shell: bash
generate-run-shell: true
- name: Set up dependencies
run: |
poetry install --without test,dev --no-root
shell: micromamba-shell {0}
- name: Install Adelie
run: pip install -e .
shell: micromamba-shell {0}
- name: Install pandoc
run: |
sudo wget https://github.com/jgm/pandoc/releases/download/3.1.8/pandoc-3.1.8-1-amd64.deb -O /tmp/pandoc-3.1.8-1-amd64.deb
sudo dpkg -i /tmp/pandoc-3.1.8-1-amd64.deb
- name: Build documentation
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git fetch --all
git checkout gh-pages
git merge main -Xtheirs --allow-unrelated-histories # keeps main changes over gh-pages
cd docs
rm -rf _images _sources _static .doctrees generated notebooks *.html *.inv *.js .buildinfo
cd sphinx
make clean && make html
cp -r _build/html/* ..
touch .nojekyll
shell: micromamba-shell {0}
- name: Commit documentation changes
run: |
git add .
git commit -m "Update documentation" -a || true
# The above command will fail if no changes were present, so we ignore that.
- name: Push changes
uses: ad-m/github-push-action@master
with:
branch: gh-pages
directory: docs
github_token: ${{ secrets.GITHUB_TOKEN }}