-
Notifications
You must be signed in to change notification settings - Fork 774
227 lines (204 loc) · 8.57 KB
/
Copy pathmain.yml
File metadata and controls
227 lines (204 loc) · 8.57 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
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
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
name: CI
on:
pull_request:
branches: [midnight]
push:
branches: [midnight]
paths-ignore:
- "ActionPriorityLists/**"
- "SpellDataDump/*.txt"
- "dbc_extract3/**"
- "casc_extract/**"
env:
SIMC_PROFILE: profiles/CI.simc
CCACHE_GENERATION: 0 # bump if you need to "clean" ccache
# Most CI jobs only run if you are either:
# - committing PR against default_branch
# - committing or merging into default_branch
# If PR CI is desired for other branches, chain additional `|| github.base_ref == 'branch name'`
jobs:
build:
uses: ./.github/workflows/build.yml
with:
do-test: ${{ github.base_ref == github.event.repository.default_branch || github.ref_name == github.event.repository.default_branch }}
spec-test-selection:
runs-on: ubuntu-22.04
if: github.base_ref == github.event.repository.default_branch || github.ref_name == github.event.repository.default_branch
outputs:
spec-matrix: ${{ steps.select.outputs.spec-matrix }}
steps:
- uses: actions/checkout@v6
with:
sparse-checkout: |
engine
fetch-depth: 0
- name: Select Specs From Changed Files
id: select
shell: bash
run: |
set -euo pipefail
ALL_SPECS=(
deathknight_blood
deathknight_unholy
deathknight_frost
demonhunter_devourer
demonhunter_havoc
demonhunter_vengeance
druid_balance
druid_feral
druid_guardian
druid_restoration
evoker_devastation
evoker_augmentation
hunter_beast_mastery
hunter_marksmanship
hunter_survival
mage_arcane
mage_fire
mage_frost
monk_brewmaster
monk_windwalker
paladin_protection
paladin_retribution
priest_shadow
rogue_assassination
rogue_outlaw
rogue_subtlety
shaman_elemental
shaman_enhancement
warlock_affliction
warlock_demonology
warlock_destruction
warrior_arms
warrior_fury
warrior_protection
)
if [[ "${GITHUB_EVENT_NAME}" == "pull_request" ]]; then
BASE_SHA="${{ github.event.pull_request.base.sha }}"
HEAD_SHA="${{ github.event.pull_request.head.sha }}"
else
BASE_SHA="${{ github.event.before }}"
HEAD_SHA="${{ github.sha }}"
fi
mapfile -t CHANGED_FILES < <(git diff --name-only "$BASE_SHA" "$HEAD_SHA")
echo "Changed files:"
printf ' - %s\n' "${CHANGED_FILES[@]}"
declare -A CLASS_CHANGED
CLASS_CHANGED_COUNT=0
RUN_ALL=0
mark_class_changed() {
local class_key="$1"
if [[ -z "${CLASS_CHANGED[$class_key]:-}" ]]; then
CLASS_CHANGED[$class_key]=1
CLASS_CHANGED_COUNT=$((CLASS_CHANGED_COUNT + 1))
fi
}
add_class_from_file() {
local file="$1"
case "$file" in
engine/class_modules/sc_death_knight.cpp|engine/class_modules/apl/apl_death_knight.*|profiles/generators/*/*_Generate_Deathknight.simc)
mark_class_changed deathknight
;;
engine/class_modules/sc_demon_hunter.cpp|engine/class_modules/apl/apl_demon_hunter.*|engine/class_modules/apl/demon_hunter/*|profiles/generators/*/*_Generate_Demonhunter.simc)
mark_class_changed demonhunter
;;
engine/class_modules/sc_druid.cpp|engine/class_modules/apl/druid/*|profiles/generators/*/*_Generate_Druid.simc)
mark_class_changed druid
;;
engine/class_modules/sc_evoker.cpp|engine/class_modules/apl/apl_evoker.*|profiles/generators/*/*_Generate_Evoker.simc)
mark_class_changed evoker
;;
engine/class_modules/sc_hunter.cpp|engine/class_modules/apl/hunter/*|engine/class_modules/apl/apl_hunter.*|profiles/generators/*/*_Generate_Hunter.simc)
mark_class_changed hunter
;;
engine/class_modules/sc_mage.cpp|engine/class_modules/apl/mage.*|profiles/generators/*/*_Generate_Mage.simc)
mark_class_changed mage
;;
engine/class_modules/monk/*|engine/class_modules/apl/apl_monk.*|profiles/generators/*/*_Generate_Monk.simc)
mark_class_changed monk
;;
engine/class_modules/paladin/*|engine/class_modules/apl/apl_paladin.*|profiles/generators/*/*_Generate_Paladin.simc)
mark_class_changed paladin
;;
engine/class_modules/priest/*|engine/class_modules/apl/apl_priest.*|profiles/generators/*/*_Generate_Priest.simc)
mark_class_changed priest
;;
engine/class_modules/sc_rogue.cpp|engine/class_modules/apl/rogue/*|engine/class_modules/apl/apl_rogue.*|profiles/generators/*/*_Generate_Rogue.simc)
mark_class_changed rogue
;;
engine/class_modules/sc_shaman.cpp|engine/class_modules/apl/apl_shaman.*|engine/class_modules/apl/shaman/*|profiles/generators/*/*_Generate_Shaman.simc)
mark_class_changed shaman
;;
engine/class_modules/warlock/*|engine/class_modules/apl/warlock.*|profiles/generators/*/*_Generate_Warlock.simc)
mark_class_changed warlock
;;
engine/class_modules/sc_warrior.cpp|engine/class_modules/apl/apl_warrior.*|profiles/generators/*/*_Generate_Warrior.simc)
mark_class_changed warrior
;;
*)
RUN_ALL=1
;;
esac
}
if (( ${#CHANGED_FILES[@]} == 0 )); then
RUN_ALL=1
elif (( RUN_ALL == 0 )); then
for file in "${CHANGED_FILES[@]}"; do
add_class_from_file "$file"
if (( RUN_ALL == 1 )); then
break
fi
done
fi
if (( RUN_ALL == 1 || CLASS_CHANGED_COUNT == 0 )); then
SELECTED_SPECS=("${ALL_SPECS[@]}")
else
SELECTED_SPECS=()
for spec in "${ALL_SPECS[@]}"; do
class_key="${spec%%_*}"
if [[ -n "${CLASS_CHANGED[$class_key]:-}" ]]; then
SELECTED_SPECS+=("$spec")
fi
done
fi
SPEC_JSON="["
for spec in "${SELECTED_SPECS[@]}"; do
if [[ "$SPEC_JSON" != "[" ]]; then
SPEC_JSON+=","
fi
SPEC_JSON+="\"$spec\""
done
SPEC_JSON+="]"
echo "spec-matrix=$SPEC_JSON" >> "$GITHUB_OUTPUT"
echo "Selected spec matrix: $SPEC_JSON"
environment-configuration-info:
runs-on: ubuntu-22.04
steps:
- name: Report Environment Configuration Information
run: |
echo "${{github.event.repository.default_branch}} ${{github.ref}} ${{github.ref_name}} ${{github.base_ref}} ${{github.head_ref}} ${{github.sha}}"
spec-test:
needs: [build, spec-test-selection]
if: github.base_ref == github.event.repository.default_branch || github.ref_name == github.event.repository.default_branch
uses: ./.github/workflows/spec_test.yml
with:
cache-key: ubuntu-clang++-15-for_run-${{ github.sha }}-cpp-17
is-ptr: false
spec-matrix: ${{ needs.spec-test-selection.outputs.spec-matrix }}
spec-test-ptr:
needs: [build, spec-test-selection]
if: github.base_ref == github.event.repository.default_branch || github.ref_name == github.event.repository.default_branch
uses: ./.github/workflows/spec_test.yml
with:
cache-key: ubuntu-clang++-15-for_run-${{ github.sha }}-cpp-17
is-ptr: true
spec-matrix: ${{ needs.spec-test-selection.outputs.spec-matrix }}
ubuntu-test:
needs: [build]
if: github.base_ref == github.event.repository.default_branch || github.ref_name == github.event.repository.default_branch
uses: ./.github/workflows/ubuntu_test.yml
# this job will do bad things if enabled for non-default branch without additional work
update-generated-files:
needs: [build, spec-test] # requires spec-test as this job downloads files generated from spec-test
if: github.event_name == 'push' && ( success() || failure() ) && github.repository == 'simulationcraft/simc' && github.ref_name == github.event.repository.default_branch
uses: ./.github/workflows/generate_files.yml