-
-
Notifications
You must be signed in to change notification settings - Fork 843
139 lines (122 loc) 路 4.41 KB
/
Copy pathci-resolver.yml
File metadata and controls
139 lines (122 loc) 路 4.41 KB
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
name: CI-Resolver
on:
pull_request:
types: [opened, synchronize]
merge_group:
types: [checks_requested]
workflow_dispatch:
push:
branches:
- main
paths:
- 'crates/rspack_resolver/**'
- '.github/workflows/ci-resolver.yml'
- 'Cargo.lock'
- 'Cargo.toml'
- 'rust-toolchain.toml'
tags-ignore:
- '**'
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: ${{ github.ref_name != 'main' }}
permissions:
contents: read
jobs:
check-changed:
runs-on: ${{ fromJSON(vars.CI_LINUX_MINI_RUNNER || '"ubuntu-latest"') }}
name: Check Resolver Changed
outputs:
changed: ${{ steps.filter.outputs.changed == 'true' }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
- uses: dorny/paths-filter@7b450fff21473bca461d4b92ce414b9d0420d706 # v4
id: filter
with:
filters: |
changed:
- 'crates/rspack_resolver/**'
- '.github/workflows/ci-resolver.yml'
- 'Cargo.lock'
- 'Cargo.toml'
- 'rust-toolchain.toml'
test:
name: Resolver test
needs: [check-changed]
if: ${{ needs.check-changed.outputs.changed == 'true' }}
strategy:
fail-fast: false # run all tests even if some fail
matrix:
array:
- runner: ${{ vars.LINUX_SELF_HOSTED_RUNNER_LABELS || '"ubuntu-22.04"' }}
- runner: ${{ '"windows-latest"' }}
- runner: ${{ '"macos-latest"' }}
runs-on: ${{ fromJSON(matrix.array.runner) }}
env:
RUST_BACKTRACE: 1
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
- name: Disable CPU hogs (Windows)
if: runner.os == 'Windows'
continue-on-error: true
uses: ./.github/actions/windows-disable-cpu-hogs
- name: Install Rust Toolchain
uses: ./.github/actions/rustup
with:
save-if: true
key: test-resolver-${{ matrix.array.runner }}
- name: Setup Node.js and Pnpm
uses: ./.github/actions/pnpm/setup
- name: Install fixtures
shell: bash
working-directory: crates/rspack_resolver/fixtures
run: |
pushd pnp && yarn install && popd
pushd pnp-global-cache-enabled && yarn install && popd
pnpm install
# 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 resolver test
run: cargo test -p rspack_resolver --all-features -- --nocapture
env:
RUST_MIN_STACK: 8388608
- name: Run resolver doc test
run: cargo test -p rspack_resolver --doc
check:
name: Resolver check
needs: [check-changed]
if: ${{ needs.check-changed.outputs.changed == 'true' }}
runs-on: ${{ fromJSON(vars.LINUX_SELF_HOSTED_RUNNER_LABELS || '"ubuntu-22.04"') }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
- name: Install Rust Toolchain
uses: ./.github/actions/rustup
with:
save-if: true
key: check-resolver
# The shared rust test workflow lints the workspace with default
# features; this adds coverage for the crate's optional features.
- name: Run Clippy
run: cargo clippy -p rspack_resolver --all-targets --all-features --locked -- -D warnings
- name: Check wasm32
run: |
rustup target add wasm32-unknown-unknown
cargo check -p rspack_resolver --all-features --target wasm32-unknown-unknown --locked
resolver_required_check:
# this job is used as the required status check for branch protection;
# it succeeds directly when resolver files are unchanged.
name: Resolver Required Check
needs: [check-changed, test, check]
if: ${{ always() && !cancelled() }}
runs-on: ${{ fromJSON(vars.CI_LINUX_MINI_RUNNER || '"ubuntu-latest"') }}
steps:
- name: Log
run: echo ${{ join(needs.*.result, ',') }}
- name: Test check
if: ${{ needs.check-changed.outputs.changed == 'true' && (needs.test.result != 'success' || needs.check.result != 'success') }}
run: echo "Resolver CI Failed" && exit 1
- name: No check to run
run: echo "Success"