Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 506153b

Browse files
committed
refactor(workflow): Use build matrix
1 parent 68e6402 commit 506153b

File tree

1 file changed

+10
-111
lines changed

1 file changed

+10
-111
lines changed

.github/workflows/metrics.yaml

Lines changed: 10 additions & 111 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,10 @@ jobs:
6363
path: target/build.json
6464
if-no-files-found: error
6565

66-
self_metrics:
66+
other_metrics:
67+
strategy:
68+
matrix:
69+
names: [self, ripgrep, webrender, diesel]
6770
runs-on: ubuntu-latest
6871
needs: [setup_cargo, build_metrics]
6972

@@ -87,123 +90,19 @@ jobs:
8790
path: target/
8891
key: ${{ runner.os }}-target-${{ github.sha }}
8992

90-
- name: Collect build metrics
91-
run: cargo xtask metrics self
92-
93-
- name: Upload build metrics
94-
uses: actions/upload-artifact@v3
95-
with:
96-
name: self-${{ github.sha }}
97-
path: target/self.json
98-
if-no-files-found: error
99-
100-
ripgrep_metrics:
101-
runs-on: ubuntu-latest
102-
needs: [setup_cargo, build_metrics]
103-
104-
steps:
105-
- name: Checkout repository
106-
uses: actions/checkout@v3
107-
108-
- name: Restore cargo cache
109-
uses: actions/cache@v3
110-
with:
111-
path: |
112-
~/.cargo/bin/
113-
~/.cargo/registry/index/
114-
~/.cargo/registry/cache/
115-
~/.cargo/git/db/
116-
key: ${{ runner.os }}-cargo-${{ github.sha }}
93+
- name: Collect metrics
94+
run: cargo xtask metrics ${{ matrix.names }}
11795

118-
- name: Restore target cache
119-
uses: actions/cache@v3
120-
with:
121-
path: target/
122-
key: ${{ runner.os }}-target-${{ github.sha }}
123-
124-
- name: Collect build metrics
125-
run: cargo xtask metrics ripgrep
126-
127-
- name: Upload ripgrep metrics
96+
- name: Upload metrics
12897
uses: actions/upload-artifact@v3
12998
with:
130-
name: ripgrep-${{ github.sha }}
131-
path: target/ripgrep.json
99+
name: ${{ matrix.names }}-${{ github.sha }}
100+
path: target/${{ matrix.names }}.json
132101
if-no-files-found: error
133102

134-
webrender_metrics:
135-
runs-on: ubuntu-latest
136-
needs: [setup_cargo, build_metrics]
137-
138-
steps:
139-
- name: Checkout repository
140-
uses: actions/checkout@v3
141-
142-
- name: Restore cargo cache
143-
uses: actions/cache@v3
144-
with:
145-
path: |
146-
~/.cargo/bin/
147-
~/.cargo/registry/index/
148-
~/.cargo/registry/cache/
149-
~/.cargo/git/db/
150-
key: ${{ runner.os }}-cargo-${{ github.sha }}
151-
152-
- name: Restore target cache
153-
uses: actions/cache@v3
154-
with:
155-
path: target/
156-
key: ${{ runner.os }}-target-${{ github.sha }}
157-
158-
- name: Collect webrender metrics
159-
run: cargo xtask metrics webrender
160-
161-
- name: Upload webrender metrics
162-
uses: actions/upload-artifact@v3
163-
with:
164-
name: webrender-${{ github.sha }}
165-
path: target/webrender.json
166-
if-no-files-found: error
167-
168-
diesel_metrics:
169-
runs-on: ubuntu-latest
170-
needs: [setup_cargo, build_metrics]
171-
172-
steps:
173-
- name: Checkout repository
174-
uses: actions/checkout@v3
175-
176-
- name: Restore cargo cache
177-
uses: actions/cache@v3
178-
with:
179-
path: |
180-
~/.cargo/bin/
181-
~/.cargo/registry/index/
182-
~/.cargo/registry/cache/
183-
~/.cargo/git/db/
184-
key: ${{ runner.os }}-cargo-${{ github.sha }}
185-
186-
- name: Restore target cache
187-
uses: actions/cache@v3
188-
with:
189-
path: target/
190-
key: ${{ runner.os }}-target-${{ github.sha }}
191-
192-
- name: Collect build metrics
193-
run: cargo xtask metrics diesel
194-
195-
- name: Upload build metrics
196-
uses: actions/upload-artifact@v3
197-
with:
198-
name: diesel-${{ github.sha }}
199-
path: target/diesel.json
200-
if-no-files-found: error
201-
202-
203-
204103
generate_final_metrics:
205104
runs-on: ubuntu-latest
206-
needs: [build_metrics, self_metrics, ripgrep_metrics, webrender_metrics, diesel_metrics]
105+
needs: [build_metrics, other_metrics]
207106
steps:
208107
- name: Checkout repository
209108
uses: actions/checkout@v3

0 commit comments

Comments
 (0)