Skip to content

Commit c3f6666

Browse files
committed
deploy_label
1 parent 7b482e8 commit c3f6666

3 files changed

Lines changed: 82 additions & 73 deletions

File tree

.github/workflows/ci.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,3 +270,11 @@ jobs:
270270
exit 1
271271
fi
272272
echo "All required jobs passed!"
273+
274+
# Trigger Deploy Devel for PRs with the deploy label
275+
deploy_devel:
276+
name: Deploy Devel
277+
needs: [ci-success]
278+
if: ${{ github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'deploy') }}
279+
uses: ./.github/workflows/deploy-devel.yml
280+
secrets: inherit

.github/workflows/deploy-devel.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ on:
55
workflows: ["CI"]
66
branches: [devel]
77
types: [completed]
8+
workflow_call:
89

910
concurrency:
1011
group: deploy-devel
@@ -23,7 +24,7 @@ jobs:
2324
deploy_api_fly_dev:
2425
name: Deploy API to Fly.io Dev
2526
runs-on: ubuntu-22.04
26-
if: ${{ github.event.workflow_run.conclusion == 'success' }}
27+
if: ${{ github.event.workflow_run.conclusion == 'success' || github.event_name == 'workflow_call' }}
2728
env:
2829
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
2930
steps:
@@ -33,7 +34,7 @@ jobs:
3334
with:
3435
name: ${{ env.API_DOCKER_IMAGE }}.tar.gz
3536
run-id: ${{ github.event.workflow_run.id }}
36-
github-token: ${{ secrets.GITHUB_TOKEN }}
37+
github-token: ${{ github.event.workflow_run.id && secrets.GITHUB_TOKEN || '' }}
3738
- name: Load & Tag Local Image
3839
run: |
3940
docker load < ${{ env.API_DOCKER_IMAGE }}.tar.gz
@@ -54,7 +55,7 @@ jobs:
5455
deploy_api_fly_test:
5556
name: Deploy API to Fly.io Test
5657
runs-on: ubuntu-22.04
57-
if: ${{ github.event.workflow_run.conclusion == 'success' }}
58+
if: ${{ github.event.workflow_run.conclusion == 'success' || github.event_name == 'workflow_call' }}
5859
env:
5960
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
6061
steps:
@@ -64,7 +65,7 @@ jobs:
6465
with:
6566
name: ${{ env.API_DOCKER_IMAGE }}.tar.gz
6667
run-id: ${{ github.event.workflow_run.id }}
67-
github-token: ${{ secrets.GITHUB_TOKEN }}
68+
github-token: ${{ github.event.workflow_run.id && secrets.GITHUB_TOKEN || '' }}
6869
- name: Load & Tag Litestream Image
6970
run: |
7071
docker load < ${{ env.API_DOCKER_IMAGE }}.tar.gz
@@ -92,7 +93,7 @@ jobs:
9293
with:
9394
name: ${{ env.WASM_BENCHER_VALID }}
9495
run-id: ${{ github.event.workflow_run.id }}
95-
github-token: ${{ secrets.GITHUB_TOKEN }}
96+
github-token: ${{ github.event.workflow_run.id && secrets.GITHUB_TOKEN || '' }}
9697
path: ./lib/bencher_valid/pkg
9798
- name: Build Console UI
9899
working-directory: ./services/console
Lines changed: 68 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -1,73 +1,73 @@
11
name: Track Fork PR Benchmarks
22

33
on:
4-
workflow_run:
5-
workflows: [CI]
6-
types: [completed]
4+
workflow_run:
5+
workflows: [CI]
6+
types: [completed]
77

88
jobs:
9-
track_fork_pr_benchmarks:
10-
name: Track Fork PR Benchmarks with Bencher
11-
if: github.event.workflow_run.conclusion == 'success'
12-
permissions:
13-
pull-requests: write
14-
runs-on: ubuntu-22.04
15-
env:
16-
BENCHMARK_RESULTS: benchmark_results.txt
17-
PR_EVENT: event.json
18-
steps:
19-
- name: Download Benchmark Results
20-
id: download_results
21-
uses: dawidd6/action-download-artifact@v6
22-
continue-on-error: true
23-
with:
24-
name: ${{ env.BENCHMARK_RESULTS }}
25-
run_id: ${{ github.event.workflow_run.id }}
26-
- name: Download PR Event
27-
id: download_event
28-
uses: dawidd6/action-download-artifact@v6
29-
continue-on-error: true
30-
with:
31-
name: ${{ env.PR_EVENT }}
32-
run_id: ${{ github.event.workflow_run.id }}
33-
- name: Check if Fork PR Benchmarks
34-
id: check_fork
35-
run: |
36-
if [[ "${{ steps.download_results.outcome }}" == "success" && "${{ steps.download_event.outcome }}" == "success" ]]; then
37-
echo "is_fork_pr=true" >> "$GITHUB_OUTPUT"
38-
else
39-
echo "is_fork_pr=false" >> "$GITHUB_OUTPUT"
40-
fi
41-
- name: Export PR Event Data
42-
if: steps.check_fork.outputs.is_fork_pr == 'true'
43-
uses: actions/github-script@v6
44-
with:
45-
script: |
46-
let fs = require('fs');
47-
let prEvent = JSON.parse(fs.readFileSync(process.env.PR_EVENT, {encoding: 'utf8'}));
48-
core.exportVariable("PR_HEAD", prEvent.pull_request.head.ref);
49-
core.exportVariable("PR_HEAD_SHA", prEvent.pull_request.head.sha);
50-
core.exportVariable("PR_BASE", prEvent.pull_request.base.ref);
51-
core.exportVariable("PR_BASE_SHA", prEvent.pull_request.base.sha);
52-
core.exportVariable("PR_NUMBER", prEvent.number);
53-
- uses: bencherdev/bencher@main
54-
if: steps.check_fork.outputs.is_fork_pr == 'true'
55-
- name: Track Benchmarks with Bencher
56-
if: steps.check_fork.outputs.is_fork_pr == 'true'
57-
run: |
58-
bencher run \
59-
--host https://api.bencher.dev \
60-
--project bencher \
61-
--token '${{ secrets.BENCHER_API_TOKEN }}' \
62-
--branch "$PR_HEAD" \
63-
--hash "$PR_HEAD_SHA" \
64-
--start-point "$PR_BASE" \
65-
--start-point-hash "$PR_BASE_SHA" \
66-
--start-point-clone-thresholds \
67-
--start-point-reset \
68-
--testbed ubuntu-22.04 \
69-
--adapter rust_criterion \
70-
--err \
71-
--github-actions '${{ secrets.GITHUB_TOKEN }}' \
72-
--ci-number "$PR_NUMBER" \
73-
--file ./benchmark_results.txt
9+
track_fork_pr_benchmarks:
10+
name: Track Fork PR Benchmarks with Bencher
11+
if: ${{ github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.head_branch != 'main' }}
12+
permissions:
13+
pull-requests: write
14+
runs-on: ubuntu-22.04
15+
env:
16+
BENCHMARK_RESULTS: benchmark_results.txt
17+
PR_EVENT: event.json
18+
steps:
19+
- name: Download Benchmark Results
20+
id: download_results
21+
uses: dawidd6/action-download-artifact@v6
22+
continue-on-error: true
23+
with:
24+
name: ${{ env.BENCHMARK_RESULTS }}
25+
run_id: ${{ github.event.workflow_run.id }}
26+
- name: Download PR Event
27+
id: download_event
28+
uses: dawidd6/action-download-artifact@v6
29+
continue-on-error: true
30+
with:
31+
name: ${{ env.PR_EVENT }}
32+
run_id: ${{ github.event.workflow_run.id }}
33+
- name: Check if Fork PR Benchmarks
34+
id: check_fork
35+
run: |
36+
if [[ "${{ steps.download_results.outcome }}" == "success" && "${{ steps.download_event.outcome }}" == "success" ]]; then
37+
echo "is_fork_pr=true" >> "$GITHUB_OUTPUT"
38+
else
39+
echo "is_fork_pr=false" >> "$GITHUB_OUTPUT"
40+
fi
41+
- name: Export PR Event Data
42+
if: steps.check_fork.outputs.is_fork_pr == 'true'
43+
uses: actions/github-script@v6
44+
with:
45+
script: |
46+
let fs = require('fs');
47+
let prEvent = JSON.parse(fs.readFileSync(process.env.PR_EVENT, {encoding: 'utf8'}));
48+
core.exportVariable("PR_HEAD", prEvent.pull_request.head.ref);
49+
core.exportVariable("PR_HEAD_SHA", prEvent.pull_request.head.sha);
50+
core.exportVariable("PR_BASE", prEvent.pull_request.base.ref);
51+
core.exportVariable("PR_BASE_SHA", prEvent.pull_request.base.sha);
52+
core.exportVariable("PR_NUMBER", prEvent.number);
53+
- uses: bencherdev/bencher@main
54+
if: steps.check_fork.outputs.is_fork_pr == 'true'
55+
- name: Track Benchmarks with Bencher
56+
if: steps.check_fork.outputs.is_fork_pr == 'true'
57+
run: |
58+
bencher run \
59+
--host https://api.bencher.dev \
60+
--project bencher \
61+
--token '${{ secrets.BENCHER_API_TOKEN }}' \
62+
--branch "$PR_HEAD" \
63+
--hash "$PR_HEAD_SHA" \
64+
--start-point "$PR_BASE" \
65+
--start-point-hash "$PR_BASE_SHA" \
66+
--start-point-clone-thresholds \
67+
--start-point-reset \
68+
--testbed ubuntu-22.04 \
69+
--adapter rust_criterion \
70+
--err \
71+
--github-actions '${{ secrets.GITHUB_TOKEN }}' \
72+
--ci-number "$PR_NUMBER" \
73+
--file ./benchmark_results.txt

0 commit comments

Comments
 (0)