Skip to content

Commit 5586e4f

Browse files
authored
fix(crc32,denolint): upgrade rust toolchain (#787)
1 parent ab1f977 commit 5586e4f

File tree

20 files changed

+140
-112
lines changed

20 files changed

+140
-112
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: 'Setup Rust'
2+
description: 'Set up the Rust toolchain'
3+
inputs:
4+
targets:
5+
description: 'The target to install'
6+
required: true
7+
components:
8+
description: 'The components to install'
9+
required: false
10+
runs:
11+
using: 'composite'
12+
steps:
13+
- name: Print rustup toolchain version
14+
shell: bash
15+
id: rustup-version
16+
run: |
17+
export RUST_TOOLCHAIN_VERSION="$(grep 'channel' rust-toolchain.toml | head -1 | awk -F '"' '{print $2}')"
18+
echo "Rust toolchain version: $RUST_TOOLCHAIN_VERSION"
19+
echo "RUST_TOOLCHAIN_VERSION=$RUST_TOOLCHAIN_VERSION" >> "$GITHUB_OUTPUT"
20+
- name: Install
21+
uses: dtolnay/rust-toolchain@stable
22+
with:
23+
targets: ${{ inputs.targets }}
24+
toolchain: ${{ steps.rustup-version.outputs.RUST_TOOLCHAIN_VERSION }}
25+
components: ${{ inputs.components }}

.github/workflows/ci.yaml

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,37 @@ on:
1818
pull_request:
1919

2020
jobs:
21+
lint:
22+
name: Lint
23+
runs-on: ubuntu-latest
24+
steps:
25+
- uses: actions/checkout@v4
26+
27+
- name: Setup node
28+
uses: actions/setup-node@v4
29+
with:
30+
node-version: 20
31+
32+
- name: Install
33+
uses: ./.github/actions/setup-rust
34+
with:
35+
targets: x86_64-unknown-linux-gnu
36+
components: rustfmt, clippy
37+
38+
- name: 'Install dependencies'
39+
run: yarn install --mode=skip-build
40+
41+
- name: ESLint
42+
run: yarn lint
43+
44+
- name: TypeCheck
45+
run: yarn typecheck
46+
47+
- name: Cargo fmt
48+
run: cargo fmt -- --check
49+
50+
- name: Clippy
51+
run: cargo clippy
2152
build:
2253
strategy:
2354
fail-fast: false
@@ -87,9 +118,8 @@ jobs:
87118
cache: yarn
88119

89120
- name: Install
90-
uses: dtolnay/rust-toolchain@stable
121+
uses: ./.github/actions/setup-rust
91122
with:
92-
toolchain: nightly-2023-12-23
93123
targets: ${{ matrix.settings.target }}
94124

95125
- name: Cache cargo registry
@@ -175,7 +205,8 @@ jobs:
175205
sudo pkg install -y -f curl node libnghttp2 npm
176206
sudo npm install -g yarn --ignore-scripts
177207
curl https://sh.rustup.rs -sSf --output rustup.sh
178-
sh rustup.sh -y --default-toolchain nightly-2023-12-23
208+
export RUST_TOOLCHAIN_VERSION="$(grep 'channel' rust-toolchain.toml | head -1 | awk -F '"' '{print $2}')"
209+
sh rustup.sh -y --default-toolchain "${RUST_TOOLCHAIN_VERSION}"
179210
source "$HOME/.cargo/env"
180211
echo "~~~~ rustc --version ~~~~"
181212
rustc --version
@@ -570,6 +601,7 @@ jobs:
570601
name: Publish
571602
runs-on: ubuntu-latest
572603
needs:
604+
- lint
573605
- build-freebsd
574606
- test-linux-x64-gnu-binding
575607
- test-linux-x64-centos-7

.github/workflows/lint.yaml

Lines changed: 0 additions & 42 deletions
This file was deleted.

packages/argon2/build.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
extern crate napi_build;
2-
31
fn main() {
42
napi_build::setup();
53
}

packages/bcrypt/binding.d.ts

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,11 @@ export function genSalt(round: number, version?: '2a' | '2x' | '2y' | '2b', sign
77

88
export function genSaltSync(round: number, version?: '2a' | '2x' | '2y' | '2b'): string
99

10-
export function hash(
11-
input: string | Buffer,
12-
cost?: number | undefined | null,
13-
salt?: Buffer | undefined | null,
14-
signal?: AbortSignal | undefined | null,
15-
): Promise<string>
16-
17-
export function hashSync(
18-
input: string | Buffer,
19-
cost?: number | undefined | null,
20-
salt?: Buffer | undefined | null,
21-
): string
22-
23-
export function verify(
24-
password: string | Buffer,
25-
hash: string | Buffer,
26-
signal?: AbortSignal | undefined | null,
27-
): Promise<boolean>
10+
export function hash(input: string | Buffer, cost?: number | undefined | null, salt?: Buffer | undefined | null, signal?: AbortSignal | undefined | null): Promise<string>
11+
12+
export function hashSync(input: string | Buffer, cost?: number | undefined | null, salt?: Buffer | undefined | null): string
13+
14+
export function verify(password: string | Buffer, hash: string | Buffer, signal?: AbortSignal | undefined | null): Promise<boolean>
2815

2916
export function verifySync(input: string | Buffer, hash: string | Buffer): boolean
17+

packages/bcrypt/binding.js

Lines changed: 36 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,9 @@ switch (platform) {
9494
case 'win32':
9595
switch (arch) {
9696
case 'x64':
97-
localFileExisted = existsSync(join(__dirname, 'bcrypt.win32-x64-msvc.node'))
97+
localFileExisted = existsSync(
98+
join(__dirname, 'bcrypt.win32-x64-msvc.node')
99+
)
98100
try {
99101
if (localFileExisted) {
100102
nativeBinding = require('./bcrypt.win32-x64-msvc.node')
@@ -106,7 +108,9 @@ switch (platform) {
106108
}
107109
break
108110
case 'ia32':
109-
localFileExisted = existsSync(join(__dirname, 'bcrypt.win32-ia32-msvc.node'))
111+
localFileExisted = existsSync(
112+
join(__dirname, 'bcrypt.win32-ia32-msvc.node')
113+
)
110114
try {
111115
if (localFileExisted) {
112116
nativeBinding = require('./bcrypt.win32-ia32-msvc.node')
@@ -118,7 +122,9 @@ switch (platform) {
118122
}
119123
break
120124
case 'arm64':
121-
localFileExisted = existsSync(join(__dirname, 'bcrypt.win32-arm64-msvc.node'))
125+
localFileExisted = existsSync(
126+
join(__dirname, 'bcrypt.win32-arm64-msvc.node')
127+
)
122128
try {
123129
if (localFileExisted) {
124130
nativeBinding = require('./bcrypt.win32-arm64-msvc.node')
@@ -157,7 +163,9 @@ switch (platform) {
157163
}
158164
break
159165
case 'arm64':
160-
localFileExisted = existsSync(join(__dirname, 'bcrypt.darwin-arm64.node'))
166+
localFileExisted = existsSync(
167+
join(__dirname, 'bcrypt.darwin-arm64.node')
168+
)
161169
try {
162170
if (localFileExisted) {
163171
nativeBinding = require('./bcrypt.darwin-arm64.node')
@@ -191,7 +199,9 @@ switch (platform) {
191199
switch (arch) {
192200
case 'x64':
193201
if (isMusl()) {
194-
localFileExisted = existsSync(join(__dirname, 'bcrypt.linux-x64-musl.node'))
202+
localFileExisted = existsSync(
203+
join(__dirname, 'bcrypt.linux-x64-musl.node')
204+
)
195205
try {
196206
if (localFileExisted) {
197207
nativeBinding = require('./bcrypt.linux-x64-musl.node')
@@ -202,7 +212,9 @@ switch (platform) {
202212
loadError = e
203213
}
204214
} else {
205-
localFileExisted = existsSync(join(__dirname, 'bcrypt.linux-x64-gnu.node'))
215+
localFileExisted = existsSync(
216+
join(__dirname, 'bcrypt.linux-x64-gnu.node')
217+
)
206218
try {
207219
if (localFileExisted) {
208220
nativeBinding = require('./bcrypt.linux-x64-gnu.node')
@@ -216,7 +228,9 @@ switch (platform) {
216228
break
217229
case 'arm64':
218230
if (isMusl()) {
219-
localFileExisted = existsSync(join(__dirname, 'bcrypt.linux-arm64-musl.node'))
231+
localFileExisted = existsSync(
232+
join(__dirname, 'bcrypt.linux-arm64-musl.node')
233+
)
220234
try {
221235
if (localFileExisted) {
222236
nativeBinding = require('./bcrypt.linux-arm64-musl.node')
@@ -227,7 +241,9 @@ switch (platform) {
227241
loadError = e
228242
}
229243
} else {
230-
localFileExisted = existsSync(join(__dirname, 'bcrypt.linux-arm64-gnu.node'))
244+
localFileExisted = existsSync(
245+
join(__dirname, 'bcrypt.linux-arm64-gnu.node')
246+
)
231247
try {
232248
if (localFileExisted) {
233249
nativeBinding = require('./bcrypt.linux-arm64-gnu.node')
@@ -240,7 +256,9 @@ switch (platform) {
240256
}
241257
break
242258
case 'arm':
243-
localFileExisted = existsSync(join(__dirname, 'bcrypt.linux-arm-gnueabihf.node'))
259+
localFileExisted = existsSync(
260+
join(__dirname, 'bcrypt.linux-arm-gnueabihf.node')
261+
)
244262
try {
245263
if (localFileExisted) {
246264
nativeBinding = require('./bcrypt.linux-arm-gnueabihf.node')
@@ -253,7 +271,9 @@ switch (platform) {
253271
break
254272
case 'riscv64':
255273
if (isMusl()) {
256-
localFileExisted = existsSync(join(__dirname, 'bcrypt.linux-riscv64-musl.node'))
274+
localFileExisted = existsSync(
275+
join(__dirname, 'bcrypt.linux-riscv64-musl.node')
276+
)
257277
try {
258278
if (localFileExisted) {
259279
nativeBinding = require('./bcrypt.linux-riscv64-musl.node')
@@ -264,7 +284,9 @@ switch (platform) {
264284
loadError = e
265285
}
266286
} else {
267-
localFileExisted = existsSync(join(__dirname, 'bcrypt.linux-riscv64-gnu.node'))
287+
localFileExisted = existsSync(
288+
join(__dirname, 'bcrypt.linux-riscv64-gnu.node')
289+
)
268290
try {
269291
if (localFileExisted) {
270292
nativeBinding = require('./bcrypt.linux-riscv64-gnu.node')
@@ -277,7 +299,9 @@ switch (platform) {
277299
}
278300
break
279301
case 's390x':
280-
localFileExisted = existsSync(join(__dirname, 'bcrypt.linux-s390x-gnu.node'))
302+
localFileExisted = existsSync(
303+
join(__dirname, 'bcrypt.linux-s390x-gnu.node')
304+
)
281305
try {
282306
if (localFileExisted) {
283307
nativeBinding = require('./bcrypt.linux-s390x-gnu.node')

packages/bcrypt/build.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
extern crate napi_build;
2-
31
fn main() {
42
napi_build::setup();
53
}

packages/crc32/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ crate-type = ["cdylib"]
99

1010
[dependencies]
1111
crc32c = { version = "0.6" }
12-
crc32fast = { version = "1.3", features = ["nightly"] }
12+
crc32fast = { version = "1.4", features = ["nightly"] }
1313
global_alloc = { path = "../../crates/alloc" }
1414
napi = { version = "2", default-features = false, features = ["napi3"] }
1515
napi-derive = { version = "2" }

packages/deno-lint/Cargo.toml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,18 @@ crate-type = ["cdylib"]
1010
[dependencies]
1111
annotate-snippets = { version = "0.10" }
1212
anyhow = "1"
13-
deno_ast = "=1.0.1"
14-
deno_lint = "=0.55.2"
13+
deno_ast = "=0.33.2"
14+
deno_lint = "=0.56.0"
1515
env_logger = "0.11"
1616
global_alloc = { path = "../../crates/alloc" }
1717
globwalk = "0.9"
1818
ignore = "0.4"
19-
miette = { version = "5", features = ["fancy-no-backtrace"] }
19+
miette = { version = "7", features = ["fancy-no-backtrace"] }
2020
napi = { version = "2", default-features = false, features = ["napi3"] }
2121
napi-derive = { version = "2" }
2222
serde = "1"
2323
serde_json = "1"
24+
url = "2.5"
2425

2526
[build-dependencies]
2627
napi-build = "2"

packages/deno-lint/build.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
extern crate napi_build;
2-
31
fn main() {
42
napi_build::setup();
53
}

0 commit comments

Comments
 (0)