File tree Expand file tree Collapse file tree 1 file changed +53
-0
lines changed Expand file tree Collapse file tree 1 file changed +53
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Rust
2+
3+ on :
4+ push :
5+ branches :
6+ - main
7+ pull_request :
8+
9+ jobs :
10+ test :
11+ name : Run Rust Tests
12+ runs-on : ubuntu-latest
13+
14+ steps :
15+ # Checkout the code
16+ - name : Checkout Code
17+ uses : actions/checkout@v4
18+
19+ # Set up Rust toolchain.
20+ # This will be overwritten anyway by a `rust-toolchain.toml`
21+ # file.
22+ - name : Setup Rust Toolchain
23+ uses : actions-rust-lang/setup-rust-toolchain@v1
24+ with :
25+ toolchain : stable
26+ components : rustfmt
27+
28+ # Run rustfmt and confirm no changes for each `blog/*/code` directory
29+ - name : Check Formatting
30+ run : |
31+ for dir in blog/*/code; do
32+ if [ -f "$dir/Cargo.toml" ]; then
33+ echo "Checking formatting in $dir"
34+ (cd "$dir" && cargo fmt --check)
35+ else
36+ echo "Skipping $dir as it does not contain a Cargo.toml file"
37+ fi
38+ done
39+
40+ # Run tests for each `blog/*/code` directory
41+ - name : Build and Test
42+ run : |
43+ for dir in blog/*/code; do
44+ if [ -f "$dir/Cargo.toml" ]; then
45+ cd "$dir";
46+ echo "Running build in $dir"
47+ cargo build --release
48+ echo "Running tests in $dir"
49+ cargo test --release
50+ else
51+ echo "Skipping $dir as it does not contain a Cargo.toml file"
52+ fi
53+ done
You can’t perform that action at this time.
0 commit comments