-
Notifications
You must be signed in to change notification settings - Fork 1
103 lines (91 loc) · 3.42 KB
/
_dispatcher.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
# This file is the dispatcher for the rest of the workflows that have complex dependencies.
# The `cli.yml` doesn't need to be dispatched via this dispatcher because it is only run manually.
name: Dispatcher
env:
GITHUB_OUTPUT: ""
on:
push:
branches:
- main
paths:
- "docker/**"
- ".github/**"
- "!.github/workflows/cli.yml"
- "!docker/psibase.Dockerfile"
- "!docker/psinode.Dockerfile"
pull_request:
types: [opened, synchronize, reopened]
paths:
- "docker/**"
- ".github/**"
- "!.github/workflows/cli.yml"
- "!docker/psibase.Dockerfile"
- "!docker/psinode.Dockerfile"
jobs:
determine-actions:
name: Set up the dispatching variables
runs-on: ubuntu-latest
outputs:
run_tc: ${{ steps.schedule-builders.outputs.run_tc }}
run_2004: ${{ steps.schedule-builders.outputs.run_2004 }}
run_2204: ${{ steps.schedule-builders.outputs.run_2204 }}
run_contrib: ${{ steps.schedule-builders.outputs.run_contrib }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: false
fetch-depth: 0
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v42
- name: (Debug) Print changed files
env:
ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
run: |
for file in $ALL_CHANGED_FILES; do
echo $file
done
- name: Determine what to dispatch
id: schedule-builders
env:
ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
run: |
necessary_jobs=$(./.github/scripts/check-patterns.sh "$ALL_CHANGED_FILES")
read -r run_tc run_2004 run_2204 run_contrib <<< "$output"
echo "run_tc=${run_tc}" >> $GITHUB_OUTPUT
echo "run_2004=${run_2004}" >> $GITHUB_OUTPUT
echo "run_2204=${run_2204}" >> $GITHUB_OUTPUT
echo "run_contrib=${run_contrib}" >> $GITHUB_OUTPUT
build-tool-config:
name: "Build tool config"
needs: determine-actions
if: ${{ needs.determine-actions.outputs.run_tc == '1' }}
uses: ./.github/workflows/tool-config.yml
with:
is_pr: ${{ github.event_name == 'pull_request' }}
build-2004:
name: "Build 20.04 builder"
needs: determine-actions
if: ${{ needs.determine-actions.outputs.run_2004 == '1' }}
uses: ./.github/workflows/builder-ubuntu.yml
with:
is_pr: ${{ github.event_name == 'pull_request' }}
ubuntu_version: "2004"
build-2204:
name: "Build 22.04 builder"
needs: determine-actions
if: ${{ needs.determine-actions.outputs.run_2204 == '1' }}
uses: ./.github/workflows/builder-ubuntu.yml
with:
is_pr: ${{ github.event_name == 'pull_request' }}
ubuntu_version: "2204"
build-contributor:
name: "Build contributor"
needs: [determine-actions, build-tool-config, build-2204]
if: ${{ needs.determine-actions.outputs.run_contrib == '1' }}
uses: ./.github/workflows/contributor.yml
with:
is_pr: ${{ github.event_name == 'pull_request' }}
is_local_tools: ${{ needs.build-tool-config.result == 'success' && github.event_name == 'pull_request'}}
is_local_base: ${{ needs.build-2204.result == 'success' && github.event_name == 'pull_request'}}