forked from llnl/benchpark
-
Notifications
You must be signed in to change notification settings - Fork 0
176 lines (172 loc) · 5.74 KB
/
ci.yml
File metadata and controls
176 lines (172 loc) · 5.74 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
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
name: ci
on:
push:
branches: [develop]
pull_request:
branches: [develop]
merge_group:
concurrency:
group: ci-${{github.ref}}-${{github.event.pull_request.number || github.run_number}}
cancel-in-progress: true
permissions:
pull-requests: read
contents: read
pages: write
id-token: write
jobs:
changes:
runs-on: ubuntu-24.04
outputs:
docs: ${{ steps.filter.outputs.docs }}
style: ${{ steps.filter.outputs.style }}
run: ${{ steps.filter.outputs.run }}
coverage: ${{ steps.filter.outputs.coverage }}
license: ${{ steps.filter.outputs.license }}
diffpackages: ${{ steps.filter.outputs.diffpackages }}
modified_repo_dirs: ${{ steps.get_modified_repo_dirs.outputs.modified_repo_dirs }}
steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8
if: ${{ github.event_name == 'push' || github.event_name == 'merge_group' || github.event_name == 'pull_request' }}
with:
fetch-depth: 0
# For pull requests it's not necessary to checkout the code
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36
id: filter
with:
# For merge group events, compare against the target branch (main)
base: ${{ github.event_name == 'merge_group' && github.event.merge_group.base_ref || '' }}
# For merge group events, use the merge group head ref
ref: ${{ github.event_name == 'merge_group' && github.event.merge_group.head_sha || github.ref }}
filters: |
docs:
- '.github/**'
- 'bin/**'
- 'configs/**'
- 'docs/**'
- 'experiments/**'
- 'lib/**'
- 'repo/**'
- 'systems/**'
- 'var/**'
- 'README.rst'
- 'tags.yaml'
- 'pyproject.toml'
style:
- '.github/**'
- '.gitlab/**'
- 'bin/**'
- 'configs/**'
- 'docs/conf.py'
- 'experiments/**'
- 'lib/**'
- 'repo/**'
- 'systems/**'
- 'var/**'
- 'pyproject.toml'
- '.flake8'
- 'checkout-versions.yaml'
- '.gitlab-ci.yml'
- 'docs/**'
run:
- '.github/**'
- 'bin/**'
- 'configs/**'
- 'checkout-versions.yaml'
- 'experiments/**'
- 'lib/**'
- 'repo/**'
- 'requirements.txt'
- 'systems/**'
- 'var/**'
coverage:
- '.github/**'
- '.gitlab/**'
- 'bin/**'
- 'configs/**'
- 'checkout-versions.yaml'
- 'experiments/**'
- 'lib/**'
- 'repo/**'
- 'systems/**'
- 'var/**'
- 'pyproject.toml'
license:
- '.github/**'
- '.gitlab/**'
- 'bin/**'
- 'configs/**'
- 'docs/**'
- 'experiments/**'
- 'lib/**'
- 'repo/**'
- 'systems/**'
- 'var/**'
diffpackages:
- 'repo/**/package.py'
- name: Get modified directories in repo/
id: get_modified_repo_dirs
run: |
# Fetch develop branch
git fetch --update-head-ok origin develop:develop
# Get the modified directories under 'repo/'
MODIFIED_REPO_DIRS=$(git diff --name-only develop | grep 'repo/' | xargs -n1 dirname | sed 's|^repo/||' | tr '\n' ' ')
# Debugging: Print the modified directories
echo "Modified directories: $MODIFIED_REPO_DIRS"
# Output the modified directories as a GitHub Actions output
echo "modified_repo_dirs=$MODIFIED_REPO_DIRS" >> $GITHUB_OUTPUT
docs:
if: ${{ needs.changes.outputs.docs == 'true' }}
needs: changes
uses: ./.github/workflows/docs.yml
style:
if: ${{ needs.changes.outputs.style == 'true' }}
needs: changes
uses: ./.github/workflows/style.yml
run:
if: ${{ needs.changes.outputs.run == 'true' }}
needs: changes
uses: ./.github/workflows/run.yml
# 'workflow_call' actions do not get access to secrets
# normally. So, we add this (plus the corresponding)
# settings in coverage.yml to pass the token on
secrets:
BENCHPARK_CODECOV_TOKEN: ${{ secrets.BENCHPARK_CODECOV_TOKEN }}
coverage:
if: ${{ needs.changes.outputs.coverage == 'true' }}
needs: changes
uses: ./.github/workflows/coverage.yml
# 'workflow_call' actions do not get access to secrets
# normally. So, we add this (plus the corresponding)
# settings in coverage.yml to pass the token on
secrets:
BENCHPARK_CODECOV_TOKEN: ${{ secrets.BENCHPARK_CODECOV_TOKEN }}
license:
if: ${{ needs.changes.outputs.license == 'true' }}
needs: changes
uses: ./.github/workflows/license.yml
diffpackages:
if: ${{ needs.changes.outputs.diffpackages == 'true' }}
needs: changes
uses: ./.github/workflows/diffpackages.yml
with:
modified_repo_dirs: ${{ needs.changes.outputs.modified_repo_dirs }}
all:
needs:
- changes
- docs
- style
- run
- coverage
- license
- diffpackages
if: always()
runs-on: ubuntu-latest
steps:
- name: Status summary
run: |-
if [[ "${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') }}" == "true" ]]; then
echo "One or more required jobs failed or were cancelled"
exit 1
else
echo "All jobs completed successfully"
fi