-
Notifications
You must be signed in to change notification settings - Fork 1
137 lines (112 loc) · 3.59 KB
/
ci_tests.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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
name: CI - Tests
on:
pull_request:
push:
branches:
- main
- 'push-action/**'
jobs:
basic-tests:
name: External
uses: SINTEF/ci-cd/.github/workflows/[email protected]
with:
# General setup
install_extras: "[dev]"
# pre-commit
run_pre-commit: true
python_version_pre-commit: "3.10"
# pylint & safety
python_version_pylint_safety: "3.10"
run_pylint: false
run_safety: true
# ID: 70612
# Package: Jinja2
# Has been disputed by the maintainer and multiple third parties.
# For more information see: https://github.com/advisories/GHSA-f6pv-j8mr-w6rr
safety_options: |
--ignore=70612
# Build dist
run_build_package: true
python_version_package: "3.10"
build_libs: "build"
build_cmd: "python -m build"
# Build documentation
run_build_docs: true
python_version_docs: "3.10"
warnings_as_errors: true
use_mkdocs: true
update_python_api_ref: true
update_docs_landing_page: true
package_dirs: "turtle_canon"
pytest:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install python dependencies
run: |
python -m pip install -U pip
pip install -U setuptools wheel
pip install -e .[dev]
- name: Test with pytest
run: pytest -vvv --cov-report=xml
- name: Upload coverage to Codecov
if: github.repository == 'CasperWA/turtle-canon'
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true
env_vars: OS,PYTHON
name: turtle-canon
flags: turtle-canon
env:
OS: ubuntu-latest
PYTHON: "3.10"
as-pre-commit-hook:
name: As a pre-commit hook (pre-commit ${{ matrix.pre-commit-version }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
pre-commit-version:
- "==1.15.0" # minimum pre-commit version for turtle-canon
# latest major versions
- "~=1.0"
- "~=2.0"
- "~=3.0"
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -U setuptools wheel
pip install "pre-commit${{ matrix.pre-commit-version }}"
- name: Set 'rev' to current commit SHA
run: sed -i "s|COMMIT_SHA|${GITHUB_SHA}|" .github/utils/.pre-commit-config.yaml
- name: Test pre-commit hook
run: pre-commit run -c .github/utils/.pre-commit-config.yaml --all-files --verbose && exit 1 || exit 0
- name: Check files
run: |
if [ -z "$(git status --porcelain tests)" ]; then
echo "Turtle Canon didn't canonize any files under tests/ !"
echo "pre-commit log:"
cat "/home/runner/.cache/pre-commit/pre-commit.log"
exit 1
fi
if [ -n "$(git status --porcelain tests/static/rdflib_canonized)" ]; then
echo "Turtle Canon canonized already canonized files under tests/static/rdflib_canonized !"
echo "pre-commit log:"
cat "/home/runner/.cache/pre-commit/pre-commit.log"
exit 1
fi
# Now everything should run fine
pre-commit run -c .github/utils/.pre-commit-config.yaml --all-files