Skip to content

Commit

Permalink
ci: consolidate tasks and use sccache and nextest
Browse files Browse the repository at this point in the history
  • Loading branch information
shadaj committed Jan 8, 2024
1 parent af6e3be commit 2d2764e
Show file tree
Hide file tree
Showing 8 changed files with 104 additions and 143 deletions.
18 changes: 18 additions & 0 deletions .config/nextest.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[test-groups]
serial-integration = { max-threads = 1 }

[[profile.default.overrides]]
filter = 'binary(deadlock_detector)'
test-group = 'serial-integration'

[[profile.default.overrides]]
filter = 'binary(two_pc)'
test-group = 'serial-integration'

[[profile.default.overrides]]
filter = 'binary(kvs)'
test-group = 'serial-integration'

[[profile.default.overrides]]
filter = 'binary(kvs_replicated)'
test-group = 'serial-integration'
146 changes: 67 additions & 79 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
cancel_others: "true"

check:
name: Check
name: Lint and Check
if: ${{ needs.pre_job.outputs.should_skip != 'true' || github.event_name != 'pull_request' }}
timeout-minutes: 15
needs: pre_job
Expand All @@ -40,7 +40,15 @@ jobs:
# resolve to 'nothing' so we will exclude 'nothing'. https://stackoverflow.com/a/73822998
- rust_release: ${{ (needs.pre_job.outputs.should_skip != 'true' && 'nothing') || 'pinned-nightly' }}
- rust_release: ${{ (github.event_name != 'pull_request' && 'nothing') || 'latest-nightly' }}
- os: ${{ (github.event_name != 'pull_request' && 'nothing') || 'windows-latest' }}

env:
CARGO_TERM_COLOR: always
CARGO_INCREMENTAL: 0
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache"
CARGO_PROFILE_DEV_STRIP: "debuginfo"
CARGO_PROFILE_TEST_STRIP: "debuginfo"
CARGO_PROFILE_RELEASE_STRIP: "debuginfo"

steps:
- name: Checkout sources
Expand All @@ -53,6 +61,22 @@ jobs:
toolchain: nightly
override: ${{ matrix.rust_release == 'latest-nightly' }}

- name: Run sccache-cache
uses: mozilla-actions/[email protected]

- name: Run cargo fmt
if: ${{ matrix.os == 'ubuntu-latest' }}
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check

- name: Run cargo clippy
uses: actions-rs/cargo@v1
with:
command: clippy
args: --all-targets --features python -- -D warnings

- name: Run cargo check
uses: actions-rs/cargo@v1
with:
Expand Down Expand Up @@ -108,20 +132,22 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
target_selection:
- "--lib --bins"
- "--examples"
- "--tests"
- "--benches"
- "--doc"
rust_release: [pinned-nightly, latest-nightly]
exclude:
# For non-pull requests, event_name != 'pull_request' will be true, and 'nothing' is
# truthy, so the entire && operator will resolve to 'nothing'. Then the || operator will
# resolve to 'nothing' so we will exclude 'nothing'. https://stackoverflow.com/a/73822998
- rust_release: ${{ (needs.pre_job.outputs.should_skip != 'true' && 'nothing') || 'pinned-nightly' }}
- rust_release: ${{ (github.event_name != 'pull_request' && 'nothing') || 'latest-nightly' }}
- os: ${{ (github.event_name != 'pull_request' && 'nothing') || 'windows-latest' }}

env:
CARGO_TERM_COLOR: always
CARGO_INCREMENTAL: 0
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache"
CARGO_PROFILE_DEV_STRIP: "debuginfo"
CARGO_PROFILE_TEST_STRIP: "debuginfo"
CARGO_PROFILE_RELEASE_STRIP: "debuginfo"

steps:
- name: Checkout sources
Expand All @@ -134,81 +160,37 @@ jobs:
toolchain: nightly
override: ${{ matrix.rust_release == 'latest-nightly' }}

- name: Run cargo test on target_selection
uses: actions-rs/cargo@v1
with:
command: test
args: --profile cidev --no-fail-fast --features python ${{ matrix.target_selection }}
- name: Run sccache-cache
uses: mozilla-actions/[email protected]

test-wasm:
name: Test Suite (WebAssembly)
if: ${{ needs.pre_job.outputs.should_skip != 'true' || github.event_name != 'pull_request' }}
timeout-minutes: 15
needs: pre_job
runs-on: ubuntu-latest
strategy:
matrix:
rust_release: [pinned-nightly, latest-nightly]
exclude:
# For non-pull requests, event_name != 'pull_request' will be true, and 'nothing' is
# truthy, so the entire && operator will resolve to 'nothing'. Then the || operator will
# resolve to 'nothing' so we will exclude 'nothing'. https://stackoverflow.com/a/73822998
- rust_release: ${{ (needs.pre_job.outputs.should_skip != 'true' && 'nothing') || 'pinned-nightly' }}
- rust_release: ${{ (github.event_name != 'pull_request' && 'nothing') || 'latest-nightly' }}

steps:
- name: Checkout sources
uses: actions/checkout@v3

- name: Install nightly toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
target: wasm32-unknown-unknown
override: ${{ matrix.rust_release == 'latest-nightly' }}
- name: Install cargo-nextest (linux)
if: ${{ matrix.os == 'ubuntu-latest' }}
run: curl -LsSf https://get.nexte.st/latest/linux | tar zxf - -C ${CARGO_HOME:-~/.cargo}/bin

- name: Get wasm-bindgen version
id: wasm-bindgen-version
run: echo "VERSION=$(cargo pkgid wasm-bindgen-shared | cut -d '@' -f2)" >> "$GITHUB_OUTPUT"
- name: Install cargo-nextest (windows)
if: ${{ matrix.os == 'windows-latest' }}
shell: bash
run: curl -LsSf https://get.nexte.st/latest/windows-tar | tar zxf - -C ${CARGO_HOME:-~/.cargo}/bin

- name: Install WebAssembly test runner
- name: Run cargo nextest on all targets
uses: actions-rs/cargo@v1
with:
command: install
args: wasm-bindgen-cli@${{ steps.wasm-bindgen-version.outputs.VERSION }}
command: nextest
args: run --no-fail-fast --features python --all-targets

- name: Run cargo test
- name: Run doctests
uses: actions-rs/cargo@v1
env:
CARGO_TARGET_WASM32_UNKNOWN_UNKNOWN_RUNNER: wasm-bindgen-test-runner
with:
command: test
args: -p hydroflow --target wasm32-unknown-unknown --tests --no-fail-fast

test-cli:
name: Test CLI
if: ${{ needs.pre_job.outputs.should_skip != 'true' || github.event_name != 'pull_request' }}
timeout-minutes: 25
needs: pre_job
runs-on: ubuntu-latest

steps:
- name: Checkout sources
uses: actions/checkout@v3

- name: Install nightly toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
args: --no-fail-fast --features python --doc

- name: Install Python
uses: actions/setup-python@v4
with:
python-version: '3.11'

- name: Build CLI
shell: bash
run: |
cd hydro_deploy/hydro_cli
python -m venv .venv
Expand All @@ -217,18 +199,18 @@ jobs:
maturin develop
- name: Run Python tests
shell: bash
run: |
ulimit -c unlimited
cd hydro_deploy/hydro_cli
source .venv/bin/activate
cd python_tests
pip install -r requirements.txt
RUST_BACKTRACE=1 pytest *.py
lints:
name: Lints
test-wasm:
name: Test Suite (WebAssembly)
if: ${{ needs.pre_job.outputs.should_skip != 'true' || github.event_name != 'pull_request' }}
timeout-minutes: 10
timeout-minutes: 15
needs: pre_job
runs-on: ubuntu-latest
strategy:
Expand All @@ -250,20 +232,26 @@ jobs:
with:
profile: minimal
toolchain: nightly
target: wasm32-unknown-unknown
override: ${{ matrix.rust_release == 'latest-nightly' }}
components: rustfmt, clippy

- name: Run cargo fmt
- name: Get wasm-bindgen version
id: wasm-bindgen-version
run: echo "VERSION=$(cargo pkgid wasm-bindgen-shared | cut -d '@' -f2)" >> "$GITHUB_OUTPUT"

- name: Install WebAssembly test runner
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
command: install
args: wasm-bindgen-cli@${{ steps.wasm-bindgen-version.outputs.VERSION }}

- name: Run cargo clippy
- name: Run cargo test
uses: actions-rs/cargo@v1
env:
CARGO_TARGET_WASM32_UNKNOWN_UNKNOWN_RUNNER: wasm-bindgen-test-runner
with:
command: clippy
args: --all-targets --features python -- -D warnings
command: test
args: -p hydroflow --target wasm32-unknown-unknown --tests --no-fail-fast

build-website:
name: Build Website
Expand Down
47 changes: 7 additions & 40 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 0 additions & 8 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,6 @@ strip = true # Strip symbols from the binary
opt-level = 3
lto = "fat"

# There is only around 19GB of free space on the github free default runners
# without stripping the debug info, the build artefacts take up about 19GB
# with stripping the debug info, they take up about 5GB, so in ci we can use this profile to
# avoid running out of disk space.
[profile.cidev]
inherits = "dev"
strip = "debuginfo"

[profile.profile]
inherits = "release"
debug = 2
Expand Down
2 changes: 1 addition & 1 deletion benches/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ license = "Apache-2.0"
[dependencies]

[dev-dependencies]
criterion = { version = "0.4", features = [ "async_tokio", "html_reports" ] }
criterion = { version = "0.5", features = [ "async_tokio", "html_reports" ] }
hydroflow = { path = "../hydroflow" }
lazy_static = "1.4.0"
# pprof = { version = "0.6", features = [ "flamegraph", "criterion" ] }
Expand Down
3 changes: 2 additions & 1 deletion hydro_deploy/core/src/hydroflow_crate/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,8 @@ mod tests {

let service = deployment.add_service(
HydroflowCrate::new("../hydro_cli_examples", localhost.clone())
.example("panic_program"),
.example("panic_program")
.profile("dev"),
);

deployment.deploy().await.unwrap();
Expand Down
2 changes: 1 addition & 1 deletion hydroflow/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -89,4 +89,4 @@ zipf = "7.0.0"

[target.'cfg(not(target_arch = "wasm32"))'.dev-dependencies]
# Rayon (rust data-parallelism library) does not compile on WASM.
criterion = { version = "0.4", features = [ "async_tokio", "html_reports" ] }
criterion = { version = "0.5", features = [ "async_tokio", "html_reports" ] }
Loading

0 comments on commit 2d2764e

Please sign in to comment.