-
Notifications
You must be signed in to change notification settings - Fork 52
218 lines (184 loc) · 5.57 KB
/
tests.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
name: Tests
env:
DEFAULT_PYTHON_VERSION: "3.10"
on:
pull_request:
push:
branches:
- main
jobs:
test-conda-store-server:
name: "unit-test conda-store-server"
strategy:
matrix:
# cannot run on windows due to needing fake-chroot for conda-docker
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash -el {0}
working-directory: conda-store-server
steps:
- name: "Checkout Repository"
uses: actions/checkout@v4
- name: Set up Python (Linux)
if: matrix.os == 'ubuntu-latest'
uses: conda-incubator/setup-miniconda@v2
with:
mamba-version: "*"
activate-environment: conda-store-server-dev
environment-file: conda-store-server/environment-dev.yaml
auto-activate-base: false
- name: Set up Python (macOS)
if: matrix.os == 'macos-latest'
uses: conda-incubator/setup-miniconda@v2
with:
activate-environment: conda-store-server-dev
environment-file: conda-store-server/environment-macos-dev.yaml
auto-activate-base: false
- name: Linting Checks
run: |
hatch env run -e dev lint
- name: Release Check
run: |
hatch build
- name: Unit Tests
run: |
pytest tests
integration-test-conda-store-server:
name: "integration-test conda-store-server"
runs-on: ubuntu-latest
defaults:
run:
shell: bash -el {0}
working-directory: conda-store-server
steps:
- name: "Checkout Repository"
uses: actions/checkout@v4
- name: Set up Python
uses: conda-incubator/setup-miniconda@v2
with:
mamba-version: "*"
activate-environment: conda-store-server-dev
environment-file: conda-store-server/environment-dev.yaml
auto-activate-base: false
- name: Install Dependencies
run: |
pip install hatch
sudo apt install wait-for-it -y
- name: Deploy docker-compose
run: |
docker-compose up -d
docker ps
wait-for-it localhost:5432 # postgresql
wait-for-it localhost:9000 # minio
wait-for-it localhost:5000 # conda-store-server
- name: Run Playwright tests
run: |
playwright install
pytest --video on ../tests/test_playwright.py
- uses: actions/upload-artifact@v2
if: ${{ always() }}
with:
name: playwright-tests
path: conda-store-server/test-results
- name: Run integration tests
run: |
export PYTHONPATH=$PYTHONPATH:$PWD
pytest ../tests/test_api.py ../tests/test_metrics.py
- name: Docker logs
if: ${{ failure() }}
run: |
docker-compose logs
test-conda-store:
name: "integration-test conda-store"
runs-on: ubuntu-latest
defaults:
run:
working-directory: conda-store
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10"]
steps:
- name: "Checkout Repository"
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install Dependencies
run: |
pip install hatch
sudo apt install wait-for-it -y
- name: Linting Checks
run: |
hatch env run -e dev lint
- name: Release Check
run: |
hatch build
- name: Deploy docker-compose
run: |
docker-compose up -d
docker ps
wait-for-it localhost:5432 # postgresql
wait-for-it localhost:9000 # minio
wait-for-it localhost:5000 # conda-store-server
- name: Install conda-store for tests
run: |
pip install .
- name: Basic tests not authenticated
run: |
sleep 20
./tests/unauthenticated-tests.sh
- name: Basic tests authenticated
run: |
./tests/authenticated-tests.sh
- name: Test shebang
run: |
export CONDA_STORE_URL=http://localhost:5000/conda-store
export CONDA_STORE_AUTH=basic
export CONDA_STORE_USERNAME=username
export CONDA_STORE_PASSWORD=password
./tests/shebang.sh
- name: Docker logs
if: ${{ failure() }}
run: |
docker-compose logs
build-docker-image:
name: "Build docker images"
runs-on: ubuntu-latest
strategy:
matrix:
docker-image:
- conda-store
- conda-store-server
steps:
- name: "Checkout Repository"
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Lint Dockerfiles
uses: jbergstroem/hadolint-gh-action@v1
with:
dockerfile: ${{ matrix.docker-image }}/Dockerfile
output_format: tty
error_level: 0
- name: Docker Meta
id: meta
uses: crazy-max/ghaction-docker-meta@v5
with:
images: |
quansight/${{ matrix.docker-image }}
tags: |
type=sha
- name: Build docker
uses: docker/build-push-action@v5
with:
context: "${{ matrix.docker-image }}"
file: "${{ matrix.docker-image }}/Dockerfile"
tags: |
${{ steps.meta.outputs.tags }}
push: false
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max