-
Notifications
You must be signed in to change notification settings - Fork 60
220 lines (211 loc) · 6.7 KB
/
test.yaml
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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
name: CI Validations
on:
push
jobs:
test-python:
runs-on: ubuntu-latest
strategy:
matrix:
# 3.9: minimum version supported
# 3.12 maximum version that supports all dependencies required for examples
# 3.13: maximum version supported
py-version: ["3.9", "3.12", "3.13"]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Py-prep
run: make py-prep PY_VERSION=${{ matrix.py-version }}
- name: Check Format
run: uvx ruff format --check
- name: Lint
run: uvx ruff check --fix sematic
- name: MyPy
# Use 3.12 for type checking because 3.13 doesn't have all
# example libraries.
if: matrix.py-version == '3.12'
run: uv run mypy -p sematic --disable-error-code import-untyped
- name: Test
run: |
source .venv/bin/activate
python3 -c "import sys; print(sys.version)"
pytest
- name: Check Schemas
if: matrix.py-version == '3.13'
run: git checkout . && make migrate_up_sqlite && make update-schema && git diff --exit-code
- name: Wheel
if: matrix.py-version == '3.13'
run: |
make ui
make uv-wheel
- uses: actions/upload-artifact@v4
if: matrix.py-version == '3.13'
with:
name: sematic-wheel
path: "./dist/sematic-*.whl"
retention-days: 10
- uses: actions/upload-artifact@v4
if: matrix.py-version == '3.13'
with:
name: sematic-wheel-test
path: "sematic/tests/integration/test_pip_install.sh"
retention-days: 1
test-install:
needs: test-python
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
with:
name: sematic-wheel
path: "./dist"
- uses: actions/download-artifact@v4
with:
name: sematic-wheel-test
path: "./"
- name: Test and Install Wheel
run: "bash test_pip_install.sh"
nodejs_init:
runs-on: ubuntu-latest
container:
image: cypress/browsers:22.12.0
options: --user 0
outputs:
projectFolder: ${{ steps.envvar.outputs.PROJECT_FOLDER }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: npm install
run: npm install
working-directory: ./sematic/ui
- name: write env vars
id: envvar
run: |
echo "PROJECT_FOLDER=$(pwd)" >> $GITHUB_ENV
echo "PROJECT_FOLDER=$(pwd)" >> "$GITHUB_OUTPUT"
echo "TEMP_DIR=$(mktemp -d)" >> $GITHUB_ENV
- name: Tar files
# This step is for perserving the file permissions (rwx)
run: |
tar -czf $TEMP_DIR/cypress.tar.gz $CYPRESS_CACHE_FOLDER
tar -czf $TEMP_DIR/code.tar.gz $PROJECT_FOLDER
- name: Persist
uses: actions/upload-artifact@v4
with:
name: nodejs-cache
path: |
${{ env.TEMP_DIR }}
nodejs-lint:
needs: [nodejs_init]
runs-on: ubuntu-latest
container:
image: cypress/browsers:22.12.0
options: --user 0
steps:
- name: write env vars
run: echo "TEMP_DIR=$(mktemp -d)" >> $GITHUB_ENV
- uses: actions/download-artifact@v4
with:
name: nodejs-cache
path: ${{ env.TEMP_DIR }}
- name: Extract
run: |
mkdir -p $CYPRESS_CACHE_FOLDER
PROJECT_FOLDER=${{ needs.nodejs_init.outputs.projectFolder }}
mkdir -p $PROJECT_FOLDER
tar -xzf $TEMP_DIR/cypress.tar.gz -C /
tar -xzf $TEMP_DIR/code.tar.gz -C /
- name: lint
run: npm run lint
working-directory: sematic/ui
nodejs-unit-test:
needs: [nodejs_init]
runs-on: ubuntu-latest
container:
image: cypress/browsers:22.12.0
options: --user 0
steps:
- name: write env vars
run: echo "TEMP_DIR=$(mktemp -d)" >> $GITHUB_ENV
- uses: actions/download-artifact@v4
with:
name: nodejs-cache
path: ${{ env.TEMP_DIR }}
- name: Extract
run: |
mkdir -p $CYPRESS_CACHE_FOLDER
PROJECT_FOLDER=${{ needs.nodejs_init.outputs.projectFolder }}
mkdir -p $PROJECT_FOLDER
tar -xzf $TEMP_DIR/cypress.tar.gz -C /
tar -xzf $TEMP_DIR/code.tar.gz -C /
- name: cypress:component
run: npm run cypress:component
working-directory: sematic/ui
- name: Upload cypress video
uses: actions/upload-artifact@v4
with:
name: cypress_video
path: |
sematic/ui/tests/cypress_video
- name: Upload cypress screenshots
uses: actions/upload-artifact@v4
with:
name: cypress_screenshots
path: |
sematic/ui/tests/cypress_screenshots
- name: Upload cypress test results
uses: actions/upload-artifact@v4
with:
name: cypress_results
path: |
sematic/ui/tests/cypress_results
nodejs-integration-test:
needs: [nodejs_init]
runs-on: ubuntu-latest
container:
image: cypress/browsers:22.12.0
options: --user 0
steps:
- name: write env vars
run: echo "TEMP_DIR=$(mktemp -d)" >> $GITHUB_ENV
- uses: actions/download-artifact@v4
with:
name: nodejs-cache
path: ${{ env.TEMP_DIR }}
- name: Extract
run: |
mkdir -p $CYPRESS_CACHE_FOLDER
PROJECT_FOLDER=${{ needs.nodejs_init.outputs.projectFolder }}
mkdir -p $PROJECT_FOLDER
tar -xzf $TEMP_DIR/cypress.tar.gz -C /
tar -xzf $TEMP_DIR/code.tar.gz -C /
- name: build-essential
run: apt update && apt-get install -y build-essential curl wget libmagic1
- name: install uv
run: wget -qO- https://astral.sh/uv/install.sh | sh
- name: Py-prep
run: make py-prep
- name: build ui
run: npm run build
working-directory: sematic/ui
- name: start sematic run
run: . .venv/bin/activate && sematic start && sematic run examples/add
- name: cypress:e2e
run: npm run cypress:e2e
working-directory: sematic/ui
- name: Upload cypress video
uses: actions/upload-artifact@v4
with:
name: cypress_video
path: |
sematic/ui/tests/cypress_video
- name: Upload cypress screenshots
uses: actions/upload-artifact@v4
with:
name: cypress_screenshots
path: |
sematic/ui/tests/cypress_screenshots
- name: Upload cypress test results
uses: actions/upload-artifact@v4
with:
name: cypress_results
path: |
sematic/ui/tests/cypress_results