-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: add ci workflows * fix: update ci * fix: test ci * fix: test ci * fix: test ci * test: ci * test: ci * test: update path * fix: ci debug * test: ci debug * fix: test ci * fix: update yaml * fix: ref * fix: undefined spinner * fix: ci * feat: add release workflow * fix: toolchain * fix: config * fix: ci * test: ci * fix: test ci * fix: add lock file
- Loading branch information
Showing
18 changed files
with
7,289 additions
and
2,427 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
name: clone crates | ||
|
||
description: clone rspack crates for github | ||
|
||
inputs: | ||
repo: | ||
default: 'web-infra-dev/rspack' | ||
required: false | ||
type: string | ||
dest: | ||
default: 'crates/.rspack_crates' | ||
required: false | ||
type: string | ||
ref: | ||
default: 'v0.3.6' | ||
required: false | ||
type: string | ||
temp: | ||
default: 'crates/.rspack_crates/.temp' | ||
required: false | ||
type: string | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: Clone Repo | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: web-infra-dev/rspack | ||
path: ${{ inputs.temp }} | ||
ref: ${{ inputs.ref }} | ||
|
||
- name: Clean up | ||
shell: bash | ||
run: node scripts/clean.mjs | ||
env: | ||
IS_GITHUB: true |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
name: pnpm cache | ||
|
||
description: Install Node.js with pnpm global cache | ||
|
||
inputs: | ||
node-version: | ||
default: '18' | ||
required: false | ||
type: string | ||
save-if: | ||
default: false | ||
required: false | ||
type: boolean | ||
|
||
env: | ||
IS_GITHUB_RUNNER: startsWith(runner.name, 'GitHub Actions') | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: Install Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: ${{ inputs.node-version }} | ||
check-latest: true | ||
|
||
# https://pnpm.io/continuous-integration#github-actions | ||
# Uses `packageManagement` field from package.json | ||
- name: Install pnpm | ||
uses: pnpm/action-setup@v2 | ||
with: | ||
dest: ${{ runner.tool_cache }}/pnpm | ||
|
||
- name: Get pnpm store directory | ||
id: pnpm-cache | ||
shell: bash | ||
run: echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT | ||
|
||
- name: Restore pnpm cache | ||
id: restore | ||
if: ${{ env.IS_GITHUB_RUNNER }} | ||
uses: actions/cache/restore@v3 | ||
with: | ||
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }} | ||
key: node-cache-${{ runner.os }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }} | ||
restore-keys: | | ||
node-cache-${{ runner.os }}-pnpm- | ||
- name: Install dependencies | ||
shell: bash | ||
run: pnpm install --no-frozen-lockfile | ||
|
||
- name: Save pnpm cache | ||
uses: actions/cache/save@v3 | ||
if: ${{ env.IS_GITHUB_RUNNER && inputs.save-if == 'true' && steps.restore.outputs.cache-hit != 'true' }} | ||
with: | ||
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }} | ||
key: node-cache-${{ runner.os }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
# This action installs the minimal Rust profile and configures Swatinem/rust-cache. | ||
# | ||
# It is needed to install as few Rust components as possbile because | ||
# it takes a few minutes to install some of components on Windows and Mac, especially rust-doc. | ||
|
||
name: Rustup | ||
|
||
description: Install Rust with cache | ||
|
||
inputs: | ||
# See https://rust-lang.github.io/rustup/concepts/components.html | ||
clippy: | ||
default: false | ||
required: false | ||
type: boolean | ||
fmt: | ||
default: false | ||
required: false | ||
type: boolean | ||
docs: | ||
default: false | ||
required: false | ||
type: boolean | ||
save-cache: | ||
default: false | ||
required: false | ||
type: boolean | ||
shared-key: | ||
default: 'check' | ||
required: false | ||
type: string | ||
|
||
env: | ||
IS_GITHUB_RUNNER: startsWith(runner.name, 'GitHub Actions') | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: Print Inputs | ||
shell: bash | ||
run: | | ||
echo 'clippy: ${{ inputs.clippy }}' | ||
echo 'fmt: ${{ inputs.fmt }}' | ||
echo 'docs: ${{ inputs.docs }}' | ||
echo 'save-cache: ${{ inputs.save-cache }}' | ||
echo 'shared-key: ${{ inputs.shared-key }}' | ||
- name: Remove `profile` line on MacOS | ||
shell: bash | ||
if: runner.os == 'macOS' | ||
run: sed -i '' '/profile/d' rust-toolchain.toml | ||
|
||
- name: Remove `profile` line on non-MacOS | ||
shell: bash | ||
if: runner.os != 'macOS' | ||
run: sed -i '/profile/d' rust-toolchain.toml | ||
|
||
- name: Set minimal | ||
shell: bash | ||
run: rustup set profile minimal | ||
|
||
- name: Add Clippy | ||
shell: bash | ||
if: ${{ inputs.clippy == 'true' }} | ||
run: rustup component add clippy | ||
|
||
- name: Add Rustfmt | ||
shell: bash | ||
if: ${{ inputs.fmt == 'true' }} | ||
run: rustup component add rustfmt | ||
|
||
- name: Add docs | ||
shell: bash | ||
if: ${{ inputs.docs == 'true' }} | ||
run: rustup component add rust-docs | ||
|
||
- name: Install | ||
shell: bash | ||
run: rustup show | ||
|
||
- name: Cache on ${{ github.ref_name }} | ||
uses: Swatinem/rust-cache@v2 | ||
if: ${{ env.IS_GITHUB_RUNNER }} | ||
with: | ||
shared-key: ${{ inputs.shared-key }} | ||
save-if: ${{ inputs.save-cache == 'true' }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
name: CI | ||
|
||
on: | ||
merge_group: | ||
types: [checks_requested] | ||
workflow_dispatch: | ||
inputs: | ||
debug_enabled: | ||
type: boolean | ||
description: "Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)" | ||
required: false | ||
default: false | ||
pull_request: | ||
types: [opened, synchronize] | ||
paths-ignore: | ||
- "**/*.md" | ||
branches-ignore: | ||
- "release-**" | ||
push: | ||
branches: | ||
- main | ||
paths-ignore: | ||
- "**/*.md" | ||
tags-ignore: | ||
- "**" | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | ||
cancel-in-progress: ${{ github.ref_name != 'main' }} | ||
|
||
jobs: | ||
rust_changes: | ||
name: Rust Changes | ||
runs-on: ubuntu-latest | ||
outputs: | ||
changed: ${{ steps.filter.outputs.changed }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: dorny/paths-filter@v2 | ||
id: filter | ||
with: | ||
filters: | | ||
changed: | ||
- '.github/workflows/ci.yml' | ||
- 'crates/**' | ||
- 'Cargo.lock' | ||
- 'Cargo.toml' | ||
- 'rust-toolchain.toml' | ||
# rust_check: | ||
# name: Rust check | ||
# needs: rust_changes | ||
# if: ${{ needs.rust_changes.outputs.changed == 'true' }} | ||
# runs-on: ${{ fromJSON(vars.LINUX_RUNNER_LABELS || '"ubuntu-latest"') }} | ||
# steps: | ||
# - uses: actions/checkout@v4 | ||
|
||
# - name: Pnpm Cache # Required by some tests | ||
# uses: ./.github/actions/pnpm-cache | ||
|
||
# - name: Clone Crates | ||
# uses: ./.github/actions/clone-crates | ||
|
||
# - name: Install Rust Toolchain | ||
# uses: ./.github/actions/rustup | ||
# with: | ||
# clippy: true | ||
# fmt: true | ||
# shared-key: check | ||
|
||
# - name: Run Cargo Check | ||
# run: cargo check --workspace --all-targets # Not using --release because it uses too much cache, and is also slow. | ||
|
||
rust_test: | ||
name: Rust test | ||
needs: rust_changes | ||
if: ${{ needs.rust_changes.outputs.changed == 'true' }} | ||
runs-on: ${{ fromJSON(vars.LINUX_RUNNER_LABELS || '"ubuntu-latest"') }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Pnpm Cache # Required by some tests | ||
uses: ./.github/actions/pnpm-cache | ||
|
||
- name: Clone Crates | ||
uses: ./.github/actions/clone-crates | ||
|
||
- name: Install Rust Toolchain | ||
uses: ./.github/actions/rustup | ||
with: | ||
save-cache: ${{ github.ref_name == 'main' }} | ||
shared-key: check | ||
|
||
# Compile test without debug info for reducing the CI cache size | ||
- name: Change profile.test | ||
shell: bash | ||
run: | | ||
echo '[profile.test]' >> Cargo.toml | ||
echo 'debug = false' >> Cargo.toml | ||
- name: Run test | ||
run: pnpm test |
Oops, something went wrong.