-
Notifications
You must be signed in to change notification settings - Fork 147
212 lines (197 loc) · 7.8 KB
/
concrete_python_tests_linux.yml
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
name: concrete-python tests linux-cpu
on:
workflow_dispatch:
pull_request:
paths:
- .github/workflows/concrete_python_tests_linux.yml
- frontends/concrete-python/**
push:
branches:
- 'main'
- 'release/*'
env:
DOCKER_IMAGE_TEST: ghcr.io/zama-ai/concrete-compiler
ACTION_RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
SLACK_CHANNEL: ${{ secrets.SLACK_CHANNEL }}
SLACK_USERNAME: ${{ secrets.BOT_USERNAME }}
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
concurrency:
group: concrete_python_tests_linux_${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
jobs:
setup-instance:
runs-on: ubuntu-latest
outputs:
runner-name: ${{ steps.start-instance.outputs.label }}
steps:
- name: Start instance
id: start-instance
uses: zama-ai/slab-github-runner@447a2d0fd2d1a9d647aa0d0723a6e9255372f261
with:
mode: start
github-token: ${{ secrets.SLAB_ACTION_TOKEN }}
slab-url: ${{ secrets.SLAB_BASE_URL }}
job-secret: ${{ secrets.JOB_SECRET }}
backend: aws
profile: cpu-test
pre-commit-check:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Install platform dependencies
run: |
sudo apt install -y graphviz libgraphviz-dev
- name: Pre-commit Checks
run: |
cd frontends/concrete-python
make venv
source .venv/bin/activate
make pcc
build-python-bindings:
needs: setup-instance
runs-on: ${{ needs.setup-instance.outputs.runner-name }}
steps:
- name: Checkout concrete
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
submodules: recursive
fetch-depth: 0
- name: Create concrete build directory
run: mkdir build
- name: Build concrete-compiler python bindings
uses: addnab/docker-run-action@4f65fabd2431ebc8d299f8e5a018d79a769ae185 # v3
with:
registry: ghcr.io
image: ${{ env.DOCKER_IMAGE_TEST }}
username: ${{ secrets.GHCR_LOGIN }}
password: ${{ secrets.GHCR_PASSWORD }}
options: >-
-v ${{ github.workspace }}:/concrete
-v ${{ github.workspace }}/build:/build
shell: bash
run: |
set -e
rustup toolchain install nightly-2024-09-30
dnf -y install graphviz graphviz-devel
cd /concrete/frontends/concrete-python
make venv
source .venv/bin/activate
cd /concrete/compilers/concrete-compiler/compiler
make BUILD_DIR=/build DATAFLOW_EXECUTION_ENABLED=ON CCACHE=ON Python3_EXECUTABLE=$(which python3) python-bindings
echo "Debug: ccache statistics (after the build):"
ccache -s
- name: Create artifact archive
run: |
cd build
tar czvf artifacts.tgz lib/libConcretelangRuntime.so tools/concretelang/python_packages
- name: Upload concrete-compiler python-bindings
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
with:
name: concrete-compiler-python-bindings
include-hidden-files: true
retention-days: 3
path: build/artifacts.tgz
- name: Slack Notification
if: ${{ failure() && github.ref == 'refs/heads/main' }}
continue-on-error: true
uses: rtCamp/action-slack-notify@4e5fb42d249be6a45a298f3c9543b111b02f7907
env:
SLACK_COLOR: ${{ job.status }}
SLACK_MESSAGE: "build-python-bindings finished with status: ${{ job.status }}. (${{ env.ACTION_RUN_URL }})"
test-pytest:
needs: [setup-instance, build-python-bindings]
runs-on: ${{ needs.setup-instance.outputs.runner-name }}
steps:
- name: Download concrete-compiler python-bindings
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: concrete-compiler-python-bindings
path: compiler-artifacts
- name: Extract artifacts archive
run: |
cd compiler-artifacts
tar xzvf artifacts.tgz
- name: Run pytest
uses: addnab/docker-run-action@4f65fabd2431ebc8d299f8e5a018d79a769ae185 # v3
with:
registry: ghcr.io
image: ${{ env.DOCKER_IMAGE_TEST }}
username: ${{ secrets.GHCR_LOGIN }}
password: ${{ secrets.GHCR_PASSWORD }}
options: >-
-v ${{ github.workspace }}:/concrete
-v ${{ github.workspace }}/compiler-artifacts:/compiler-artifacts
shell: bash
run: |
set -e
export COMPILER_BUILD_DIRECTORY=/compiler-artifacts
cd /concrete/frontends/concrete-python
source .venv/bin/activate
export KEY_CACHE_DIRECTORY=./key-set-cache
mkdir $KEY_CACHE_DIRECTORY
make pytest
- name: Slack Notification
if: ${{ failure() && github.ref == 'refs/heads/main' }}
continue-on-error: true
uses: rtCamp/action-slack-notify@4e5fb42d249be6a45a298f3c9543b111b02f7907
env:
SLACK_COLOR: ${{ job.status }}
SLACK_MESSAGE: "test-pytest finished with status: ${{ job.status }}. (${{ env.ACTION_RUN_URL }})"
test-notebooks:
needs: [setup-instance, build-python-bindings]
runs-on: ${{ needs.setup-instance.outputs.runner-name }}
steps:
- name: Download concrete-compiler python-bindings
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: concrete-compiler-python-bindings
path: compiler-artifacts
- name: Extract artifacts archive
run: |
cd compiler-artifacts
tar xzvf artifacts.tgz
- name: Run pytest
uses: addnab/docker-run-action@4f65fabd2431ebc8d299f8e5a018d79a769ae185 # v3
with:
registry: ghcr.io
image: ${{ env.DOCKER_IMAGE_TEST }}
username: ${{ secrets.GHCR_LOGIN }}
password: ${{ secrets.GHCR_PASSWORD }}
options: >-
-v ${{ github.workspace }}:/concrete
-v ${{ github.workspace }}/compiler-artifacts:/compiler-artifacts
shell: bash
run: |
set -e
export COMPILER_BUILD_DIRECTORY=/compiler-artifacts
cd /concrete/frontends/concrete-python
source .venv/bin/activate
make test-notebooks
- name: Slack Notification
if: ${{ failure() && github.ref == 'refs/heads/main' }}
continue-on-error: true
uses: rtCamp/action-slack-notify@4e5fb42d249be6a45a298f3c9543b111b02f7907
env:
SLACK_COLOR: ${{ job.status }}
SLACK_MESSAGE: "test-notebooks finished with status: ${{ job.status }}. (${{ env.ACTION_RUN_URL }})"
teardown-instance:
if: ${{ always() && needs.setup-instance.result != 'skipped' }}
needs: [ setup-instance, test-pytest, test-notebooks ]
runs-on: ubuntu-latest
steps:
- name: Stop instance
id: stop-instance
uses: zama-ai/slab-github-runner@c0e7168795bd78f61f61146951ed9d0c73c9b701
with:
mode: stop
github-token: ${{ secrets.SLAB_ACTION_TOKEN }}
slab-url: ${{ secrets.SLAB_BASE_URL }}
job-secret: ${{ secrets.JOB_SECRET }}
label: ${{ needs.setup-instance.outputs.runner-name }}
- name: Slack Notification
if: ${{ failure() }}
continue-on-error: true
uses: rtCamp/action-slack-notify@4e5fb42d249be6a45a298f3c9543b111b02f7907
env:
SLACK_COLOR: ${{ job.status }}
SLACK_MESSAGE: "Instance teardown finished with status: ${{ job.status }}. (${{ env.ACTION_RUN_URL }})"