Skip to content

Commit 0ad21ec

Browse files
authored
ref: Update CI definitions (#58)
- Updates CI definitions to up-to-date actions - Replaces the unmaintained `actions-rs` actions by direct `rustup`/`cargo` calls - Fixes #57 by moving the weekly CI workflow - Fixes nightly clippy errors (inlines format arguments)
1 parent bfe9ba4 commit 0ad21ec

File tree

10 files changed

+72
-130
lines changed

10 files changed

+72
-130
lines changed

.github/workflows/ci.yml

Lines changed: 25 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ on:
44
push:
55
branches:
66
- master
7-
- release/**
8-
7+
- "release/**"
98
pull_request:
109

1110
env:
@@ -16,99 +15,50 @@ jobs:
1615
name: Lints
1716
runs-on: ubuntu-latest
1817
steps:
19-
- name: Checkout sources
20-
uses: actions/checkout@v2
21-
22-
- name: Install rust stable toolchain
23-
uses: actions-rs/toolchain@v1
24-
with:
25-
toolchain: stable
26-
profile: minimal
27-
components: rustfmt, clippy
28-
override: true
29-
30-
- name: Cache rust cargo artifacts
31-
uses: swatinem/rust-cache@v1
32-
33-
- name: Run cargo fmt
34-
uses: actions-rs/cargo@v1
35-
with:
36-
command: fmt
37-
args: --all -- --check
38-
39-
- name: Run clippy
40-
uses: actions-rs/cargo@v1
41-
with:
42-
command: clippy
43-
args: --all-features --workspace --tests --examples
18+
- uses: actions/checkout@v3
19+
20+
- run: rustup toolchain install stable --profile minimal --component rustfmt --component clippy --no-self-update
21+
22+
- uses: Swatinem/rust-cache@v2
23+
24+
- run: cargo fmt --all -- --check
25+
26+
- run: cargo clippy --all-features --workspace --tests --examples -- -D clippy::all
4427

4528
unit-test:
4629
name: Unit Tests
4730
runs-on: ubuntu-latest
4831
steps:
49-
- name: Checkout sources
50-
uses: actions/checkout@v2
32+
- uses: actions/checkout@v3
5133

52-
- name: Install rust stable toolchain
53-
uses: actions-rs/toolchain@v1
54-
with:
55-
toolchain: stable
56-
profile: minimal
57-
override: true
34+
- run: rustup toolchain install stable --profile minimal --no-self-update
5835

59-
- name: Cache rust cargo artifacts
60-
uses: swatinem/rust-cache@v1
36+
- uses: Swatinem/rust-cache@v2
6137

62-
- name: Run cargo test
63-
uses: actions-rs/cargo@v1
64-
with:
65-
command: test
66-
args: --workspace
38+
- run: cargo test --workspace
6739

6840
unit-test-all-features:
6941
name: "Unit Tests - all features"
7042
runs-on: ubuntu-latest
7143
steps:
72-
- name: Checkout sources
73-
uses: actions/checkout@v2
44+
- uses: actions/checkout@v3
7445

75-
- name: Install rust stable toolchain
76-
uses: actions-rs/toolchain@v1
77-
with:
78-
toolchain: stable
79-
profile: minimal
80-
override: true
46+
- run: rustup toolchain install stable --profile minimal --no-self-update
8147

82-
- name: Cache rust cargo artifacts
83-
uses: swatinem/rust-cache@v1
48+
- uses: Swatinem/rust-cache@v2
8449

85-
- name: Run cargo test
86-
uses: actions-rs/cargo@v1
87-
with:
88-
command: test
89-
args: --workspace --all-features
50+
- run: cargo test --workspace --all-features --all-targets
9051

9152
doc-comments:
9253
name: Rust doc comments
9354
runs-on: ubuntu-latest
9455
env:
9556
RUSTDOCFLAGS: -Dwarnings
9657
steps:
97-
- name: Checkout sources
98-
uses: actions/checkout@v2
99-
100-
- name: Install rust stable toolchain
101-
uses: actions-rs/toolchain@v1
102-
with:
103-
toolchain: stable
104-
profile: minimal
105-
components: rust-docs
106-
override: true
107-
108-
- name: Cache rust cargo artifacts
109-
uses: swatinem/rust-cache@v1
110-
111-
- uses: actions-rs/cargo@v1
112-
with:
113-
command: doc
114-
args: --workspace --all-features --no-deps
58+
- uses: actions/checkout@v3
59+
60+
- run: rustup toolchain install stable --profile minimal --component rust-docs --no-self-update
61+
62+
- uses: Swatinem/rust-cache@v2
63+
64+
- run: cargo doc --workspace --all-features --document-private-items --no-deps

.github/workflows/periodic.yml

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

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
runs-on: ubuntu-latest
1616
name: "Release a new version"
1717
steps:
18-
- uses: actions/checkout@v2
18+
- uses: actions/checkout@v3
1919
with:
2020
token: ${{ secrets.GH_RELEASE_PAT }}
2121
fetch-depth: 0

.github/workflows/weekly.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Weekly CI
2+
3+
on:
4+
schedule:
5+
- cron: "0 0 * * 1" # every monday at 00:00
6+
workflow_dispatch:
7+
8+
env:
9+
RUSTFLAGS: -Dwarnings
10+
11+
jobs:
12+
weekly-ci:
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
rust: [nightly, beta]
17+
18+
runs-on: ubuntu-latest
19+
20+
steps:
21+
- uses: actions/checkout@v3
22+
23+
- run: |
24+
rustup toolchain install ${{ matrix.rust }} --profile minimal --component clippy --no-self-update
25+
rustup default ${{ matrix.rust }}
26+
27+
- run: cargo clippy --all-features --workspace --tests --examples -- -D clippy::all
28+
29+
- run: cargo test --workspace --all-features

examples/read.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,5 @@ fn main() {
3434
};
3535

3636
let token = sm.lookup_token(line, column).unwrap(); // line-number and column
37-
println!("token: {}", token);
37+
println!("token: {token}");
3838
}

examples/rewrite.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ fn test(sm: &SourceMap) {
1515
continue;
1616
}
1717
if Some(contents.as_str()) != sm.get_source_contents(src_id as u32) {
18-
println!(" !!! {}", source);
18+
println!(" !!! {source}");
1919
}
2020
}
2121
}

examples/split_ram_bundle.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Both indexed and file RAM bundles are supported.
1919
fn main() -> Result<(), Box<dyn std::error::Error>> {
2020
let args: Vec<_> = env::args().collect();
2121
if args.len() < 4 {
22-
println!("{}", USAGE);
22+
println!("{USAGE}");
2323
std::process::exit(1);
2424
}
2525

@@ -47,11 +47,11 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
4747
let ram_bundle_iter = split_ram_bundle(&ram_bundle, &ism).unwrap();
4848
for result in ram_bundle_iter {
4949
let (name, sv, sm) = result.unwrap();
50-
println!("Writing down source: {}", name);
50+
println!("Writing down source: {name}");
5151
fs::write(output_directory.join(name.clone()), sv.source())?;
5252

53-
let sourcemap_name = format!("{}.map", name);
54-
println!("Writing down sourcemap: {}", sourcemap_name);
53+
let sourcemap_name = format!("{name}.map");
54+
println!("Writing down sourcemap: {sourcemap_name}");
5555
let out_sm = File::create(output_directory.join(sourcemap_name))?;
5656
sm.to_writer(out_sm)?;
5757
}

src/decoder.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ pub fn decode_regular(rsm: RawSourceMap) -> Result<SourceMap> {
202202
if is_valid {
203203
x
204204
} else {
205-
format!("{}/{}", source_root, x)
205+
format!("{source_root}/{x}")
206206
}
207207
})
208208
.collect()

src/errors.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -94,21 +94,21 @@ impl error::Error for Error {
9494
impl fmt::Display for Error {
9595
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
9696
match *self {
97-
Error::Io(ref msg) => write!(f, "{}", msg),
98-
Error::Utf8(ref msg) => write!(f, "{}", msg),
99-
Error::BadJson(ref err) => write!(f, "bad json: {}", err),
97+
Error::Io(ref msg) => write!(f, "{msg}"),
98+
Error::Utf8(ref msg) => write!(f, "{msg}"),
99+
Error::BadJson(ref err) => write!(f, "bad json: {err}"),
100100
#[cfg(feature = "ram_bundle")]
101-
Error::Scroll(ref err) => write!(f, "parse error: {}", err),
101+
Error::Scroll(ref err) => write!(f, "parse error: {err}"),
102102
Error::VlqLeftover => write!(f, "leftover cur/shift in vlq decode"),
103103
Error::VlqNoValues => write!(f, "vlq decode did not produce any values"),
104104
Error::VlqOverflow => write!(f, "vlq decode caused an overflow"),
105-
Error::BadSegmentSize(size) => write!(f, "got {} segments, expected 4 or 5", size),
106-
Error::BadSourceReference(id) => write!(f, "bad reference to source #{}", id),
107-
Error::BadNameReference(id) => write!(f, "bad reference to name #{}", id),
105+
Error::BadSegmentSize(size) => write!(f, "got {size} segments, expected 4 or 5"),
106+
Error::BadSourceReference(id) => write!(f, "bad reference to source #{id}"),
107+
Error::BadNameReference(id) => write!(f, "bad reference to name #{id}"),
108108
Error::IncompatibleSourceMap => write!(f, "encountered incompatible sourcemap format"),
109109
Error::InvalidDataUrl => write!(f, "the provided data URL is invalid"),
110110
Error::CannotFlatten(ref msg) => {
111-
write!(f, "cannot flatten the indexed sourcemap: {}", msg)
111+
write!(f, "cannot flatten the indexed sourcemap: {msg}")
112112
}
113113
Error::InvalidRamBundleMagic => write!(f, "invalid magic number for ram bundle"),
114114
Error::InvalidRamBundleIndex => write!(f, "invalid module index in ram bundle"),

src/types.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ impl<'a> Iterator for IndexIter<'a> {
390390

391391
impl<'a> fmt::Debug for Token<'a> {
392392
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
393-
write!(f, "<Token {:#}>", self)
393+
write!(f, "<Token {self:#}>")
394394
}
395395
}
396396

@@ -403,7 +403,7 @@ impl<'a> fmt::Display for Token<'a> {
403403
self.get_src_line(),
404404
self.get_src_col(),
405405
self.get_name()
406-
.map(|x| format!(" name={}", x))
406+
.map(|x| format!(" name={x}"))
407407
.unwrap_or_default()
408408
)?;
409409
if f.alternate() {

0 commit comments

Comments
 (0)