diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ab8e9effa..13944ed3d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -4,11 +4,13 @@ jobs: e2e-dependencies: name: Run 'dependencies' end-to-end test runs-on: ubuntu-latest + if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - uses: actions-rs/toolchain@v1 with: toolchain: stable + - uses: Swatinem/rust-cache@v2 - name: dependencies e2e test working-directory: e2e/dependencies/consumer run: | @@ -23,11 +25,13 @@ jobs: e2e-workspace: name: Run 'workspace' end-to-end test runs-on: ubuntu-latest + if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - uses: actions-rs/toolchain@v1 with: toolchain: stable + - uses: Swatinem/rust-cache@v2 - name: workspace e2e test working-directory: e2e/workspace run: | @@ -45,11 +49,13 @@ jobs: e2e-example: name: End-to-end test example runs-on: ubuntu-latest + if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - uses: actions-rs/toolchain@v1 with: toolchain: stable + - uses: Swatinem/rust-cache@v2 - name: example e2e test working-directory: example run: | @@ -65,40 +71,66 @@ jobs: readme-up-to-date: name: Check that README.md is up-to-date runs-on: ubuntu-latest + if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - uses: actions-rs/toolchain@v1 with: toolchain: stable + - uses: Swatinem/rust-cache@v2 - name: Check that README.md is up-to-date working-directory: ts-rs run: | cargo install cargo-readme diff -u ../README.md <(cargo readme) - test: - name: Test ts-rs + test-all-features: + name: Test ts-rs with --all-features runs-on: ubuntu-latest + if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - uses: actions-rs/toolchain@v1 with: toolchain: stable - - name: Test with export env + - uses: Swatinem/rust-cache@v2 + - name: Test + run: | + cargo test --all-features + shopt -s globstar + tsc ts-rs/bindings/**/*.ts --noEmit --noUnusedLocals --strict + rm -rf ts-rs/bindings + + test-export-env: + name: Test ts-rs with TS_RS_EXPORT_DIR + runs-on: ubuntu-latest + if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name + steps: + - uses: actions/checkout@v4 + - uses: actions-rs/toolchain@v1 + with: + toolchain: stable + - uses: Swatinem/rust-cache@v2 + - name: Test run: | TS_RS_EXPORT_DIR=output cargo test --no-default-features shopt -s globstar tsc ts-rs/output/**/*.ts --noEmit --noUnusedLocals --strict rm -rf ts-rs/output - - name: No features + + test-no-features: + name: Test ts-rs with --no-default-features + runs-on: ubuntu-latest + if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name + steps: + - uses: actions/checkout@v4 + - uses: actions-rs/toolchain@v1 + with: + toolchain: stable + - uses: Swatinem/rust-cache@v2 + - name: Test run: | cargo test --no-default-features shopt -s globstar tsc ts-rs/bindings/**/*.ts --noEmit --noUnusedLocals rm -rf ts-rs/bindings - - name: All features - run: | - cargo test --all-features - shopt -s globstar - tsc ts-rs/bindings/**/*.ts --noEmit --noUnusedLocals --strict - rm -rf ts-rs/bindings diff --git a/e2e/dependencies/consumer/src/main.rs b/e2e/dependencies/consumer/src/main.rs index ea294c2a2..b3049b7a0 100644 --- a/e2e/dependencies/consumer/src/main.rs +++ b/e2e/dependencies/consumer/src/main.rs @@ -1,5 +1,7 @@ -use ts_rs::TS; +#![allow(dead_code)] + use dependency1::*; +use ts_rs::TS; #[derive(TS)] #[ts(export)] @@ -19,8 +21,7 @@ struct T0; #[derive(TS)] #[ts(export)] struct T1 { - t0: Option + t0: Option, } - -fn main() {} \ No newline at end of file +fn main() {} diff --git a/e2e/dependencies/dependency1/src/lib.rs b/e2e/dependencies/dependency1/src/lib.rs index 7fa7cc46a..e89dc41d7 100644 --- a/e2e/dependencies/dependency1/src/lib.rs +++ b/e2e/dependencies/dependency1/src/lib.rs @@ -2,13 +2,13 @@ use ts_rs::TS; #[derive(TS)] pub struct LibraryType1 { - pub a: i32 + pub a: i32, } #[derive(TS)] pub struct LibraryType2 { - pub t: T + pub t: T, } #[derive(TS)] -pub struct LibraryType3; \ No newline at end of file +pub struct LibraryType3;