Skip to content

Commit

Permalink
Update CI for trybuild
Browse files Browse the repository at this point in the history
This avoids running UI tests except in code coverage generation, as the
output of UI tests can vary by compiler.
  • Loading branch information
jhpratt committed Aug 9, 2021
1 parent 656f7d9 commit 102437e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 15 deletions.
16 changes: 4 additions & 12 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -214,16 +214,6 @@ jobs:
with:
command: test
args: --all-features
if: matrix.os.name == 'Ubuntu'

- name: Test
uses: actions-rs/cargo@v1
with:
command: test
args: --all-features
env:
RUSTFLAGS: "--cfg skip_ui_tests"
if: matrix.os.name != 'Ubuntu'

fmt:
name: Formatting
Expand Down Expand Up @@ -363,10 +353,12 @@ jobs:
curl -LsSf https://github.com/taiki-e/cargo-llvm-cov/releases/download/v0.1.0-alpha.5/cargo-llvm-cov-x86_64-unknown-linux-gnu.tar.gz | tar xzf - -C ~/.cargo/bin
- name: Generate coverage report
run: cargo llvm-cov --all-features --lcov > lcov.txt
run: cargo llvm-cov --all-features --workspace --lcov > lcov.txt
env:
# Don't run these anywhere else as the results can depend on the exact compiler used.
RUSTFLAGS: "--cfg __ui_tests"

- name: Upload coverage report
uses: codecov/codecov-action@v1
with:
files: ./lcov.txt
fail_ci_if_error: false
2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ criterion = { version = "0.3.5", features = ["html_reports"] }
rand = { version = "0.8.4", default-features = false }
serde = { version = "1.0.126", default-features = false }
serde_test = "1.0.126"

[target.'cfg(__ui_tests)'.dev-dependencies]
trybuild = "1.0.44"

# Significant contributions to the benchmarks provided by Emil Lundberg.
Expand Down
5 changes: 2 additions & 3 deletions tests/integration/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@
clippy::cmp_owned
)]

use trybuild::TestCases;

/// Construct a non-exhaustive modifier.
macro_rules! modifier {
($name:ident {
Expand Down Expand Up @@ -79,8 +77,9 @@ mod utc_offset;
mod util;
mod weekday;

#[cfg(__ui_tests)]
#[test]
fn compile_fail() {
let tests = TestCases::new();
let tests = trybuild::TestCases::new();
tests.compile_fail("tests/integration/compile-fail/*.rs");
}

0 comments on commit 102437e

Please sign in to comment.