-
Notifications
You must be signed in to change notification settings - Fork 0
109 lines (93 loc) · 2.89 KB
/
docs.yml
File metadata and controls
109 lines (93 loc) · 2.89 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
name: Build, test, and publish documentation
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
# Required permissions for deploying to GitHub Pages
permissions:
contents: write
pages: write
jobs:
test:
name: Run tests and upload coverage
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.12]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Cache pip
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: "pip-${{ runner.os }}-py-${{ matrix.python-version }}-${{ hashFiles('**/requirements*.txt') }}"
restore-keys: |
pip-${{ runner.os }}-py-${{ matrix.python-version }}-
- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools wheel
pip install -r docs/requirements.txt
pip install -e .
pip install pytest pytest-cov
- name: Run tests with coverage
run: |
pytest --cov=panoptes.data --cov-report=xml:coverage.xml --cov-report=html:htmlcov -q
- name: Upload coverage report (xml)
uses: actions/upload-artifact@v4
with:
name: coverage-xml
path: coverage.xml
- name: Upload coverage HTML
uses: actions/upload-artifact@v4
with:
name: coverage-html
path: htmlcov
build-docs:
name: Build and publish docs
needs: test
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.12]
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Cache pip
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: "pip-${{ runner.os }}-py-${{ matrix.python-version }}-${{ hashFiles('**/requirements*.txt') }}"
restore-keys: |
pip-${{ runner.os }}-py-${{ matrix.python-version }}-
- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools wheel
pip install -r docs/requirements.txt
pip install -e .
- name: Build docs
working-directory: docs
run: make html
- name: Upload HTML docs artifact
uses: actions/upload-artifact@v4
with:
name: docs-html
path: docs/_build/html
- name: Deploy to GitHub Pages
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: docs/_build/html
publish_branch: gh-pages