Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ci: Add integration test with other widely used crates #979

Closed
wants to merge 12 commits into from
76 changes: 76 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -198,3 +198,79 @@ jobs:
shell: bash
- uses: Swatinem/rust-cache@v2
- run: cargo fmt -- --check

integration-test:
name: Test crates depend on cc
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
cc-parallel: [Y, N]
os: [ubuntu-latest, macos-latest, windows-latest]
repo:
- sfackler/rust-openssl
- gyscos/zstd-rs
- rust-lang/libz-sys
include:
- repo: sfackler/rust-openssl
features: --features vendored

steps:
- name: Checkout cc
uses: actions/checkout@v4
with:
path: cc

- name: Checkout ${{ matrix.repo }}
uses: actions/checkout@v4
with:
path: repo-to-test
repository: ${{ matrix.repo }}
submodules: recursive

- name: Install Rust
run: |
rustup toolchain install stable --no-self-update --profile minimal
rustup default stable
shell: bash
- name: Install tools
uses: taiki-e/install-action@v2
with:
tool: cargo-nextest

- name: Enable cc/parallel
if: matrix.cc-parallel == 'Y'
run: echo 'default = ["parallel"]' >> cc/Cargo.toml

- uses: Swatinem/rust-cache@v2
with:
workspaces: "repo-to-test -> target"

- name: Build and run tests
run: |
cargo update
cargo nextest run ${{ matrix.features }} $PATCH_ARGS --workspace
cargo test --doc ${{ matrix.features }} $PATCH_ARGS --workspace
working-directory: repo-to-test
env:
PATCH_ARGS: --config=patch.crates-io.cc.path="../cc"
shell: bash

# Dummy job to have a stable name for the "all tests pass" requirement
tests-pass:
name: Tests pass
needs:
- test
- check-tvos
- cuda
- msrv
- clippy
- rustfmt
- integration-test
if: always() # always run even if dependencies fail
runs-on: ubuntu-latest
steps:
# fail if ANY dependency has failed or cancelled
- if: "contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')"
run: exit 1
- run: exit 0
6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@ rust-version = "1.53"
# which is still an issue with `resolver = "1"`.
libc = { version = "0.2.62", default-features = false, optional = true }

[features]
parallel = ["libc"]

[dev-dependencies]
tempfile = "3"

Expand All @@ -35,3 +32,6 @@ members = [
"dev-tools/cc-test",
"dev-tools/gen-windows-sys-binding",
]

[features]
parallel = ["libc"]