-
-
Notifications
You must be signed in to change notification settings - Fork 1
163 lines (141 loc) · 4.15 KB
/
ci.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
156
157
158
159
160
161
162
163
name: CI
on:
workflow_dispatch:
schedule:
- cron: "0 0 * * *"
pull_request:
types: [opened, synchronize]
paths-ignore:
- '**/*.md'
push:
branches:
- main
paths-ignore:
- '**/*.md'
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: ${{ github.ref_name != 'main' }}
jobs:
build:
name: Build
timeout-minutes: 10
runs-on: ubuntu-latest
outputs:
size: ${{ steps.run.outputs.BINARY_SIZE }}
steps:
- name: Checkout Repository
uses: taiki-e/checkout-action@v1
- name: Checkout oxc
uses: actions/checkout@v4
with:
repository: oxc-project/oxc
ref: main
path: oxc
- run: mv oxc ../oxc
- name: Install Rust
uses: Boshen/setup-rust@main
with:
save-cache: ${{ github.ref_name == 'main' }}
- name: Build
run: cargo build --release
- id: run
run: |
BINARY_SIZE=$(ls -l ./target/release/transform-ci | awk '{print $5}')
echo "BINARY_SIZE=$BINARY_SIZE" >> $GITHUB_OUTPUT
- name: Upload Binary
uses: actions/upload-artifact@v4
with:
if-no-files-found: error
name: transform-ci
path: ./target/release/transform-ci
checkout:
name: Read repos.json
needs: build
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.setmatrix.outputs.content }}
steps:
- uses: taiki-e/checkout-action@v1
- id: setmatrix
uses: jaywcjlove/github-action-read-file@main
with:
localfile: ./matrix.json
test:
needs: checkout
timeout-minutes: 30
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include: ${{ fromJson(needs.checkout.outputs.matrix) }}
name: ${{ matrix.repository }}
steps:
- name: Clone ${{ matrix.repository }}
uses: actions/checkout@v4
with:
repository: ${{ matrix.repository }}
ref: ${{ matrix.ref }}
- name: Download Transform Binary
uses: actions/download-artifact@v4
with:
name: transform-ci
- name: chmod +x transform-ci
run: chmod +x ./transform-ci
- name: Transform
run: ./transform-ci ${{ matrix.transform_directories }}
- name: Install pnpm
run: corepack enable
- name: Setup Node.js
uses: actions/setup-node@v4
with:
cache: pnpm
- name: Install packages
run: pnpm install
- name: Check
run: ${{ matrix.command }}
compile-time:
name: Compile Time
runs-on: ubuntu-latest
if: ${{ github.ref_name == 'main' }}
outputs:
time: ${{ steps.run.outputs.COMPILE_TIME }}
steps:
- uses: taiki-e/checkout-action@v1
- name: Checkout oxc
uses: actions/checkout@v4
with:
repository: oxc-project/oxc
ref: main
path: oxc
- run: mv oxc ../oxc
- uses: Boshen/setup-rust@main
- run: cargo clean # build from scatch using local system cache to avoid download from crates.io
- id: run
run: |
/usr/bin/time -f "%e" -o output cargo build --release
cat output
COMPILE_TIME=$(cat output)
echo $COMPILE_TIME
echo "COMPILE_TIME=$COMPILE_TIME" >> $GITHUB_OUTPUT
monitor:
name: Monitor Metrics
needs: [build, compile-time]
if: ${{ github.ref_name == 'main' }}
runs-on: ubuntu-latest
steps:
- uses: taiki-e/checkout-action@v1
- name: Create Data
run: |
echo $(jq ".[0].value = ${{ needs.compile-time.outputs.time }}" metrics.json) > data.json
echo $(jq ".[1].value = ${{ needs.build.outputs.size }}" data.json) > data.json
cat data.json
- uses: benchmark-action/github-action-benchmark@v1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
name: Oxc Metrics
tool: customSmallerIsBetter
output-file-path: data.json
gh-pages-branch: gh-pages
benchmark-data-dir-path: metrics
auto-push: true
save-data-file: true