Do the Trunk build check as an end-to-end test
All checks were successful
/ test (pull_request) Successful in 2m18s
All checks were successful
/ test (pull_request) Successful in 2m18s
This consolidates our whole CI workflow into `cargo test`.
This commit is contained in:
parent
0a9d234557
commit
992fb76419
3 changed files with 21 additions and 14 deletions
|
@ -3,22 +3,11 @@ on:
|
|||
push:
|
||||
branches: [main]
|
||||
jobs:
|
||||
# build the application, reporting success if there are no errors or warnings
|
||||
build:
|
||||
runs-on: docker
|
||||
container:
|
||||
image: cimg/rust:1.85-node
|
||||
defaults:
|
||||
run:
|
||||
working-directory: app-proto
|
||||
steps:
|
||||
- uses: https://code.forgejo.org/actions/checkout@v4
|
||||
- uses: ./.forgejo/setup-trunk
|
||||
- run: RUSTFLAGS='-D warnings' trunk build
|
||||
|
||||
# run the automated tests, reporting success if the tests pass and were built
|
||||
# without warnings. the examples are run as tests, because we've configured
|
||||
# each example target with `test = true` and `harness = false` in Cargo.toml
|
||||
# each example target with `test = true` and `harness = false` in Cargo.toml.
|
||||
# Trunk build failures caused by problems outside the Rust source code, like
|
||||
# missing assets, should be caught by `trunk_build_test`
|
||||
test:
|
||||
runs-on: docker
|
||||
container:
|
||||
|
@ -28,4 +17,5 @@ jobs:
|
|||
working-directory: app-proto
|
||||
steps:
|
||||
- uses: https://code.forgejo.org/actions/checkout@v4
|
||||
- uses: ./.forgejo/setup-trunk
|
||||
- run: RUSTFLAGS='-D warnings' cargo test
|
|
@ -5,6 +5,9 @@ mod engine;
|
|||
mod outline;
|
||||
mod specified;
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests;
|
||||
|
||||
use rustc_hash::FxHashSet;
|
||||
use sycamore::prelude::*;
|
||||
|
||||
|
|
14
app-proto/src/tests.rs
Normal file
14
app-proto/src/tests.rs
Normal file
|
@ -0,0 +1,14 @@
|
|||
use std::process::Command;
|
||||
|
||||
// build and bundle the application, reporting success if there are no errors or
|
||||
// warnings. to see this test fail while others succeed, try moving `index.html`
|
||||
// or one of the assets that it links to
|
||||
#[test]
|
||||
fn trunk_build_test() {
|
||||
let build_status = Command::new("trunk")
|
||||
.arg("build")
|
||||
.env("RUSTFLAGS", "-D warnings")
|
||||
.status()
|
||||
.expect("Call to Trunk failed");
|
||||
assert!(build_status.success());
|
||||
}
|
Loading…
Add table
Reference in a new issue