Skip to content

Commit 6c6befa

Browse files
committed
WIP: test implementation with placeholder_workflow
1 parent 836ddcc commit 6c6befa

File tree

2 files changed

+212
-13
lines changed

2 files changed

+212
-13
lines changed

.github/workflows/cargo_build.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ jobs:
4343
matrix:
4444
command: ${{ fromJson(needs.prepare-parallel-pcc-matrix.outputs.matrix_command)}}
4545
fail-fast: false
46-
uses: ./.github/workflows/cargo_build_common.yml
46+
uses: ./.github/workflows/placeholder_workflow.yml
4747
with:
4848
run-pcc-cpu-batch: ${{ matrix.command }}
4949
secrets:
@@ -58,7 +58,7 @@ jobs:
5858

5959
pcc-hpu:
6060
name: cargo_build/pcc-hpu
61-
uses: ./.github/workflows/cargo_build_common.yml
61+
uses: ./.github/workflows/placeholder_workflow.yml
6262
with:
6363
run-pcc-hpu: true
6464
secrets:
@@ -73,7 +73,7 @@ jobs:
7373

7474
build-tfhe-full:
7575
name: cargo_build/build-tfhe-full
76-
uses: ./.github/workflows/cargo_build_common.yml
76+
uses: ./.github/workflows/placeholder_workflow.yml
7777
with:
7878
run-build-tfhe-full: true
7979
# GitHub macos-latest are now M1 macs, so use ours, we limit what runs so it will be fast
@@ -91,7 +91,7 @@ jobs:
9191

9292
build:
9393
name: cargo_build/build
94-
uses: ./.github/workflows/cargo_build_common.yml
94+
uses: ./.github/workflows/placeholder_workflow.yml
9595
with:
9696
run-build: true
9797
secrets:
@@ -106,7 +106,7 @@ jobs:
106106

107107
build-layers:
108108
name: cargo_build/build-layers
109-
uses: ./.github/workflows/cargo_build_common.yml
109+
uses: ./.github/workflows/placeholder_workflow.yml
110110
with:
111111
run-build-layers: true
112112
secrets:
@@ -121,7 +121,7 @@ jobs:
121121

122122
build-c-api:
123123
name: cargo_build/build-c-api
124-
uses: ./.github/workflows/cargo_build_common.yml
124+
uses: ./.github/workflows/placeholder_workflow.yml
125125
with:
126126
run-build-c-api: true
127127
secrets:
Lines changed: 206 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,215 @@
1-
# Placeholder workflow file allowing running it without having to merge to main first
21
name: placeholder_workflow
32

43
on:
5-
workflow_dispatch:
4+
workflow_call:
5+
inputs:
6+
run-pcc-cpu-batch:
7+
type: string
8+
run-pcc-hpu:
9+
type: boolean
10+
default: false
11+
run-build:
12+
type: boolean
13+
default: false
14+
run-build-layers:
15+
type: boolean
16+
default: false
17+
run-build-c-api:
18+
type: boolean
19+
default: false
20+
run-build-tfhe-full:
21+
type: boolean
22+
default: false
23+
runners-to-use: # Additional runners to run builds command against
24+
type: string # Use comma separated values to generate an array
25+
default: ""
26+
secrets:
27+
REPO_CHECKOUT_TOKEN:
28+
required: true
29+
SLAB_ACTION_TOKEN:
30+
required: true
31+
SLAB_BASE_URL:
32+
required: true
33+
SLAB_URL:
34+
required: true
35+
JOB_SECRET:
36+
required: true
37+
SLACK_CHANNEL:
38+
required: true
39+
BOT_USERNAME:
40+
required: true
41+
SLACK_WEBHOOK:
42+
required: true
643

7-
permissions: {}
44+
env:
45+
CARGO_TERM_COLOR: always
46+
RUSTFLAGS: "-C target-cpu=native"
47+
RUST_BACKTRACE: "full"
48+
RUST_MIN_STACK: "8388608"
49+
CHECKOUT_TOKEN: ${{ secrets.REPO_CHECKOUT_TOKEN || secrets.GITHUB_TOKEN }}
50+
# Secrets will be available only to zama-ai organization members
51+
SECRETS_AVAILABLE: ${{ secrets.JOB_SECRET != '' }}
52+
EXTERNAL_CONTRIBUTION_RUNNER: "large_ubuntu_16"
53+
54+
permissions:
55+
contents: read
856

957
jobs:
10-
placeholder:
11-
name: placeholder_workflow/placeholder
58+
setup-instance:
59+
name: cargo_build_common/setup-instance
1260
runs-on: ubuntu-latest
61+
outputs:
62+
runner-name: ${{ steps.start-remote-instance.outputs.label || steps.start-github-instance.outputs.runner_group }}
63+
steps:
64+
- name: Start remote instance
65+
id: start-remote-instance
66+
if: env.SECRETS_AVAILABLE == 'true'
67+
uses: zama-ai/slab-github-runner@79939325c3c429837c10d6041e4fd8589d328bac
68+
with:
69+
mode: start
70+
github-token: ${{ secrets.SLAB_ACTION_TOKEN }}
71+
slab-url: ${{ secrets.SLAB_BASE_URL }}
72+
job-secret: ${{ secrets.JOB_SECRET }}
73+
backend: aws
74+
profile: cpu-build
75+
76+
# This instance will be spawned especially for pull-request from forked repository
77+
- name: Start GitHub instance
78+
id: start-github-instance
79+
if: env.SECRETS_AVAILABLE == 'false'
80+
run: |
81+
echo "runner_group=${EXTERNAL_CONTRIBUTION_RUNNER}" >> "$GITHUB_OUTPUT"
82+
83+
prepare-matrix:
84+
name: cargo_build_common/prepare-matrix
85+
runs-on: ubuntu-latest
86+
needs: setup-instance
87+
outputs:
88+
runners: ${{ steps.set_matrix_runners.outputs.runners }}
89+
steps:
90+
- name: Parse runners
91+
shell: python
92+
run: | # zizmor: ignore[template-injection] these env variables are safe
93+
runners = ["${{ needs.setup-instance.outputs.runner-name }}", ]
94+
if "${{ inputs.runners-to-use }}":
95+
split_runners = "${{ inputs.runners-to-use }}".replace(" ", "").split(",")
96+
runners.extend(split_runners)
97+
98+
with open("${{ github.env }}", "a") as f:
99+
f.write(f"""RUNNERS=["{'", "'.join(runners)}"]\n""")
100+
101+
- name: Set martix runners outputs
102+
id: set_matrix_runners
103+
run: | # zizmor: ignore[template-injection] these env variable are safe
104+
echo "runners=${{ toJSON(env.RUNNERS) }}" >> "${GITHUB_OUTPUT}"
13105
106+
builds:
107+
name: cargo_build_common/builds
108+
needs: [ setup-instance, prepare-matrix ]
109+
runs-on: ${{ matrix.runner }}
110+
strategy:
111+
matrix:
112+
runner: ${{ fromJSON(needs.prepare-matrix.outputs.runners) }}
113+
fail-fast: false
14114
steps:
15-
- run: |
16-
echo "Hello this is a Placeholder Workflow"
115+
- name: Checkout tfhe-rs repo
116+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
117+
with:
118+
persist-credentials: 'false'
119+
token: ${{ env.CHECKOUT_TOKEN }}
120+
121+
- name: Install latest stable
122+
uses: dtolnay/rust-toolchain@e97e2d8cc328f1b50210efc529dca0028893a2d9 # zizmor: ignore[stale-action-refs] this action doesn't create releases
123+
with:
124+
toolchain: stable
125+
126+
- name: Run pcc checks batch
127+
if: inputs.run-pcc-cpu-batch
128+
run: |
129+
make "${COMMAND}"
130+
env:
131+
COMMAND: ${{ inputs.run-pcc-cpu-batch }}
132+
133+
- name: Run Hpu pcc checks
134+
if: inputs.run-pcc-hpu
135+
run: |
136+
make pcc_hpu
137+
138+
- name: Build Release tfhe full
139+
if: inputs.run-build-tfhe-full
140+
run: |
141+
make build_tfhe_full
142+
143+
- name: Run newline linter checks
144+
if: inputs.run-build
145+
run: |
146+
make check_newline
147+
148+
- name: Build tfhe-csprng
149+
if: inputs.run-build
150+
run: |
151+
make build_tfhe_csprng
152+
153+
- name: Build with MSRV
154+
if: inputs.run-build
155+
run: |
156+
make build_tfhe_msrv
157+
158+
- name: Build coverage tests
159+
if: inputs.run-build
160+
run: |
161+
make build_tfhe_coverage
162+
163+
- name: Build Release core
164+
if: inputs.run-build-layers
165+
run: |
166+
make build_core AVX512_SUPPORT=ON
167+
make build_core_experimental AVX512_SUPPORT=ON
168+
169+
- name: Build Release boolean
170+
if: inputs.run-build-layers
171+
run: |
172+
make build_boolean
173+
174+
- name: Build Release shortint
175+
if: inputs.run-build-layers
176+
run: |
177+
make build_shortint
178+
179+
- name: Build Release integer
180+
if: inputs.run-build-layers
181+
run: |
182+
make build_integer
183+
184+
- name: Build Release c_api
185+
if: inputs.run-build-c-api
186+
run: |
187+
make build_c_api
188+
189+
# The wasm build check is a bit annoying to set-up here and is done during the tests in
190+
# aws_tfhe_tests.yml
191+
192+
teardown-instance:
193+
name: cargo_build_common/teardown-instance
194+
if: ${{ always() && needs.setup-instance.result == 'success' }}
195+
needs: [setup-instance, builds]
196+
runs-on: ubuntu-latest
197+
steps:
198+
- name: Stop remote instance
199+
id: stop-instance
200+
if: env.SECRETS_AVAILABLE == 'true'
201+
uses: zama-ai/slab-github-runner@79939325c3c429837c10d6041e4fd8589d328bac
202+
with:
203+
mode: stop
204+
github-token: ${{ secrets.SLAB_ACTION_TOKEN }}
205+
slab-url: ${{ secrets.SLAB_BASE_URL }}
206+
job-secret: ${{ secrets.JOB_SECRET }}
207+
label: ${{ needs.setup-instance.outputs.runner-name }}
208+
209+
- name: Slack Notification
210+
if: ${{ failure() }}
211+
continue-on-error: true
212+
uses: rtCamp/action-slack-notify@e31e87e03dd19038e411e38ae27cbad084a90661
213+
env:
214+
SLACK_COLOR: ${{ job.status }}
215+
SLACK_MESSAGE: "Instance teardown (cargo-builds) finished with status: ${{ job.status }}. (${{ env.ACTION_RUN_URL }})"

0 commit comments

Comments
 (0)