-
Notifications
You must be signed in to change notification settings - Fork 2
48 lines (40 loc) · 1.81 KB
/
Copy pathpython-runner.yml
File metadata and controls
48 lines (40 loc) · 1.81 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
name: Python Runner
on:
pull_request:
paths:
- "execution/python/**"
- "src/BBT.Workflow.Execution/Python/**"
- "src/BBT.Workflow.Execution/Invokers/PythonTaskInvoker.cs"
- ".github/workflows/python-runner.yml"
push:
branches: [master]
paths:
- "execution/python/**"
- "src/BBT.Workflow.Execution/Python/**"
- "src/BBT.Workflow.Execution/Invokers/PythonTaskInvoker.cs"
permissions:
contents: read
jobs:
contract-and-image:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: pip
cache-dependency-path: execution/python/requirements.lock
- name: Install locked Python dependencies
run: "python -m pip install --only-binary=:all: --require-hashes -r execution/python/requirements.lock"
- name: Run runner contract tests
run: python -m unittest discover -s execution/python/tests -v
- name: Build Python runner image
run: docker build -f execution/python/Dockerfile -t vnext-python-runner:test .
- name: Smoke test isolated runner image
run: |
printf '%s' '{"script":"def main(input): return {\"value\": input[\"value\"] * 2}","location":"ci.py","input":{"value":21},"allowedModules":["*"],"maxOutputBytes":2097152,"maxStdoutBytes":32768,"maxStderrBytes":32768}' \
| docker run --rm -i --network none --read-only --memory 2g --cpus 1 --pids-limit 128 \
--tmpfs /tmp:rw,noexec,nosuid,nodev,size=64m \
--cap-drop ALL --security-opt no-new-privileges:true vnext-python-runner:test \
| tee /tmp/python-runner-response.json
jq -e '.success == true and (.outputJson | fromjson | .value) == 42' /tmp/python-runner-response.json