Skip to content

Commit d3ef7ac

Browse files
committed
ci: refine workflows
1 parent 2cf6736 commit d3ef7ac

File tree

3 files changed

+30
-19
lines changed

3 files changed

+30
-19
lines changed

.github/workflows/conda.yaml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,12 @@ jobs:
2020
init-shell: bash powershell
2121
micromamba-version: 1.5.6-0
2222
post-cleanup: all
23-
- run: |-
24-
echo "Testing package import"
25-
python -c 'import fractopo'
26-
echo "Testing module entrypoint"
27-
python -m fractopo --help
28-
echo "Running unittests with pytest"
29-
pytest -v
23+
- name: Test package import
24+
run: python -c 'import fractopo'
25+
- name: Test module entrypoint
26+
run: python -m fractopo --help
27+
- name: Run unittests with pytest
28+
run: pytest -v
3029
strategy:
3130
fail-fast: false
3231
matrix:

.github/workflows/main.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
# Or commit to trigger the pre-commit hook if enabled.
66
jobs:
77
docker:
8+
needs:
9+
- nix-fast-build
810
permissions:
911
contents: read
1012
packages: write
@@ -18,11 +20,11 @@ jobs:
1820
name: nialov
1921
- name: Load image to docker
2022
run: nix run .#load-fractopo-image
21-
- name: Run fractopo-app container
23+
- name: Test run of loaded fractopo-app container
2224
run: docker run -d --name fractopo-test -p 2718:2718 fractopo-app:vsrjfhp7gd4pgxxzhdrmnr4xglwyln35
2325
- name: Wait for API to be ready
2426
run: |-
25-
for i in {1..30}; do
27+
for i in {1..60}; do
2628
if curl -s http://localhost:2718/; then
2729
echo "API is up!"
2830
exit 0

nix/ci.nix

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,7 @@ in
133133
];
134134
};
135135
docker = lib.recursiveUpdate publishPackages {
136-
# TODO: For debugging
137-
# needs = [ "nix-fast-build" ];
136+
needs = [ "nix-fast-build" ];
138137
steps =
139138
let
140139

@@ -158,6 +157,8 @@ in
158157
};
159158
};
160159

160+
dockerPort = builtins.toString 2718;
161+
161162
in
162163
baseNixSteps
163164
++ [
@@ -167,18 +168,18 @@ in
167168

168169
}
169170
{
170-
name = "Run fractopo-app container";
171+
name = "Test run of loaded fractopo-app container";
171172
run =
172173
let
173174
inherit (inputs.self.legacyPackages.x86_64-linux.fractopo-app-image-stream) imageName imageTag;
174175
in
175-
"docker run -d --name fractopo-test -p 2718:2718 ${imageName}:${imageTag}";
176+
"docker run -d --name fractopo-test -p ${dockerPort}:${dockerPort} ${imageName}:${imageTag}";
176177
}
177178
{
178179
name = "Wait for API to be ready";
179180
run = ''
180-
for i in {1..30}; do
181-
if curl -s http://localhost:2718/; then
181+
for i in {1..60}; do
182+
if curl -s http://localhost:${dockerPort}/; then
182183
echo "API is up!"
183184
exit 0
184185
fi
@@ -190,7 +191,7 @@ in
190191
}
191192
{
192193
name = "Test API root endpoint";
193-
run = "curl -f http://localhost:2718/";
194+
run = "curl -f http://localhost:${dockerPort}/";
194195
}
195196
(mkPushStep {
196197
rev = "$(git rev-parse --short HEAD)";
@@ -227,6 +228,7 @@ in
227228
strategy = {
228229
fail-fast = false;
229230
matrix = {
231+
# Test same Python versions as for poetry job
230232
inherit (config.workflows.".github/workflows/main.yaml".jobs.poetry.strategy.matrix)
231233
python-version
232234
;
@@ -255,12 +257,20 @@ in
255257
};
256258
}
257259
{
260+
name = "Test package import";
258261
run = ''
259-
echo "Testing package import"
260262
python -c 'import fractopo'
261-
echo "Testing module entrypoint"
263+
'';
264+
}
265+
{
266+
name = "Test module entrypoint";
267+
run = ''
262268
python -m fractopo --help
263-
echo "Running unittests with pytest"
269+
'';
270+
}
271+
{
272+
name = "Run unittests with pytest";
273+
run = ''
264274
pytest -v
265275
'';
266276
}

0 commit comments

Comments
 (0)