forked from pangaea-data-publisher/fuji
-
Notifications
You must be signed in to change notification settings - Fork 4
120 lines (110 loc) · 3.05 KB
/
ci.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
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
name: CI
on:
push:
branches: [master, dev]
pull_request:
concurrency:
group: ci-${{ github.head_ref }}
cancel-in-progress: true
env:
PYTHONUNBUFFERED: 1
FORCE_COLOR: 1 # colored output by pytest etc.
CLICOLOR_FORCE: 1 # colored output by ruff
permissions:
contents: read
jobs:
# TODO: disable docs build until decision is made
# docs:
# runs-on: ubuntu-22.04
# steps:
# - uses: actions/checkout@v4
# - name: Set up Python 3.11
# uses: actions/setup-python@v5
# with:
# python-version: '3.11'
# - name: Cache python dependencies
# uses: actions/cache@v4
# with:
# path: ~/.cache/pip
# key: pip-docs-${{ hashFiles('pyproject.toml') }}
# restore-keys: |
# pip-docs-
# - name: Install python dependencies
# run: |
# python -m pip install .[docs]
# python -m pip show fuji
# - name: Build documentation
# env:
# READTHEDOCS: 'True'
# run: |
# # TODO: add W flag back after fixing warnings
# SPHINXOPTS='-n' make -C docs html
lint:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Cache python dependencies
uses: actions/cache@v4
with:
path: |
~/.cache/pip
~/.cache/pre-commit
key: lint-${{ hashFiles('.pre-commit-config.yaml', 'pyproject.toml') }}
restore-keys: |
lint-
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: '3.11'
- run: |
python -m pip install --upgrade pip setuptools wheel
python -m pip install hatch
- run: hatch run lint
tests:
runs-on: ubuntu-22.04
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: pip
- name: Install python dependencies
run: |
python -m pip install --upgrade pip setuptools wheel
python -m pip install --upgrade hatch
- name: Run test suite with coverage
run: hatch run cov-ci
- name: Upload test results
if: always()
uses: actions/upload-artifact@v4
with:
name: test-results
retention-days: 1
path: pytest-junit.xml
- name: Upload coverage results
if: always()
uses: actions/upload-artifact@v4
with:
name: coverage-results
retention-days: 1
path: pytest-cobertura.xml
- run: rm ./reports/coverage/.gitignore
- name: Generate coverage badge
if: github.ref == 'refs/heads/master'
run: hatch run cov-badge
- name: Deploy reports to GitHub Pages
if: github.ref == 'refs/heads/master'
uses: JamesIves/github-pages-deploy-action@65b5dfd4f5bcd3a7403bbc2959c144256167464e # v4.5.0
with:
folder: ./reports
event_file:
runs-on: ubuntu-22.04
steps:
- uses: actions/upload-artifact@v4
with:
name: event-file
retention-days: 1
path: ${{ github.event_path }}