u #41
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: "0 0 * * *" | |
pull_request: | |
types: [opened, synchronize] | |
paths-ignore: | |
- '**/*.md' | |
push: | |
branches: | |
- main | |
- transform | |
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 | awk '{print $5}') | |
echo "BINARY_SIZE=$BINARY_SIZE" >> $GITHUB_OUTPUT | |
- name: Fix Permission Loss | |
run: | | |
tar -cvf transform.tar ./target/release/transform | |
tar -cvf transform_all.tar ./target/release/transform_all | |
- uses: actions/upload-artifact@v4 | |
with: | |
if-no-files-found: error | |
name: transform | |
path: transform.tar | |
- uses: actions/upload-artifact@v4 | |
with: | |
if-no-files-found: error | |
name: transform_all | |
path: transform_all.tar | |
# 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_all | |
# - name: Transform | |
# run: ./transform_all ${{ 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 | |
runtime: | |
name: Measure runtime | |
needs: build | |
runs-on: macos-14 # Mac M1; use the mac version of /usr/bin/time for cpu cycles | |
steps: | |
- uses: taiki-e/checkout-action@v1 | |
- uses: taiki-e/install-action@hyperfine | |
- uses: actions/download-artifact@v4 | |
with: | |
name: transform | |
path: . | |
- run: tar xf transform.tar.gz | |
- run: curl https://raw.githubusercontent.com/oxc-project/benchmark-files/main/cal.com.tsx > cal.com.tsx | |
- run: ls -lh | |
# - name: Duration | |
# id: duration | |
# run: | | |
# FILE="./cal.com.tsx" | |
# hyperfine -i --warmup 10 --export-json output.json "./transform $FILE" | |
# DURATION=$(jq '.results[0].mean' output.json) | |
# echo $DURATION | |
# echo "DURATION=$DURATION" >> $GITHUB_OUTPUT | |
- name: Max RSS | |
id: rss | |
run: | | |
FILE="./cal.com.tsx" | |
/usr/bin/time -l ./transform $FILE | |
hyperfine --warmup 10 --show-output \ | |
"/usr/bin/time -l ./transform $FILE" 2>&1 | \ | |
grep "maximum resident set size" | \ | |
awk '{ print $1 }' \ | |
> output | |
cat output | |
TOTAL=$(awk '{ total += $1 } END { print total }' output) | |
COUNT=$(wc -l output | awk '{ print $1 }') | |
AVERAGE=$(echo "$TOTAL $COUNT" | awk '{printf "%.1f", $1 / $2}') | |
echo $AVERAGE | |
echo "RSS=$AVERAGE" >> $GITHUB_OUTPUT | |
- name: Cycles Elapsed | |
id: cycles | |
run: | | |
FILE="./cal.com.tsx" | |
/usr/bin/time -l ./transform $FILE | |
hyperfine --warmup 10 --show-output \ | |
"/usr/bin/time -l ./transform $FILE" 2>&1 | \ | |
grep "cycles elapsed" | \ | |
awk '{ print $1 }' \ | |
> output | |
cat output | |
TOTAL=$(awk '{ total += $1 } END { print total }' output) | |
COUNT=$(wc -l output | awk '{ print $1 }') | |
echo $TOTAL | |
echo $COUNT | |
AVERAGE=$(echo "$TOTAL $COUNT" | awk '{printf "%.1f", $1 / $2}') | |
echo $AVERAGE | |
echo "CYCLES=$AVERAGE" >> $GITHUB_OUTPUT | |
# - name: Create Data | |
# run: | | |
# echo $(jq ".[0].value = ${{ steps.duration.outputs.DURATION }}" runtime.json) > data.json | |
# echo $(jq ".[1].value = ${{ steps.rss.outputs.RSS }}" data.json) > data.json | |
# echo $(jq ".[2].value = ${{ steps.cycles.outputs.CYCLES }}" data.json) > data.json | |
# cat data.json | |
# - uses: benchmark-action/github-action-benchmark@v1 | |
# with: | |
# github-token: ${{ secrets.GITHUB_TOKEN }} | |
# name: Transform Runtime Metrics | |
# tool: customSmallerIsBetter | |
# output-file-path: data.json | |
# gh-pages-branch: gh-pages | |
# benchmark-data-dir-path: runtime | |
# auto-push: true | |
# save-data-file: true |