Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
taiki-e committed Oct 10, 2023
1 parent bc83fcb commit 6a6fd8f
Show file tree
Hide file tree
Showing 2 changed files with 142 additions and 145 deletions.
276 changes: 138 additions & 138 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,93 +32,93 @@ 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)
runs-on: ubuntu-latest
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
Expand All @@ -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
11 changes: 4 additions & 7 deletions tests/auxiliary/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -253,14 +253,11 @@ fn test_project(model: &str) -> Result<(TempDir, PathBuf)> {
}

fn git_ls_files(dir: &Path, filters: &[&str]) -> Result<Vec<(String, PathBuf)>> {
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()
Expand Down

0 comments on commit 6a6fd8f

Please sign in to comment.