-
Notifications
You must be signed in to change notification settings - Fork 15
170 lines (159 loc) · 5.18 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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
name: Lint and Test
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
concurrency:
group: ${{ github.workflow }}-${{ github.ref_name || github.ref }}
cancel-in-progress: true
jobs:
package-lint:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.9', '3.10', '3.11', '3.12']
fail-fast: false
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip' # caching pip dependencies
- name: Install dependencies
run: |
python -m pip install -e .[test]
- name: Run linters
run: make lint
package-test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.9', '3.10', '3.11', '3.12']
fail-fast: false
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip' # caching pip dependencies
- name: Install dependencies
run: |
sudo apt-get install -y firejail
python -m pip install -e .[test]
- name: Run all tests
run: make test
- name: Upload coverage
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }} # required
files: coverage.xml
flags: unittests # optional
fail_ci_if_error: true # optional (default = false)
verbose: true # optional (default = false)
package-build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.9', '3.10', '3.11', '3.12']
fail-fast: false
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip' # caching pip dependencies
- name: Install dependencies
run: |
python -m pip install wheel
- name: Build wheel
run: |
# TODO: replace with make build
python -m pip wheel . --no-deps --wheel-dir dist
docker-build:
strategy:
matrix:
python-version: ['3.9', '3.10', '3.11', '3.12']
fail-fast: false
uses: manytask/workflows/.github/workflows/reusable-docker-build-push.yml@main
with:
platforms: linux/amd64,linux/arm64
tags: manytask/checker:${{ matrix.python-version }}-${{ github.sha }}
artifact: true
artifact_name: manytask-checker-${{ matrix.python-version }}.tar
docker-test:
needs: [docker-build]
strategy:
matrix:
python-version: ['3.9', '3.10', '3.11', '3.12']
fail-fast: false
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download Docker Image Artifact
uses: actions/download-artifact@v4
with:
name: manytask-checker-${{ matrix.python-version }}.tar
path: /tmp/
- name: List tmp folder
run: |
ls -la /tmp/
- name: Load Docker Image
run: |
docker load --input /tmp/manytask-checker-${{ matrix.python-version }}.tar
- name: Check docker image operatable
run: |
# RUN: python -m /opt/checker --help
docker run \
--rm \
-v ${{ github.workspace }}:/workspace \
-w /workspace \
manytask/checker:${{ matrix.python-version }}-${{ github.sha }} \
--help
docs-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.12
cache: 'pip' # caching pip dependencies
- name: Install dependencies
run: |
python -m pip install -e .[docs]
- name: Build docs
run: |
make docs-build
docs-preview:
permissions:
deployments: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.12
cache: 'pip' # caching pip dependencies
- name: Install dependencies
run: |
python -m pip install -e .[docs]
- name: Docs preview
run: |
make docs-build
- name: Publish to Cloudflare Pages
id: deploy
uses: cloudflare/pages-action@v1
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
projectName: manytask-checker
directory: ./site
# Optional: Enable this if you want to have GitHub Deployments triggered
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
# Optional: Switch what branch you are publishing to.
# By default this will be the branch which triggered this workflow
branch: ${{ ( github.event.workflow_run.head_repository.full_name == github.repository && github.event.workflow_run.head_branch == 'main' && 'main' ) || ( github.event.workflow_run.head_sha ) }}