-
Notifications
You must be signed in to change notification settings - Fork 3
148 lines (148 loc) · 5.85 KB
/
test.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
138
139
140
141
142
143
144
145
146
147
148
name: Test
on:
push:
pull_request:
schedule: [{cron: '30 23 * * 6'}] # M H d m w (Sat at 23:30)
workflow_dispatch:
jobs:
check:
if: github.event_name != 'pull_request' || !contains('OWNER,MEMBER,COLLABORATOR', github.event.pull_request.author_association)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: set PYSHA
run: echo "PYSHA=$(python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV
- uses: actions/cache@v3
with:
path: ~/.cache/pre-commit
key: pre-commit|${{ env.PYSHA }}|${{ hashFiles('.pre-commit-config.yaml') }}
- name: dependencies
run: |
pip install -U pre-commit
sudo apt-get install -yqq clang-format
- uses: reviewdog/action-setup@v1
- if: github.event_name == 'push' || github.event_name == 'pull_request'
name: comment
run: |
if [[ $EVENT == pull_request ]]; then
REPORTER=github-pr-review
else
REPORTER=github-check
fi
pre-commit run -a todo | reviewdog -efm="%f:%l: %m" -name=TODO -tee -reporter=$REPORTER -filter-mode nofilter
pre-commit run -a flake8 | reviewdog -f=pep8 -name=flake8 -tee -reporter=$REPORTER -filter-mode nofilter
pre-commit run -a mypy | reviewdog -efm="%f:%l: %m" -name=mypy -tee -reporter=$REPORTER -filter-mode nofilter
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
EVENT: ${{ github.event_name }}
- run: pre-commit run -a --show-diff-on-failure
test:
if: github.event_name != 'pull_request' || !contains('OWNER,MEMBER,COLLABORATOR', github.event.pull_request.author_association)
name: py${{ matrix.python }}
runs-on: ubuntu-latest
strategy:
matrix:
python: [3.7, 3.11]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- name: pip install -U -e .[dev]
# in-place for pytest (-e . doesn't work yet for scikit-build-core)
run: |
pip install toml
python -c 'import toml; c=toml.load("pyproject.toml"); print("\0".join(c["build-system"]["requires"]), end="")' \
| xargs -0 pip install
python -c 'import toml; c=toml.load("pyproject.toml"); print("\0".join(c["project.optional-dependencies"]["dev"]), end="")' \
| xargs -0 pip install
pip install --no-build-isolation --no-deps -t . -U -v . -Ccmake.define.CUVEC_DEBUG=1
git restore cuvec/src
- run: pytest
- uses: codecov/codecov-action@v3
- name: compile -Wall
run: |
git clean -Xdf
python -m build -n -w \
-Ccmake.define.CMAKE_CXX_FLAGS="-Wall -Wextra -Wpedantic -Werror -Wno-missing-field-initializers -Wno-unused-parameter -Wno-cast-function-type"
cuda:
if: github.event_name != 'pull_request' || !contains('OWNER,MEMBER,COLLABORATOR', github.event.pull_request.author_association)
name: CUDA py${{ matrix.python }}
runs-on: [self-hosted, cuda, python]
strategy:
matrix:
python: [3.7, 3.11]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Run setup-python
run: setup-python -p${{ matrix.python }} 'cuda-version<12' cupy
- name: pip install -U -e .[dev]
# in-place for pytest (-e . doesn't work yet for scikit-build-core)
run: |
pip install toml
python -c 'import toml; c=toml.load("pyproject.toml"); print("\0".join(c["build-system"]["requires"]), end="")' \
| xargs -0 pip install
python -c 'import toml; c=toml.load("pyproject.toml"); print("\0".join(c["project.optional-dependencies"]["dev"]), end="")' \
| xargs -0 pip install
pip install --no-build-isolation --no-deps -t . -U -v . -Ccmake.define.CUVEC_DEBUG=1
git restore cuvec/src
- run: pytest
- uses: codecov/codecov-action@v3
- name: compile -Wall
run: |
git clean -Xdf
python -m build -n -w \
-Ccmake.define.CMAKE_CXX_FLAGS="-Wall -Wextra -Wpedantic -Werror -Wno-missing-field-initializers -Wno-unused-parameter -Wno-cast-function-type" \
-Ccmake.define.CMAKE_CUDA_ARCHITECTURES=all
- name: Post Run setup-python
run: setup-python -p${{ matrix.python }} -Dr
if: ${{ always() }}
deploy:
needs: [check, test, cuda]
name: PyPI Deploy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GH_TOKEN || github.token }}
- uses: actions/setup-python@v5
with:
python-version: '3.x'
- id: dist
uses: casperdcl/deploy-pypi@v2
with:
build: -s
password: ${{ secrets.PYPI_TOKEN }}
upload: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags') }}
- if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
name: Release
run: |
changelog=$(git log --pretty='format:%d%n- %s%n%b---' $(git tag --sort=v:refname | tail -n2 | head -n1)..HEAD)
tag="${GITHUB_REF#refs/tags/}"
gh release create --title "CuVec $tag stable" --draft --notes "$changelog" "$tag" dist/${{ steps.dist.outputs.targz }}
env:
GH_TOKEN: ${{ secrets.GH_TOKEN || github.token }}
- name: Docs
run: |
pushd docs
pip install -U -r requirements.txt
PYTHONPATH=. pydoc-markdown --build --site-dir=../../../dist/site
popd
- if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags') || github.event_name == 'workflow_dispatch' }}
uses: casperdcl/push-dir@v1
with:
message: update static site
branch: gh-pages
history: false
dir: dist/site
nojekyll: true
name: AMYPAD[bot]
email: [email protected]