File tree Expand file tree Collapse file tree 3 files changed +61
-10
lines changed
Expand file tree Collapse file tree 3 files changed +61
-10
lines changed Original file line number Diff line number Diff 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 :
Original file line number Diff line number Diff line change 2020 name : nialov
2121 - name : Load image to docker
2222 run : nix run .#load-fractopo-image
23+ - name : Test run of loaded fractopo-app container
24+ run : docker run -d --name fractopo-test -p 2718:2718 fractopo-app:vsrjfhp7gd4pgxxzhdrmnr4xglwyln35
25+ - name : Wait for API to be ready
26+ run : |-
27+ for i in {1..60}; do
28+ if curl -s http://localhost:2718/; then
29+ echo "API is up!"
30+ exit 0
31+ fi
32+ sleep 1
33+ done
34+ echo "API did not start in time" >&2
35+ exit 1
36+ - name : Test API root endpoint
37+ run : curl -f http://localhost:2718/
2338 - env :
2439 PUSHER_TOKEN : ${{ secrets.GITHUB_TOKEN }}
2540 if : github.event_name == 'push'
Original file line number Diff line number Diff line change 157157 } ;
158158 } ;
159159
160+ dockerPort = builtins . toString 2718 ;
161+
160162 in
161163 baseNixSteps
162164 ++ [
165167 run = "nix run .#load-fractopo-image" ;
166168
167169 }
170+ {
171+ name = "Test run of loaded fractopo-app container" ;
172+ run =
173+ let
174+ inherit ( inputs . self . legacyPackages . x86_64-linux . fractopo-app-image-stream ) imageName imageTag ;
175+ in
176+ "docker run -d --name fractopo-test -p ${ dockerPort } :${ dockerPort } ${ imageName } :${ imageTag } " ;
177+ }
178+ {
179+ name = "Wait for API to be ready" ;
180+ run = ''
181+ for i in {1..60}; do
182+ if curl -s http://localhost:${ dockerPort } /; then
183+ echo "API is up!"
184+ exit 0
185+ fi
186+ sleep 1
187+ done
188+ echo "API did not start in time" >&2
189+ exit 1
190+ '' ;
191+ }
192+ {
193+ name = "Test API root endpoint" ;
194+ run = "curl -f http://localhost:${ dockerPort } /" ;
195+ }
168196 ( mkPushStep {
169197 rev = "$(git rev-parse --short HEAD)" ;
170198 name = "Push to ghcr.io from all branches" ;
200228 strategy = {
201229 fail-fast = false ;
202230 matrix = {
231+ # Test same Python versions as for poetry job
203232 inherit ( config . workflows . ".github/workflows/main.yaml" . jobs . poetry . strategy . matrix )
204233 python-version
205234 ;
228257 } ;
229258 }
230259 {
260+ name = "Test package import" ;
231261 run = ''
232- echo "Testing package import"
233262 python -c 'import fractopo'
234- echo "Testing module entrypoint"
263+ '' ;
264+ }
265+ {
266+ name = "Test module entrypoint" ;
267+ run = ''
235268 python -m fractopo --help
236- echo "Running unittests with pytest"
269+ '' ;
270+ }
271+ {
272+ name = "Run unittests with pytest" ;
273+ run = ''
237274 pytest -v
238275 '' ;
239276 }
You can’t perform that action at this time.
0 commit comments