-
-
Notifications
You must be signed in to change notification settings - Fork 0
155 lines (145 loc) · 5.58 KB
/
feature_powerset.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
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
# Check to build Roadster with all combinations (powerset) of features. Because we have a bunch of features, the
# powerset of all features is quite large, meaning we need to run a large number of iterations of the tests. To
# conserve CI usage, as well as mimimize CI time needed on PRs, we'll only run checks against the feature powerset
# twice a week, and only if a commit was merged in the past 5 days.
name: Feature Powerset
on:
schedule:
# Run once a week on Friday at 11PM UTC (Friday 4PM PST)
- cron: '0 23 * * 5'
# Run once a week on Monday at 11PM UTC (Monday 4PM PST)
- cron: '0 23 * * 1'
workflow_dispatch:
pull_request:
branches: [ main ]
types: [ labeled ]
env:
CARGO_TERM_COLOR: always
# https://stackoverflow.com/a/72408109
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
# https://stackoverflow.com/questions/63014786/how-to-schedule-a-github-actions-nightly-build-but-run-it-only-when-there-where
check_trigger:
runs-on: ubuntu-latest
name: Check trigger
outputs:
should_run1: ${{ steps.schedule_trigger.outputs.should_run }}
should_run2: ${{ steps.label_trigger.outputs.should_run }}
steps:
- uses: actions/checkout@v4
- name: print latest_commit
run: echo ${{ github.sha }}
- id: schedule_trigger
continue-on-error: true
name: Check latest commit is less than 5 days ago
if: ${{ github.event_name == 'schedule' }}
run: test $(git rev-list --after="5 days" ${{ github.sha }}) && echo "should_run=true" >> "$GITHUB_OUTPUT"
- id: label_trigger
continue-on-error: true
name: Check that the powerset_check label was added
if: ${{ github.event_name == 'pull_request' && github.event.label.name == 'powerset_check' }}
run: echo "should_run=true" >> "$GITHUB_OUTPUT"
generate_powerset:
needs: check_trigger
if: ${{ needs.check_trigger.outputs.should_run1 == 'true' || needs.check_trigger.outputs.should_run2 == 'true' || github.event_name == 'workflow_dispatch' }}
runs-on: ubuntu-latest
outputs:
data: ${{ steps.build_data.outputs.data }}
steps:
- uses: actions/checkout@v4
- name: Random seed
id: random_seed
run: |
if [ -n "${{ github.event.number }}" ]; then
echo "seed=-r ${{ github.event.number }}" >> "$GITHUB_OUTPUT"
elif [ -n "${{ github.run_id }}" ]; then
echo "seed=-r ${{ github.run_id }}" >> "$GITHUB_OUTPUT"
else
echo "seed=" >> "$GITHUB_OUTPUT"
fi
- name: Build powerset data
id: build_data
run: |
cd private/powerset_matrix
echo "data=$(cargo run -- -s 40 -f json -c 50 ${{ steps.random_seed.outputs.seed }})" >> "$GITHUB_OUTPUT"
powerset_test:
name: Powerset Tests
needs: generate_powerset
runs-on: ubuntu-latest
strategy:
max-parallel: 10
matrix:
index: ${{ fromJson(needs.generate_powerset.outputs.data).indexes }}
env:
features: ${{ join(fromJson(needs.generate_powerset.outputs.data).powersets[ matrix.index ], ' ') }}
steps:
- uses: actions/checkout@v4
- uses: rui314/setup-mold@v1
- uses: taiki-e/install-action@nextest
- name: Test
run: |
features=($features)
length=${#features[@]}
i=1
for feature_list in "${features[@]}"; do
echo "::group::[$i/$length]: cargo nextest run --no-fail-fast --features $feature_list"
cargo nextest run --no-fail-fast --features "$feature_list"
echo "::endgroup::"
echo "::group::[$i/$length]: cargo test --doc --no-fail-fast --features $feature_list"
cargo test --doc --no-fail-fast --features "$feature_list"
cargo clean -p roadster
i=$(expr $i + 1)
echo "::endgroup::"
done
powerset_check:
name: Powerset Check
needs: generate_powerset
runs-on: ubuntu-latest
strategy:
max-parallel: 10
matrix:
index: ${{ fromJson(needs.generate_powerset.outputs.data).indexes }}
env:
features: ${{ join(fromJson(needs.generate_powerset.outputs.data).powersets[ matrix.index ], ' ') }}
steps:
- uses: actions/checkout@v4
- uses: rui314/setup-mold@v1
- name: Check
run: |
features=($features)
length=${#features[@]}
i=1
for feature_list in "${features[@]}"; do
echo "::group::[$i/$length]: cargo check --no-dev-deps --features $feature_list"
cargo check --features "$feature_list"
cargo clean -p roadster
i=$(expr $i + 1)
echo "::endgroup::"
done
powerset_clippy:
name: Powerset Clippy
needs: generate_powerset
runs-on: ubuntu-latest
strategy:
max-parallel: 10
matrix:
index: ${{ fromJson(needs.generate_powerset.outputs.data).indexes }}
env:
features: ${{ join(fromJson(needs.generate_powerset.outputs.data).powersets[ matrix.index ], ' ') }}
steps:
- uses: actions/checkout@v4
- uses: rui314/setup-mold@v1
- name: Clippy
run: |
features=($features)
length=${#features[@]}
i=1
for feature_list in "${features[@]}"; do
echo "::group::[$i/$length]: cargo clippy --features $feature_list -- -D warnings "
cargo clippy --features "$feature_list" -- -D warnings
cargo clean -p roadster
i=$(expr $i + 1)
echo "::endgroup::"
done