Skip to content

Commit

Permalink
Move Book tests from custom Cargo workspace to common one
Browse files Browse the repository at this point in the history
  • Loading branch information
tyranron committed Jul 1, 2022
1 parent a70b7f7 commit 3d4b5c7
Show file tree
Hide file tree
Showing 11 changed files with 30 additions and 23 deletions.
5 changes: 0 additions & 5 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,6 @@ updates:
schedule:
interval: daily

- package-ecosystem: cargo
directory: /book/tests/
schedule:
interval: daily

- package-ecosystem: github-actions
directory: /
schedule:
Expand Down
18 changes: 12 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,12 @@ jobs:
#################

rustdoc:
strategy:
fail-fast: false
matrix:
crate:
- cucumber-codegen
- cucumber
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand All @@ -195,7 +201,9 @@ jobs:
profile: minimal
toolchain: nightly

- run: make cargo.doc private=yes docsrs=yes open=no
- run: make cargo.doc crate=${{ matrix.crate }}
private=yes docsrs=yes
open=no



Expand Down Expand Up @@ -287,11 +295,9 @@ jobs:
- uses: actions/checkout@v3
- uses: peaceiris/actions-mdbook@v1

- run: make book.build out=gh-pages/main
if: ${{ github.ref == 'refs/heads/main' }}

- run: make book.build out=gh-pages/current
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
- run: make book.build
out=gh-pages/${{ (github.ref == 'refs/heads/main' && 'main')
|| 'current' }}

- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
Expand Down
3 changes: 1 addition & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -90,5 +90,4 @@ name = "wait"
harness = false

[workspace]
members = ["codegen"]
exclude = ["book/tests"]
members = ["book/tests", "codegen"]
12 changes: 9 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ lint: cargo.lint
record: record.gif


test: test.cargo test.book
test: test.cargo



Expand Down Expand Up @@ -97,7 +97,7 @@ test.cargo:
# make test.book

test.book:
cargo test --manifest-path book/tests/Cargo.toml
@make test.cargo crate=cucumber-book-tests



Expand All @@ -124,6 +124,12 @@ book.serve:
mdbook serve book/ -p=$(or $(port),3000)


book.test: test.book


book.tests: test.book




######################
Expand Down Expand Up @@ -167,6 +173,6 @@ endif

.PHONY: book docs fmt lint record test \
cargo.doc cargo.fmt cargo.lint \
book.build book.serve \
book.build book.serve book.test book.tests \
record.gif \
test.cargo test.book
1 change: 1 addition & 0 deletions book/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
/_rendered/
/gh-pages/
3 changes: 3 additions & 0 deletions book/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ cd tests/
cargo test

# or from project root dir:
cargo test -p cucumber-book-tests

# or via shortcut from project root dir:
make test.book
```

Expand Down
2 changes: 1 addition & 1 deletion book/src/output/json.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ use cucumber::writer;
#
# #[tokio::main]
# async fn main() -> io::Result<()> {
let file = fs::File::create(dbg!(format!("{}/target/report.json", env!("CARGO_MANIFEST_DIR"))))?;
let file = fs::File::create(dbg!(format!("{}/report.json", env!("OUT_DIR"))))?;
World::cucumber()
.with_writer(writer::Json::new(file))
.run("tests/features/book")
Expand Down
2 changes: 1 addition & 1 deletion book/src/output/junit.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ use cucumber::writer;
#
# #[tokio::main]
# async fn main() -> io::Result<()> {
let file = fs::File::create(dbg!(format!("{}/target/junit.xml", env!("CARGO_MANIFEST_DIR"))))?;
let file = fs::File::create(dbg!(format!("{}/junit.xml", env!("OUT_DIR"))))?;
World::cucumber()
.with_writer(writer::JUnit::new(file, 0))
.run("tests/features/book")
Expand Down
2 changes: 1 addition & 1 deletion book/src/output/multiple.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ use cucumber::{writer, WriterExt as _};
#
# #[tokio::main]
# async fn main() -> io::Result<()> {
let file = fs::File::create(dbg!(format!("{}/target/report.json", env!("CARGO_MANIFEST_DIR"))))?;
let file = fs::File::create(dbg!(format!("{}/report.json", env!("OUT_DIR"))))?;
World::cucumber()
.with_writer(
// NOTE: `Writer`s pipeline is constructed in a reversed order.
Expand Down
3 changes: 0 additions & 3 deletions book/tests/.gitignore

This file was deleted.

2 changes: 1 addition & 1 deletion book/tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ publish = false
[dependencies]
async-trait = "0.1"
clap = { version = "3.0", features = ["derive"] }
cucumber = { version = "0.14.0-dev", path = "../..", features = ["output-json", "output-junit"] }
cucumber = { path = "../..", features = ["output-json", "output-junit"] }
futures = "0.3"
humantime = "2.1"
once_cell = "1.8"
Expand Down

0 comments on commit 3d4b5c7

Please sign in to comment.