From 6a6fd8f7a8807d356073de2141529d8b5a085e24 Mon Sep 17 00:00:00 2001 From: Taiki Endo Date: Tue, 10 Oct 2023 22:53:26 +0900 Subject: [PATCH] wip --- .github/workflows/ci.yml | 276 +++++++++++++++++++-------------------- tests/auxiliary/mod.rs | 11 +- 2 files changed, 142 insertions(+), 145 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9d6a3fa1..647ba922 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -32,80 +32,80 @@ concurrency: cancel-in-progress: true jobs: - deny: - uses: taiki-e/github-actions/.github/workflows/deny.yml@main - msrv: - uses: taiki-e/github-actions/.github/workflows/msrv.yml@main - with: - event_name: ${{ github.event_name }} - tidy: - uses: taiki-e/github-actions/.github/workflows/tidy.yml@main + # deny: + # uses: taiki-e/github-actions/.github/workflows/deny.yml@main + # msrv: + # uses: taiki-e/github-actions/.github/workflows/msrv.yml@main + # with: + # event_name: ${{ github.event_name }} + # tidy: + # uses: taiki-e/github-actions/.github/workflows/tidy.yml@main - test: - strategy: - fail-fast: false - matrix: - include: - - rust: stable - - rust: beta - - rust: nightly - - rust: nightly - os: macos-11 - - rust: nightly - os: windows-2019 - runs-on: ${{ matrix.os || 'ubuntu-20.04' }} - timeout-minutes: 60 - steps: - - uses: actions/checkout@v4 - with: - persist-credentials: false - - name: Install Rust - run: rustup toolchain add ${{ matrix.rust }} --no-self-update && rustup default ${{ matrix.rust }} - - run: rustup toolchain add nightly --no-self-update - - run: echo "RUSTFLAGS=${RUSTFLAGS} -C target-feature=+crt-static" >>"${GITHUB_ENV}" - if: startsWith(matrix.os, 'windows') - - run: cargo test --workspace --all-features - - run: | - set -eEuxo pipefail - cargo install --path . --debug - cd tests/fixtures/real - cargo hack check --feature-powerset --workspace - cargo hack check --feature-powerset --workspace --message-format=json - cd ../rust-version - rustup toolchain remove 1.63 1.64 1.65 - cargo hack check --rust-version --workspace - cargo uninstall cargo-hack - - uses: taiki-e/install-action@cargo-hack - - uses: taiki-e/install-action@cargo-minimal-versions - - run: cargo hack build --workspace --no-private --feature-powerset --no-dev-deps - - run: cargo minimal-versions build --workspace --no-private --all-features + # test: + # strategy: + # fail-fast: false + # matrix: + # include: + # - rust: stable + # - rust: beta + # - rust: nightly + # - rust: nightly + # os: macos-11 + # - rust: nightly + # os: windows-2019 + # runs-on: ${{ matrix.os || 'ubuntu-20.04' }} + # timeout-minutes: 60 + # steps: + # - uses: actions/checkout@v4 + # with: + # persist-credentials: false + # - name: Install Rust + # run: rustup toolchain add ${{ matrix.rust }} --no-self-update && rustup default ${{ matrix.rust }} + # - run: rustup toolchain add nightly --no-self-update + # - run: echo "RUSTFLAGS=${RUSTFLAGS} -C target-feature=+crt-static" >>"${GITHUB_ENV}" + # if: startsWith(matrix.os, 'windows') + # - run: cargo test --workspace --all-features + # - run: | + # set -eEuxo pipefail + # cargo install --path . --debug + # cd tests/fixtures/real + # cargo hack check --feature-powerset --workspace + # cargo hack check --feature-powerset --workspace --message-format=json + # cd ../rust-version + # rustup toolchain remove 1.63 1.64 1.65 + # cargo hack check --rust-version --workspace + # cargo uninstall cargo-hack + # - uses: taiki-e/install-action@cargo-hack + # - uses: taiki-e/install-action@cargo-minimal-versions + # - run: cargo hack build --workspace --no-private --feature-powerset --no-dev-deps + # - run: cargo minimal-versions build --workspace --no-private --all-features - test-compat: - name: test (1.${{ matrix.rust }}) - strategy: - fail-fast: false - matrix: - rust: - # cargo-hack is usually runnable with Cargo versions older than the Rust version required for installation. - # When updating this, the reminder to update the minimum supported Rust version in README.md. - - 26 - - 30 - - 31 - - 36 - - 39 - - 41 - runs-on: ubuntu-20.04 - timeout-minutes: 60 - steps: - - uses: actions/checkout@v4 - with: - persist-credentials: false - - name: Install Rust - run: rustup toolchain add nightly --no-self-update && rustup default nightly - - run: CARGO_HACK_TEST_TOOLCHAIN=${{ matrix.rust }} cargo test --workspace --all-features - # Remove stable toolchain to disable https://github.com/taiki-e/cargo-hack/pull/138's behavior. - - run: rustup toolchain remove stable - - run: CARGO_HACK_TEST_TOOLCHAIN=${{ matrix.rust }} cargo test --workspace --all-features + # test-compat: + # name: test (1.${{ matrix.rust }}) + # strategy: + # fail-fast: false + # matrix: + # rust: + # # cargo-hack is usually runnable with Cargo versions older than the Rust version required for installation. + # # When updating this, the reminder to update the minimum supported Rust version in README.md. + # - 26 + # - 30 + # - 31 + # - 36 + # - 39 + # - 41 + # runs-on: ubuntu-20.04 + # timeout-minutes: 60 + # steps: + # - uses: actions/checkout@v4 + # with: + # persist-credentials: false + # - name: Install Rust + # run: rustup toolchain add nightly --no-self-update && rustup default nightly + # - run: CARGO_HACK_TEST_TOOLCHAIN=${{ matrix.rust }} cargo test --workspace --all-features + # # Remove stable toolchain to disable https://github.com/taiki-e/cargo-hack/pull/138's behavior. + # - run: rustup toolchain remove stable + # - run: CARGO_HACK_TEST_TOOLCHAIN=${{ matrix.rust }} cargo test --workspace --all-features test-no-rustup: name: test (no rustup) @@ -113,12 +113,12 @@ jobs: timeout-minutes: 60 container: alpine steps: - - uses: actions/checkout@v4 - with: - persist-credentials: false - name: Install Rust run: apk --no-cache add bash cargo git shell: sh + - uses: actions/checkout@v4 + with: + persist-credentials: false - run: cargo test --workspace --all-features - run: | set -eEuxo pipefail @@ -127,67 +127,67 @@ jobs: cargo hack check --feature-powerset --workspace cargo uninstall cargo-hack - # NB: sync with upload-assets job in release.yml. - build: - name: build (${{ matrix.target }}) - strategy: - fail-fast: false - matrix: - include: - - target: aarch64-unknown-linux-gnu - - target: aarch64-unknown-linux-musl - - target: aarch64-apple-darwin - os: macos-11 - - target: aarch64-pc-windows-msvc - os: windows-2019 - - target: x86_64-unknown-linux-gnu - - target: x86_64-unknown-linux-musl - - target: x86_64-apple-darwin - os: macos-11 - - target: x86_64-pc-windows-msvc - os: windows-2019 - - target: x86_64-unknown-freebsd - - target: universal-apple-darwin - os: macos-11 - runs-on: ${{ matrix.os || 'ubuntu-20.04' }} - timeout-minutes: 60 - steps: - - uses: actions/checkout@v4 - with: - persist-credentials: false - - name: Install Rust - run: rustup update stable --no-self-update - - uses: taiki-e/setup-cross-toolchain-action@v1 - with: - target: ${{ matrix.target }} - - run: echo "RUSTFLAGS=${RUSTFLAGS} -C target-feature=+crt-static" >>"${GITHUB_ENV}" - if: endsWith(matrix.target, 'windows-msvc') - - uses: taiki-e/upload-rust-binary-action@v1 - with: - dry-run: true - bin: cargo-hack - target: ${{ matrix.target }} - tar: all - zip: windows - ref: refs/tags/dummy - token: dummy - # For debugging - - uses: actions/upload-artifact@v3 - with: - name: ${{ matrix.target }} - path: cargo-hack-${{ matrix.target }}.* + # # NB: sync with upload-assets job in release.yml. + # build: + # name: build (${{ matrix.target }}) + # strategy: + # fail-fast: false + # matrix: + # include: + # - target: aarch64-unknown-linux-gnu + # - target: aarch64-unknown-linux-musl + # - target: aarch64-apple-darwin + # os: macos-11 + # - target: aarch64-pc-windows-msvc + # os: windows-2019 + # - target: x86_64-unknown-linux-gnu + # - target: x86_64-unknown-linux-musl + # - target: x86_64-apple-darwin + # os: macos-11 + # - target: x86_64-pc-windows-msvc + # os: windows-2019 + # - target: x86_64-unknown-freebsd + # - target: universal-apple-darwin + # os: macos-11 + # runs-on: ${{ matrix.os || 'ubuntu-20.04' }} + # timeout-minutes: 60 + # steps: + # - uses: actions/checkout@v4 + # with: + # persist-credentials: false + # - name: Install Rust + # run: rustup update stable --no-self-update + # - uses: taiki-e/setup-cross-toolchain-action@v1 + # with: + # target: ${{ matrix.target }} + # - run: echo "RUSTFLAGS=${RUSTFLAGS} -C target-feature=+crt-static" >>"${GITHUB_ENV}" + # if: endsWith(matrix.target, 'windows-msvc') + # - uses: taiki-e/upload-rust-binary-action@v1 + # with: + # dry-run: true + # bin: cargo-hack + # target: ${{ matrix.target }} + # tar: all + # zip: windows + # ref: refs/tags/dummy + # token: dummy + # # For debugging + # - uses: actions/upload-artifact@v3 + # with: + # name: ${{ matrix.target }} + # path: cargo-hack-${{ matrix.target }}.* - miri: - runs-on: ubuntu-latest - timeout-minutes: 60 - steps: - - uses: actions/checkout@v4 - with: - persist-credentials: false - - name: Install Rust - run: rustup toolchain add nightly --no-self-update --component miri && rustup default nightly - - run: cargo miri test --workspace --all-features - env: - MIRIFLAGS: -Zmiri-strict-provenance -Zmiri-symbolic-alignment-check -Zmiri-disable-isolation - RUSTDOCFLAGS: ${{ env.RUSTDOCFLAGS }} -Z randomize-layout - RUSTFLAGS: ${{ env.RUSTFLAGS }} -Z randomize-layout + # miri: + # runs-on: ubuntu-latest + # timeout-minutes: 60 + # steps: + # - uses: actions/checkout@v4 + # with: + # persist-credentials: false + # - name: Install Rust + # run: rustup toolchain add nightly --no-self-update --component miri && rustup default nightly + # - run: cargo miri test --workspace --all-features + # env: + # MIRIFLAGS: -Zmiri-strict-provenance -Zmiri-symbolic-alignment-check -Zmiri-disable-isolation + # RUSTDOCFLAGS: ${{ env.RUSTDOCFLAGS }} -Z randomize-layout + # RUSTFLAGS: ${{ env.RUSTFLAGS }} -Z randomize-layout diff --git a/tests/auxiliary/mod.rs b/tests/auxiliary/mod.rs index af2af2d4..ffa22585 100644 --- a/tests/auxiliary/mod.rs +++ b/tests/auxiliary/mod.rs @@ -253,14 +253,11 @@ fn test_project(model: &str) -> Result<(TempDir, PathBuf)> { } fn git_ls_files(dir: &Path, filters: &[&str]) -> Result> { - let output = Command::new("git") - .arg("ls-files") - .args(filters) - .current_dir(dir) - .output() - .with_context(|| format!("failed to run `git ls-files {filters:?}`"))?; + let mut cmd = Command::new("git"); + cmd.arg("ls-files").args(filters).current_dir(dir); + let output = cmd.output().with_context(|| format!("failed to run `{cmd:?}`"))?; if !output.status.success() { - bail!("failed to run `git ls-files {filters:?}`"); + bail!("failed to run `{cmd:?}`"); } Ok(str::from_utf8(&output.stdout)? .lines()