Files
react/compiler/.github/workflows/rust.yml
Lauren Tan 80efd75b8e [ci] Add benchmark comparison
Updates the parser-benchmark script to use a benchmarking framework, and 

also brings in yargs to make it easier to handle parsing arguments. 

Non-CI usage: 

``` 

$ cd bench/parser-benchmark 

$ yarn bench --help 

Options: 

--help        Show help                                              [boolean] 

--ci                                                [boolean] [default: false] 

--sampleSize                                             [number] [default: 1] 

$ yarn bench --sampleSize=3 

[ISOBENCH ENDED] Parser Benchmark (3 times) 

OXC           - 32 op/s. 3 samples in 9518 ms. 5.288x (BEST) 

SWC           - 20 op/s. 3 samples in 9487 ms. 3.256x 

HermesParser  - 6 op/s. 3 samples in 9124 ms. 1.000x (WORST) 

Forget (Rust) - 15 op/s. 3 samples in 9749 ms. 2.499x 

``` 

In CI this outputs JSON instead of logging to stdout. The results are 

stored in github's action cache and used as a point of comparison when 

new commits are pushed to main. The comparison should be shown on 

workflow [summary 
pages](https://github.com/facebook/react-forget/actions/runs/5956421081), but 
nothing will be populated until we merge this PR. 

We intentionally only run this workflow on main as any run would 

override the last cached result, so a PR with multiple pushes would then 

start having comparisons with itself.
2023-08-23 17:58:23 -04:00

69 lines
1.9 KiB
YAML

name: Forget (Rust)
on:
push:
branches: ["main"]
paths:
- .github/workflows/**
- crates/**
- Cargo.*
- ./*.toml
pull_request:
paths:
- .github/workflows/**
- crates/**
- Cargo.*
- ./*.toml
env:
CARGO_TERM_COLOR: always
RUSTFLAGS: -Dwarnings
jobs:
test:
name: Rust Test (${{ matrix.target.os }})
strategy:
matrix:
target:
- target: ubuntu-latest
os: ubuntu-latest
# TODO: run on more platforms
# - target: macos-latest
# os: macos-latest
# - target: windows-latest
# os: windows-latest
runs-on: ${{ matrix.target.os }}
steps:
- uses: actions/checkout@v3
- uses: Swatinem/rust-cache@v2
- name: cargo test
run: cargo test --manifest-path=Cargo.toml --locked ${{ matrix.target.features && '--features' }} ${{ matrix.target.features }}
lint:
name: Rust Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
# NOTE: use `rustup run <toolchain> <command>` in commands below
# with this exact same toolchain value
toolchain: nightly-2023-08-01
override: true
components: rustfmt, clippy
- uses: Swatinem/rust-cache@v2
- name: rustfmt
run: grep -r --include "*.rs" --files-without-match "@generated" crates | xargs rustup run nightly-2023-08-01 rustfmt --check --config="skip_children=true"
# - name: cargo clippy
# run: rustup run nightly-2023-08-01 cargo clippy -- -Dclippy::correctness
build:
name: Rust Build
runs-on: ubuntu-latest
# TODO: build on more platforms, deploy, etc
steps:
- uses: actions/checkout@v3
- uses: Swatinem/rust-cache@v2
- name: cargo build
run: cargo build --release