Skip to content

Commit 8b32606

Browse files
authored
chore: add release crates workflow (#10903)
1 parent a31aa40 commit 8b32606

File tree

97 files changed

+445
-238
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

97 files changed

+445
-238
lines changed

.github/workflows/ci-rust.yaml

Lines changed: 7 additions & 110 deletions
Original file line numberDiff line numberDiff line change
@@ -18,112 +18,9 @@ on:
1818
tags-ignore:
1919
- "**"
2020
jobs:
21-
check-changed:
22-
runs-on: ubuntu-latest
23-
name: Check Source Changed
24-
outputs:
25-
code_changed: ${{ steps.filter.outputs.code_changed == 'true' }}
26-
document_changed: ${{ steps.filter.outputs.document_changed == 'true' }}
27-
steps:
28-
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
29-
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3
30-
id: filter
31-
with:
32-
predicate-quantifier: "every"
33-
filters: |
34-
code_changed:
35-
- "!**/*.md"
36-
- "!**/*.mdx"
37-
- "!website/**"
38-
document_changed:
39-
- "website/**"
40-
rust_check:
41-
name: Rust check
42-
needs: [check-changed]
43-
if: ${{ needs.check-changed.outputs.code_changed == 'true' }}
44-
runs-on: ${{ fromJSON(vars.LINUX_SELF_HOSTED_RUNNER_LABELS || '"ubuntu-22.04"') }}
45-
steps:
46-
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
47-
48-
- name: Install Rust Toolchain
49-
uses: ./.github/actions/rustup
50-
with:
51-
save-if: true
52-
key: check
53-
54-
- name: Run Cargo Check
55-
run: cargo check --workspace --all-targets --locked # Not using --release because it uses too much cache, and is also slow.
56-
57-
- name: Run Clippy
58-
uses: actions-rs/cargo@844f36862e911db73fe0815f00a4a2602c279505 # v1
59-
with:
60-
command: clippy
61-
args: --workspace --all-targets --tests -- -D warnings
62-
63-
- name: Run rustfmt
64-
uses: actions-rs/cargo@844f36862e911db73fe0815f00a4a2602c279505 # v1
65-
with:
66-
command: fmt
67-
args: --all -- --check
68-
69-
- name: Install tapo
70-
run: cargo install taplo-cli --locked
71-
- name: Run toml format check
72-
run: taplo format --check '.cargo/*.toml' './crates/**/Cargo.toml' './Cargo.toml'
73-
74-
rust_unused_dependencies:
75-
needs: [check-changed]
76-
if: ${{ needs.check-changed.outputs.code_changed == 'true' }}
77-
name: Check Rust Dependencies
78-
runs-on: ${{ fromJSON(vars.LINUX_SELF_HOSTED_RUNNER_LABELS || '"ubuntu-22.04"') }}
79-
steps:
80-
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
81-
- uses: ./.github/actions/rustup
82-
with:
83-
key: check
84-
85-
- name: Install cargo-deny
86-
uses: taiki-e/install-action@726a5c9e4be3a589bab5f60185f0cdde7ed4498e # v2
87-
with:
88-
tool: cargo-deny@0.16
89-
- name: Check licenses
90-
run: cargo deny check license bans
91-
92-
- uses: cargo-bins/cargo-binstall@8aac5aa2bf0dfaa2863eccad9f43c68fe40e5ec8 # v1.14.1
93-
- run: cargo binstall --no-confirm cargo-shear@1.1.12 --force
94-
- run: cargo shear
95-
96-
rust_test:
97-
name: Rust test
98-
runs-on: ${{ fromJSON(vars.LINUX_SELF_HOSTED_RUNNER_LABELS || '"ubuntu-22.04"') }}
99-
needs: [check-changed]
100-
if: ${{ needs.check-changed.outputs.code_changed == 'true' }}
101-
steps:
102-
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
103-
104-
- name: Install Rust Toolchain
105-
uses: ./.github/actions/rustup
106-
with:
107-
save-if: true
108-
key: test
109-
110-
# Compile test without debug info for reducing the CI cache size
111-
- name: Change profile.test
112-
shell: bash
113-
run: |
114-
echo '[profile.test]' >> Cargo.toml
115-
echo 'debug = false' >> Cargo.toml
116-
- name: Run rspack test
117-
run: |
118-
cargo test --workspace \
119-
--exclude rspack_binding_api \
120-
--exclude rspack_node \
121-
--exclude rspack_binding_builder \
122-
--exclude rspack_binding_builder_macros \
123-
--exclude rspack_binding_builder_testing \
124-
--exclude rspack_binding_build \
125-
--exclude rspack_napi \
126-
-- --nocapture
21+
rust_tests:
22+
name: Run Rust Tests
23+
uses: ./.github/workflows/reusable-rust-test.yml
12724

12825
rust_test_miri:
12926
name: Rust test miri
@@ -158,14 +55,14 @@ jobs:
15855
# When code changed, it will check if any of the test jobs failed.
15956
# When *only* doc changed, it will run as success directly
16057
name: Rust Test Required Check
161-
needs: [rust_test, rust_check, check-changed]
58+
needs: [rust_tests]
16259
if: ${{ always() && !cancelled() }}
16360
runs-on: ubuntu-latest
16461
steps:
16562
- name: Log
166-
run: echo ${{ join(needs.*.result, ',') }}
63+
run: echo ${{ needs.*.result }}
16764
- name: Test check
168-
if: ${{ needs.check-changed.outputs.code_changed == 'true' && join(needs.*.result, ',')!='success,success,success' }}
169-
run: echo "Tess Failed" && exit 1
65+
if: ${{ needs.rust_tests.result != 'success' }}
66+
run: echo "Tests Failed" && exit 1
17067
- name: No check to Run test
17168
run: echo "Success"

.github/workflows/release-crates.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Release Crates
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
dry_run:
7+
type: boolean
8+
description: "DryRun release"
9+
required: true
10+
default: false
11+
push_tags:
12+
type: boolean
13+
description: "Push tags to repository"
14+
required: true
15+
default: true
16+
17+
jobs:
18+
rust_tests:
19+
name: Run Rust Tests
20+
uses: ./.github/workflows/reusable-rust-test.yml
21+
22+
release_crates:
23+
environment: crate
24+
name: Release Crates
25+
runs-on: ubuntu-latest
26+
needs: [rust_tests]
27+
if: ${{ github.event_name == 'workflow_dispatch' }}
28+
steps:
29+
- name: Checkout Repo
30+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
31+
with:
32+
fetch-depth: 0
33+
34+
- name: Install Rust Toolchain
35+
uses: ./.github/actions/rustup
36+
with:
37+
save-if: true
38+
key: release
39+
40+
- name: Install cargo-workspaces
41+
run: cargo install cargo-workspaces --locked
42+
43+
- name: Publish Crates
44+
run: |
45+
./x crate-publish --token $CARGO_REGISTRY_TOKEN ${{ inputs.dry_run && '--dry-run' || '' }} ${{ inputs.push_tags && '--push-tags' || '' }}
46+
env:
47+
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
name: Reusable Rust Test
2+
3+
on:
4+
workflow_call:
5+
6+
jobs:
7+
check-changed:
8+
runs-on: ubuntu-latest
9+
name: Check Source Changed
10+
outputs:
11+
code_changed: ${{ steps.filter.outputs.code_changed == 'true' }}
12+
document_changed: ${{ steps.filter.outputs.document_changed == 'true' }}
13+
steps:
14+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
15+
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3
16+
id: filter
17+
with:
18+
filters: |
19+
code_changed:
20+
- "!**/*.md"
21+
- "!**/*.mdx"
22+
- "!website/**"
23+
document_changed:
24+
- "website/**"
25+
26+
rust_check:
27+
name: Rust check
28+
needs: [check-changed]
29+
if: ${{ needs.check-changed.outputs.code_changed == 'true' }}
30+
runs-on: ${{ fromJSON(vars.LINUX_SELF_HOSTED_RUNNER_LABELS || '"ubuntu-22.04"') }}
31+
steps:
32+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
33+
34+
- name: Install Rust Toolchain
35+
uses: ./.github/actions/rustup
36+
with:
37+
save-if: true
38+
key: check
39+
40+
- name: Run Cargo Check
41+
run: cargo check --workspace --all-targets --locked
42+
43+
- name: Run Clippy
44+
uses: actions-rs/cargo@844f36862e911db73fe0815f00a4a2602c279505 # v1
45+
with:
46+
command: clippy
47+
args: --workspace --all-targets --tests -- -D warnings
48+
49+
- name: Run rustfmt
50+
uses: actions-rs/cargo@844f36862e911db73fe0815f00a4a2602c279505 # v1
51+
with:
52+
command: fmt
53+
args: --all -- --check
54+
55+
- name: Install tapo
56+
run: cargo install taplo-cli --locked
57+
- name: Run toml format check
58+
run: taplo format --check '.cargo/*.toml' './crates/**/Cargo.toml' './Cargo.toml'
59+
60+
rust_unused_dependencies:
61+
needs: [check-changed]
62+
if: ${{ needs.check-changed.outputs.code_changed == 'true' }}
63+
name: Check Rust Dependencies
64+
runs-on: ${{ fromJSON(vars.LINUX_SELF_HOSTED_RUNNER_LABELS || '"ubuntu-22.04"') }}
65+
steps:
66+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
67+
- uses: ./.github/actions/rustup
68+
with:
69+
key: check
70+
71+
- name: Install cargo-deny
72+
uses: taiki-e/install-action@726a5c9e4be3a589bab5f60185f0cdde7ed4498e # v2
73+
with:
74+
tool: cargo-deny@0.16
75+
- name: Check licenses
76+
run: cargo deny check license bans
77+
78+
- uses: cargo-bins/cargo-binstall@8aac5aa2bf0dfaa2863eccad9f43c68fe40e5ec8 # v1.14.1
79+
- run: cargo binstall --no-confirm cargo-shear@1.1.12 --force
80+
- run: cargo shear
81+
82+
rust_test:
83+
name: Rust test
84+
runs-on: ${{ fromJSON(vars.LINUX_SELF_HOSTED_RUNNER_LABELS || '"ubuntu-22.04"') }}
85+
needs: [check-changed]
86+
if: ${{ needs.check-changed.outputs.code_changed == 'true' }}
87+
steps:
88+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
89+
90+
- name: Install Rust Toolchain
91+
uses: ./.github/actions/rustup
92+
with:
93+
save-if: true
94+
key: test
95+
96+
# Compile test without debug info for reducing the CI cache size
97+
- name: Change profile.test
98+
shell: bash
99+
run: |
100+
echo '[profile.test]' >> Cargo.toml
101+
echo 'debug = false' >> Cargo.toml
102+
- name: Run rspack test
103+
run: |
104+
cargo test --workspace \
105+
--exclude rspack_binding_api \
106+
--exclude rspack_node \
107+
--exclude rspack_binding_builder \
108+
--exclude rspack_binding_builder_macros \
109+
--exclude rspack_binding_builder_testing \
110+
--exclude rspack_binding_build \
111+
--exclude rspack_napi \
112+
-- --nocapture
113+
114+
test_required_check:
115+
name: Rust Test Required Check
116+
needs: [rust_test, rust_check, rust_unused_dependencies, check-changed]
117+
if: ${{ always() && !cancelled() }}
118+
runs-on: ubuntu-latest
119+
steps:
120+
- name: Log
121+
run: echo ${{ join(needs.*.result, ',') }}
122+
- name: Test check
123+
if: ${{ needs.check-changed.outputs.code_changed == 'true' && join(needs.*.result, ',')!='success,success,success,success' }}
124+
run: echo "Tests Failed" && exit 1
125+
- name: No check to Run test
126+
run: echo "Success"

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 3 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,10 @@ edition = "2021"
1010
homepage = "https://rspack.rs/"
1111
license = "MIT"
1212
repository = "https://github.com/web-infra-dev/rspack"
13+
version = "0.2.0"
1314

1415
[workspace.metadata.cargo-shear]
15-
ignored = [
16-
"swc",
17-
"rspack_plugin_dynamic",
18-
"rspack_builtin",
19-
"rspack_loader",
20-
"rspack_identifier",
21-
"rspack_testing",
22-
"rspack_plugin_emit",
23-
"rspack_collection",
24-
"rspack_deps_graph",
25-
"rspack_plugin_mini_css_extract",
26-
"rspack_binding",
27-
"rspack_plugin_merge",
28-
"rspack",
29-
]
16+
ignored = ["swc", "rspack"]
3017
[workspace.dependencies]
3118
anyhow = { version = "1.0.95", features = ["backtrace"] }
3219
anymap = { package = "anymap3", version = "1.0.1" }
@@ -122,21 +109,16 @@ rspack_binding_build = { version = "0.2.0", path = "crates/rsp
122109
rspack_binding_builder = { version = "0.2.0", path = "crates/rspack_binding_builder" }
123110
rspack_binding_builder_macros = { version = "0.2.0", path = "crates/rspack_binding_builder_macros" }
124111
rspack_browserslist = { version = "0.2.0", path = "crates/rspack_browserslist" }
125-
rspack_builtin = { version = "0.2.0", path = "crates/rspack_builtin" }
126112
rspack_cacheable = { version = "0.2.0", path = "crates/rspack_cacheable" }
127-
rspack_collection = { version = "0.2.0", path = "crates/rspack_collection" }
128113
rspack_collections = { version = "0.2.0", path = "crates/rspack_collections" }
129114
rspack_core = { version = "0.2.0", path = "crates/rspack_core" }
130-
rspack_deps_graph = { version = "0.2.0", path = "crates/rspack_deps_graph" }
131115
rspack_error = { version = "0.2.0", path = "crates/rspack_error" }
132116
rspack_fs = { version = "0.2.0", path = "crates/rspack_fs" }
133117
rspack_futures = { version = "0.2.0", path = "crates/rspack_futures" }
134118
rspack_hash = { version = "0.2.0", path = "crates/rspack_hash" }
135119
rspack_hook = { version = "0.2.0", path = "crates/rspack_hook" }
136-
rspack_identifier = { version = "0.2.0", path = "crates/rspack_identifier" }
137120
rspack_ids = { version = "0.2.0", path = "crates/rspack_ids" }
138-
rspack_javascript_compiler = { version = "*", path = "crates/rspack_javascript_compiler" }
139-
rspack_loader = { version = "0.2.0", path = "crates/rspack_loader" }
121+
rspack_javascript_compiler = { version = "0.2.0", path = "crates/rspack_javascript_compiler" }
140122
rspack_loader_lightningcss = { version = "0.2.0", path = "crates/rspack_loader_lightningcss" }
141123
rspack_loader_preact_refresh = { version = "0.2.0", path = "crates/rspack_loader_preact_refresh" }
142124
rspack_loader_react_refresh = { version = "0.2.0", path = "crates/rspack_loader_react_refresh" }
@@ -157,9 +139,7 @@ rspack_plugin_css = { version = "0.2.0", path = "crates/rsp
157139
rspack_plugin_css_chunking = { version = "0.2.0", path = "crates/rspack_plugin_css_chunking" }
158140
rspack_plugin_devtool = { version = "0.2.0", path = "crates/rspack_plugin_devtool" }
159141
rspack_plugin_dll = { version = "0.2.0", path = "crates/rspack_plugin_dll" }
160-
rspack_plugin_dynamic = { version = "0.2.0", path = "crates/rspack_plugin_dynamic" }
161142
rspack_plugin_dynamic_entry = { version = "0.2.0", path = "crates/rspack_plugin_dynamic_entry" }
162-
rspack_plugin_emit = { version = "0.2.0", path = "crates/rspack_plugin_emit" }
163143
rspack_plugin_ensure_chunk_conditions = { version = "0.2.0", path = "crates/rspack_plugin_ensure_chunk_conditions" }
164144
rspack_plugin_entry = { version = "0.2.0", path = "crates/rspack_plugin_entry" }
165145
rspack_plugin_externals = { version = "0.2.0", path = "crates/rspack_plugin_externals" }
@@ -173,10 +153,8 @@ rspack_plugin_lazy_compilation = { version = "0.2.0", path = "crates/rsp
173153
rspack_plugin_library = { version = "0.2.0", path = "crates/rspack_plugin_library" }
174154
rspack_plugin_lightning_css_minimizer = { version = "0.2.0", path = "crates/rspack_plugin_lightning_css_minimizer" }
175155
rspack_plugin_limit_chunk_count = { version = "0.2.0", path = "crates/rspack_plugin_limit_chunk_count" }
176-
rspack_plugin_merge = { version = "0.2.0", path = "crates/rspack_plugin_merge" }
177156
rspack_plugin_merge_duplicate_chunks = { version = "0.2.0", path = "crates/rspack_plugin_merge_duplicate_chunks" }
178157
rspack_plugin_mf = { version = "0.2.0", path = "crates/rspack_plugin_mf" }
179-
rspack_plugin_mini_css_extract = { version = "0.2.0", path = "crates/rspack_plugin_mini_css_extract" }
180158
rspack_plugin_module_info_header = { version = "0.2.0", path = "crates/rspack_plugin_module_info_header" }
181159
rspack_plugin_no_emit_on_errors = { version = "0.2.0", path = "crates/rspack_plugin_no_emit_on_errors" }
182160
rspack_plugin_progress = { version = "0.2.0", path = "crates/rspack_plugin_progress" }
@@ -202,7 +180,6 @@ rspack_storage = { version = "0.2.0", path = "crates/rsp
202180
rspack_swc_plugin_import = { version = "0.2.0", path = "crates/swc_plugin_import" }
203181
rspack_swc_plugin_ts_collector = { version = "0.2.0", path = "crates/swc_plugin_ts_collector" }
204182
rspack_tasks = { version = "0.2.0", path = "crates/rspack_tasks" }
205-
rspack_testing = { version = "0.2.0", path = "crates/rspack_testing" }
206183
rspack_tracing = { version = "0.2.0", path = "crates/rspack_tracing" }
207184
rspack_tracing_perfetto = { version = "0.2.0", path = "crates/rspack_tracing_perfetto" }
208185
rspack_util = { version = "0.2.0", path = "crates/rspack_util" }

0 commit comments

Comments
 (0)