ci: parallelize ci better (#594)

Parallelizes the CI workflow better.
This commit is contained in:
Clement Tsang 2021-10-03 17:49:29 -04:00 committed by GitHub
parent 31072d1952
commit a1a33e0120
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 108 additions and 34 deletions

View File

@ -69,7 +69,7 @@ jobs:
- run: cargo clippy --all-targets --workspace -- -D warnings - run: cargo clippy --all-targets --workspace -- -D warnings
# Compile/check/test. # Run cargo --check on all platforms
check: check:
needs: [rustfmt, clippy] needs: [rustfmt, clippy]
runs-on: ${{ matrix.triple.os }} runs-on: ${{ matrix.triple.os }}
@ -78,13 +78,12 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
triple: triple:
# Standard x86-64 stuff, stable # x86 or x64
- { - {
os: "ubuntu-latest", os: "ubuntu-latest",
target: "x86_64-unknown-linux-gnu", target: "x86_64-unknown-linux-gnu",
cross: false, cross: false,
rust: stable, rust: stable,
toTest: "true",
} }
- { - {
os: "ubuntu-latest", os: "ubuntu-latest",
@ -92,51 +91,42 @@ jobs:
cross: true, cross: true,
rust: stable, rust: stable,
} }
# - { - {
# os: "ubuntu-latest", os: "ubuntu-latest",
# target: "x86_64-unknown-linux-musl", target: "x86_64-unknown-linux-musl",
# cross: false, cross: false,
# rust: stable, rust: stable,
# } }
# - { - {
# os: "ubuntu-latest", os: "ubuntu-latest",
# target: "i686-unknown-linux-musl", target: "i686-unknown-linux-musl",
# cross: true, cross: true,
# rust: stable, rust: stable,
# } }
- { - {
os: "macOS-latest", os: "macOS-latest",
target: "x86_64-apple-darwin", target: "x86_64-apple-darwin",
cross: false, cross: false,
rust: stable, rust: stable,
toTest: "true",
} }
# Big Sur builds are disabled, unfortunately.
# - {
# os: "macOS-11.0",
# target: "x86_64-apple-darwin",
# cross: false,
# rust: stable,
# }
- { - {
os: "windows-2019", os: "windows-2019",
target: "x86_64-pc-windows-msvc", target: "x86_64-pc-windows-msvc",
cross: false, cross: false,
rust: stable, rust: stable,
toTest: "true",
} }
- { - {
os: "windows-2019", os: "windows-2019",
target: "i686-pc-windows-msvc", target: "i686-pc-windows-msvc",
cross: true, cross: false,
rust: stable,
}
- {
os: "windows-2019",
target: "x86_64-pc-windows-gnu",
cross: false,
rust: stable, rust: stable,
} }
# - {
# os: "windows-2019",
# target: "x86_64-pc-windows-gnu",
# cross: false,
# rust: stable,
# }
# aarch64 # aarch64
- { - {
@ -208,16 +198,100 @@ jobs:
args: --all-targets --verbose --target=${{ matrix.triple.target }} --features "battery" args: --all-targets --verbose --target=${{ matrix.triple.target }} --features "battery"
use-cross: ${{ matrix.triple.cross }} use-cross: ${{ matrix.triple.cross }}
# Check without the battery feature enabled on x86-64 for supported operating systems
check-without-battery:
needs: [rustfmt, clippy]
runs-on: ${{ matrix.triple.os }}
continue-on-error: true
strategy:
fail-fast: false
matrix:
triple:
- {
os: "ubuntu-latest",
target: "x86_64-unknown-linux-gnu",
cross: false,
rust: stable,
}
- {
os: "macOS-latest",
target: "x86_64-apple-darwin",
cross: false,
rust: stable,
}
- {
os: "windows-2019",
target: "x86_64-pc-windows-msvc",
cross: false,
rust: stable,
}
steps:
- uses: actions/checkout@v2
- name: Install toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.triple.rust }}
override: true
target: ${{ matrix.triple.target }}
- uses: Swatinem/rust-cache@v1
with:
key: ${{ matrix.triple.target }}
- name: Check without battery feature on the main 3 - name: Check without battery feature on the main 3
if: matrix.triple.toTest == 'true'
uses: actions-rs/cargo@v1 uses: actions-rs/cargo@v1
with: with:
command: check command: check
args: --all-targets --verbose --target=${{ matrix.triple.target }} args: --all-targets --verbose --target=${{ matrix.triple.target }} --no-default-features
use-cross: ${{ matrix.triple.cross }} use-cross: ${{ matrix.triple.cross }}
# Run tests x86-64 for supported operating systems
test:
needs: [rustfmt, clippy]
runs-on: ${{ matrix.triple.os }}
continue-on-error: true
strategy:
fail-fast: false
matrix:
triple:
- {
os: "ubuntu-latest",
target: "x86_64-unknown-linux-gnu",
cross: false,
rust: stable,
}
- {
os: "macOS-latest",
target: "x86_64-apple-darwin",
cross: false,
rust: stable,
}
- {
os: "windows-2019",
target: "x86_64-pc-windows-msvc",
cross: false,
rust: stable,
}
steps:
- uses: actions/checkout@v2
- name: Install toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.triple.rust }}
override: true
target: ${{ matrix.triple.target }}
- uses: Swatinem/rust-cache@v1
with:
key: ${{ matrix.triple.target }}
- name: Run tests - name: Run tests
if: matrix.triple.toTest == 'true'
run: cargo test --no-fail-fast run: cargo test --no-fail-fast
env: env:
CARGO_HUSKY_DONT_INSTALL_HOOKS: true CARGO_HUSKY_DONT_INSTALL_HOOKS: true