Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: use sccache #268

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .github/actions/rustup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,18 @@ inputs:
default: false
required: false
type: boolean
cache:
default: true
required: false
type: boolean
shared-key:
default: ''
required: false
type: string
sccache:
default: true
required: false
type: boolean

runs:
using: composite
Expand Down Expand Up @@ -52,3 +64,13 @@ runs:
- name: Install
shell: bash
run: rustup show

- name: sccache-cache
if: ${{ inputs.sccache == 'true' }}
uses: mozilla-actions/sccache-action@v0.0.3

- name: Swatinem/rust-cache
if: ${{ inputs.cache == 'true' }}
uses: Swatinem/rust-cache@v2
with:
shared-key: ${{ inputs.shared_key }}
30 changes: 16 additions & 14 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,23 @@ name: Benchmark
on:
workflow_dispatch:
pull_request:
paths:
- './github/workflow/benchmark.yml'
- 'crates/oxc_parser/**'
- 'crates/oxc_ast/**'
- 'crates/oxc_semantic/**'
- 'tasks/benchmark/**'
- 'rust-toolchain.toml'
- '!**/*.md'
# paths:
# - './github/workflow/benchmark.yml'
# - 'crates/oxc_parser/**'
# - 'crates/oxc_ast/**'
# - 'crates/oxc_semantic/**'
# - 'tasks/benchmark/**'
# - 'rust-toolchain.toml'
# - '!**/*.md'

concurrency:
group: ${{ github.workflow }}-${{ github.ref_name }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true

env:
CARGO_TERM_QUIET: true
# CARGO_TERM_QUIET: true
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache"

jobs:
benchmark:
Expand All @@ -32,11 +34,8 @@ jobs:
with:
ref: ${{ github.event.pull_request.head.sha }}

- name: Install Rust Toolchain
- name: Install Rust on PR
uses: ./.github/actions/rustup

- name: Rust Cache
uses: Swatinem/rust-cache@v2
with:
shared-key: benchmark

Expand All @@ -58,8 +57,11 @@ jobs:
clean: false
ref: main

- name: Install Rust Toolchain
- name: Install Rust on Main
uses: ./.github/actions/rustup
with:
cache: false
sccache: false

- name: Compile
run: cargo build --release -p oxc_benchmark
Expand Down
49 changes: 26 additions & 23 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,24 @@ on:
push:
branches:
- main
paths:
- 'crates/**'
- 'tasks/**'
- 'Cargo.toml'
- 'Cargo.lock'
- 'rust-toolchain.toml'
- '!**/*.md'
- sccache
# paths:
# - 'crates/**'
# - 'tasks/**'
# - 'Cargo.toml'
# - 'Cargo.lock'
# - 'rust-toolchain.toml'
# - '!**/*.md'

# cancel previous job runs for the same workflow + pr
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

env:
CARGO_TERM_QUIET: true
# CARGO_TERM_QUIET: true
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache"

jobs:
format:
Expand All @@ -37,10 +40,11 @@ jobs:
- name: Checkout
uses: actions/checkout@v3

- name: Install Rust Toolchain
- name: Install Rust
uses: ./.github/actions/rustup
with:
fmt: true
shared-key: ci

- name: Run rustfmt
run: cargo fmt --all -- --check
Expand All @@ -52,15 +56,11 @@ jobs:
- name: Checkout
uses: actions/checkout@v3

- name: Install Rust Toolchain
- name: Install Rust
uses: ./.github/actions/rustup
with:
clippy: true

- name: Cache
uses: Swatinem/rust-cache@v2
with:
shared-key: check
shared-key: ci

- name: Run cargo check
run: cargo check --workspace --all-targets --all-features --release --locked
Expand All @@ -78,14 +78,20 @@ jobs:
files: .

check-dependencies:
name: Check Dependencies
name: Check Unused Dependencies
runs-on: ubuntu-latest
env:
SCCACHE_GHA_ENABLED: ""
RUSTC_WRAPPER: ""
steps:
- name: Checkout PR Branch
uses: actions/checkout@v3

- name: Install Rust Toolchain
- name: Install Rust
uses: ./.github/actions/rustup
with:
shared-key: ci
sccache: false

- name: Install cargo-udeps
uses: taiki-e/install-action@v2
Expand All @@ -109,19 +115,16 @@ jobs:
- name: Checkout
uses: actions/checkout@v3

- name: Install Rust Toolchain
- name: Install Rust
uses: ./.github/actions/rustup
with:
shared-key: ci

- name: Install cargo-nextest
uses: taiki-e/install-action@v2
with:
tool: cargo-nextest

- name: Cache
uses: Swatinem/rust-cache@v2
with:
shared-key: check

- name: Build tests
run: cargo nextest run --no-run --locked

Expand Down
1 change: 1 addition & 0 deletions crates/oxc_parser/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ impl<'a> Parser<'a> {
/// Create a new parser
#[must_use]
pub fn new(allocator: &'a Allocator, source_text: &'a str, source_type: SourceType) -> Self {
println!("a");
Self {
lexer: Lexer::new(allocator, source_text, source_type),
source_type,
Expand Down