-
Notifications
You must be signed in to change notification settings - Fork 0
86 lines (79 loc) · 2.54 KB
/
Copy pathdocker.yml
File metadata and controls
86 lines (79 loc) · 2.54 KB
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
# PyQuantLib: Python bindings for QuantLib
# Copyright (c) 2025 Yassine Idyiahia
#
# QuantLib is Copyright (c) 2000-2025 The QuantLib Authors
# QuantLib is free software under a modified BSD license.
# See http://quantlib.org/ for more information.
#
# Source: https://github.com/quantales/pyquantlib
# Licensed under the BSD 3-Clause License. See LICENSE file for details.
name: Docker image
on:
workflow_dispatch:
push:
branches: [main]
paths:
- "Dockerfile"
- ".dockerignore"
- "src/**"
- "include/**"
- "CMakeLists.txt"
- "pyproject.toml"
- ".github/workflows/docker.yml"
pull_request:
paths:
- "Dockerfile"
- ".dockerignore"
- "src/**"
- "include/**"
- "CMakeLists.txt"
- "pyproject.toml"
- ".github/workflows/docker.yml"
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build image
uses: docker/build-push-action@v6
with:
context: .
load: true
tags: pyquantlib:ci
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Smoke test
run: |
docker run --rm pyquantlib:ci python -c "
import pyquantlib as ql
print('PyQuantLib', ql.__version__)
# Exercises the Settings singleton: the canary for a correct static QuantLib build.
ql.Settings.evaluationDate = ql.Date(15, ql.January, 2025)
assert ql.Settings.evaluationDate == ql.Date(15, ql.January, 2025)
q = ql.SimpleQuote(100.0)
assert q.value() == 100.0
print('Smoke test passed')
"
- name: JupyterLab server test
run: |
# Launch the image with its real CMD and confirm the server serves /lab.
docker run -d --rm --name pql-jupyter -p 8888:8888 pyquantlib:ci
ready=0
for i in $(seq 1 30); do
code=$(curl -s -o /dev/null -w "%{http_code}" http://localhost:8888/lab || true)
if [ "$code" = "200" ]; then
echo "JupyterLab responded with HTTP 200 (attempt $i)"
ready=1
break
fi
echo "attempt $i: HTTP $code, waiting..."
sleep 2
done
if [ "$ready" -ne 1 ]; then
echo "JupyterLab did not become ready in time; container logs:"
docker logs pql-jupyter || true
fi
docker stop pql-jupyter
test "$ready" -eq 1