diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7e1b85c8..3ef5ebc8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -45,9 +45,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - uses: actions-rs/toolchain@v1 + - uses: dtolnay/rust-toolchain@v1 with: - profile: minimal toolchain: stable components: clippy @@ -57,9 +56,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - uses: actions-rs/toolchain@v1 + - uses: dtolnay/rust-toolchain@v1 with: - profile: minimal toolchain: nightly components: rustfmt @@ -86,15 +84,12 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - uses: actions-rs/toolchain@v1 + - uses: dtolnay/rust-toolchain@v1 with: - profile: minimal - toolchain: nightly - - uses: actions-rs/toolchain@v1 - with: - profile: minimal toolchain: stable - override: true + - uses: dtolnay/rust-toolchain@v1 + with: + toolchain: nightly - run: cargo +nightly update -Z minimal-versions @@ -121,15 +116,13 @@ jobs: runs-on: ${{ matrix.os }}-latest steps: - uses: actions/checkout@v3 - - uses: actions-rs/toolchain@v1 + - uses: dtolnay/rust-toolchain@v1 with: - profile: minimal - toolchain: nightly - - uses: actions-rs/toolchain@v1 - with: - profile: minimal toolchain: ${{ matrix.msrv }} - override: true + - run: rustup default ${{ matrix.msrv }} + - uses: dtolnay/rust-toolchain@v1 + with: + toolchain: nightly - run: cargo +nightly update -Z minimal-versions @@ -153,16 +146,21 @@ jobs: runs-on: ${{ matrix.os }}-latest steps: - uses: actions/checkout@v3 - - uses: actions-rs/toolchain@v1 + - uses: dtolnay/rust-toolchain@v1 with: - profile: minimal toolchain: ${{ matrix.toolchain }} - override: true + components: rust-src + - run: rustup default ${{ matrix.toolchain }} + + - run: cargo install cargo-careful + if: ${{ matrix.toolchain == 'nightly' }} - run: make test.cargo crate=${{ matrix.crate }} + careful=${{ (matrix.toolchain == 'nightly' && 'yes') + || 'no' }} test-book: - name: Test Book + name: test Book strategy: fail-fast: false matrix: @@ -173,9 +171,8 @@ jobs: runs-on: ${{ matrix.os }}-latest steps: - uses: actions/checkout@v3 - - uses: actions-rs/toolchain@v1 + - uses: dtolnay/rust-toolchain@v1 with: - profile: minimal toolchain: stable - run: make test.book @@ -197,9 +194,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - uses: actions-rs/toolchain@v1 + - uses: dtolnay/rust-toolchain@v1 with: - profile: minimal toolchain: nightly - run: make cargo.doc crate=${{ matrix.crate }} @@ -214,15 +210,14 @@ jobs: ############# release-crate: - name: Release on crates.io + name: release on crates.io if: ${{ startsWith(github.ref, 'refs/tags/v') }} needs: ["release-github"] runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - uses: actions-rs/toolchain@v1 + - uses: dtolnay/rust-toolchain@v1 with: - profile: minimal toolchain: stable - name: Publish `cucumber-codegen` crate @@ -237,7 +232,7 @@ jobs: --token ${{ secrets.CRATESIO_TOKEN }} release-github: - name: Release on GitHub + name: release on GitHub if: ${{ startsWith(github.ref, 'refs/tags/v') }} needs: - clippy @@ -285,7 +280,7 @@ jobs: ########## deploy-book: - name: Deploy Book + name: deploy Book if: ${{ github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v') }} needs: ["test-book"] diff --git a/Makefile b/Makefile index 47a23062..0b63f2c7 100644 --- a/Makefile +++ b/Makefile @@ -85,10 +85,20 @@ cargo.lint: # Run Rust tests of project crates. # # Usage: -# make test.cargo [crate=] +# make test.cargo [crate=] [careful=(no|yes)] test.cargo: - cargo test $(if $(call eq,$(crate),),--workspace,-p $(crate)) --all-features +ifeq ($(careful),yes) +ifeq ($(shell cargo install --list | grep cargo-careful),) + cargo install cargo-careful +endif +ifeq ($(shell rustup component list --toolchain=nightly \ + | grep 'rust-src (installed)'),) + rustup component add --toolchain=nightly rust-src +endif +endif + cargo $(if $(call eq,$(careful),yes),+nightly careful,) test \ + $(if $(call eq,$(crate),),--workspace,-p $(crate)) --all-features # Run Rust tests of Book.