24
24
SKIP_YARN_COREPACK_CHECK : 1
25
25
26
26
jobs :
27
- # list-crates:
28
- # if: >-
29
- # ${{ !contains(github.event.head_commit.message, 'chore: ') }}
30
- # name: List crates
31
- # runs-on: ubuntu-latest
32
- # outputs:
33
- # crates: ${{ steps.list-crates.outputs.crates }}
34
- # steps:
35
- # - uses: actions/checkout@v4
36
-
37
- # - name: Install Rust
38
- # uses: actions-rs/toolchain@v1
39
- # with:
40
- # profile: minimal
41
-
42
- # - name: List crates
43
- # id: list-crates
44
- # run: echo "crates=$(./scripts/cargo/get-crates.sh)" >> $GITHUB_OUTPUT
45
-
46
- # bench-crate:
47
- # name: Bench ${{ matrix.crate }}
48
- # runs-on: ubuntu-latest
49
- # needs:
50
- # - list-crates
51
- # strategy:
52
- # fail-fast: false
53
- # matrix:
54
- # crate: ${{fromJson(needs.list-crates.outputs.crates)}}
55
- # steps:
56
- # - uses: actions/checkout@v4
57
-
58
- # - name: Install Rust
59
- # uses: actions-rs/toolchain@v1
60
- # with:
61
- # profile: minimal
62
-
63
- # - uses: ./.github/actions/setup-node
64
-
65
- # - name: Setup rust toolchain, cache and cargo-codspeed binary
66
- # uses: moonrepo/setup-rust@v0
67
- # with:
68
- # channel: stable
69
- # cache-target: release
70
- # bins: cargo-codspeed
71
-
72
- # - name: Build the benchmark target(s)
73
- # run: cargo codspeed build -p ${{ matrix.crate }}
74
-
75
- # - name: Run the benchmarks
76
- # uses: CodSpeedHQ/action@v2
77
- # with:
78
- # run: cargo codspeed run -p ${{ matrix.crate }}
79
- # token: ${{ secrets.CODSPEED_TOKEN }}
80
-
81
- bench-all :
82
- name : Bench everything
27
+ list-crates :
83
28
if : >-
84
29
${{ !contains(github.event.head_commit.message, 'chore: ') }}
30
+ name : List crates to benchmark
31
+ runs-on : ubuntu-22.04
32
+ outputs :
33
+ crates : ${{ steps.list-crates.outputs.crates }}
34
+ steps :
35
+ - uses : actions/checkout@v4
36
+
37
+ - name : List crates
38
+ id : list-crates
39
+ run : echo "crates=$(./scripts/bench/list-crates-with-bench.sh)" >> $GITHUB_OUTPUT
40
+
41
+ build-crate :
42
+ name : Build benchmark for ${{ matrix.crate }}
85
43
runs-on : ubuntu-22.04
44
+ needs : list-crates
45
+ strategy :
46
+ matrix :
47
+ crate : ${{fromJson(needs.list-crates.outputs.crates)}}
86
48
steps :
87
49
- uses : actions/checkout@v4
88
50
@@ -91,18 +53,65 @@ jobs:
91
53
with :
92
54
profile : minimal
93
55
94
- - uses : ./.github/actions/setup-node
56
+ - uses : Swatinem/rust-cache@v2
57
+ # Some crates are too slow to build
58
+ if : matrix.crate == 'swc'
59
+ with :
60
+ shared-key : " bench-${{ matrix.crate }}"
61
+ key : " bench-${{ matrix.crate }}"
62
+ cache-all-crates : true
95
63
96
64
- name : Install cargo-codspeed
97
65
uses : taiki-e/install-action@v2
98
66
with :
99
67
tool : cargo-codspeed@2.7.2
100
68
101
69
- name : Build the benchmark target(s)
102
- run : ./scripts/bench/build-all-crates.sh
70
+ run : ./scripts/bench/build-crate.sh ${{ matrix.crate }}
71
+
72
+ - name : Upload built artifacts
73
+ uses : actions/upload-artifact@v4
74
+ with :
75
+ name : bench-${{ matrix.crate }}
76
+ path : target/codspeed
77
+
78
+ bench-all :
79
+ name : Run benchmarks
80
+ needs : build-crate
81
+ runs-on :
82
+ - self-hosted
83
+ - linux
84
+ - x64
85
+ if : >-
86
+ ${{ !contains(github.event.head_commit.message, 'chore: ') }}
87
+ steps :
88
+ - uses : actions/checkout@v4
89
+
90
+ - name : Install Rust
91
+ uses : actions-rs/toolchain@v1
92
+ with :
93
+ profile : minimal
94
+
95
+ - name : Install cargo-codspeed
96
+ uses : taiki-e/install-action@v2
97
+ with :
98
+ tool : cargo-codspeed@2.7.2
99
+
100
+ - run : mkdir -p target/codspeed
101
+
102
+ - name : Download built artifacts
103
+ uses : actions/download-artifact@v4
104
+ with :
105
+ pattern : bench-*
106
+ path : target/codspeed
107
+ merge-multiple : true
108
+
109
+ - run : ls -alR target/codspeed
110
+
111
+ - run : chmod -R +x target/codspeed/*
103
112
104
113
- name : Run the benchmarks
105
- uses : CodSpeedHQ/action@v2
114
+ uses : CodSpeedHQ/action@v3
106
115
with :
107
116
run : cargo codspeed run
108
117
token : ${{ secrets.CODSPEED_TOKEN }}
0 commit comments