Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
102 changes: 69 additions & 33 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@ jobs:
max-parallel: 15
matrix:
os:
- ubuntu-latest
- macos-latest
- windows-latest
steps:
Expand Down Expand Up @@ -159,38 +158,6 @@ jobs:
- name: Build
run: make build

# The integration tests need the docker-compose services, which are only
# available on the Linux runner, so the test steps are gated to ubuntu.
# macOS and Windows still compile the full workspace above.
- name: Install cargo-nextest
if: runner.os == 'Linux'
uses: taiki-e/install-action@4684b8405694ae9dd42c9f39ba901a70ae83f4a3 # v2.82.9
with:
tool: cargo-nextest

- name: Start Docker containers
if: runner.os == 'Linux'
run: make docker-up

- name: Run tests
if: runner.os == 'Linux'
shell: bash
env:
# HuggingFace Hub integration tests self-skip when these are unset
# (e.g. PRs from forks); see crates/storage/opendal/tests/file_io_hf_test.rs
HF_TOKEN: ${{ secrets.HF_TOKEN }}
HF_BUCKET: ${{ secrets.HF_BUCKET }}
HF_DATASET: ${{ secrets.HF_DATASET }}
run: cargo nextest run --all-targets --all-features --workspace

- name: Run doc tests
if: runner.os == 'Linux'
run: cargo test --no-fail-fast --doc --all-features --workspace

- name: Stop Docker containers
if: always() && runner.os == 'Linux'
run: make docker-down

# Checks each crate individually to catch missing feature declarations that
# are otherwise masked by Cargo's feature unification across the workspace.
check_standalone:
Expand Down Expand Up @@ -225,6 +192,75 @@ jobs:
cargo check -p "$pkg" --all-targets || exit 1
done

# The ubuntu build and tests share one runner so the dependency graph
# compiles once instead of once per job. Docker containers start in the
# background while the workspace builds so their startup time overlaps the
# compile. macOS and Windows keep their own build job above; clippy and the
# standalone crate checks run as separate ubuntu jobs.
build-and-test:
needs: lint
runs-on: ubuntu-latest
env:
CARGO_INCREMENTAL: "0"
CARGO_PROFILE_DEV_DEBUG: "0"
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
persist-credentials: false

# Container startup overlaps the workspace build; the wait step below
# joins on the result before the tests need the containers.
- name: Start Docker containers in the background
run: make docker-up-background

- name: Setup Rust toolchain
uses: ./.github/actions/setup-builder

# Image + build-definition files in the key so changed steps or a new
# runner image rotate the cache; see the build job for the rationale.
- name: Get runner image id
id: image
shell: bash
run: echo "id=${ImageOS:?}" >> "$GITHUB_OUTPUT"

- name: Cache Rust artifacts
uses: swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2
with:
key: ${{ steps.image.outputs.id }}-${{ hashFiles('.github/workflows/ci.yml', 'Makefile', 'Cargo.toml') }}
save-if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
add-rust-environment-hash-key: 'false'

- name: Build without default features
run: cargo build --locked -p iceberg --no-default-features

- name: Build
run: cargo build --locked --all-targets --all-features --workspace

- name: Install cargo-nextest
uses: taiki-e/install-action@4684b8405694ae9dd42c9f39ba901a70ae83f4a3 # v2.82.9
with:
tool: cargo-nextest

- name: Wait for Docker containers
run: make docker-wait

- name: Run tests
shell: bash
env:
# HuggingFace Hub integration tests self-skip when these are unset
# (e.g. PRs from forks); see crates/storage/opendal/tests/file_io_hf_test.rs
HF_TOKEN: ${{ secrets.HF_TOKEN }}
HF_BUCKET: ${{ secrets.HF_BUCKET }}
HF_DATASET: ${{ secrets.HF_DATASET }}
run: cargo nextest run --all-targets --all-features --workspace

- name: Run doc tests
run: cargo test --no-fail-fast --doc --all-features --workspace

- name: Stop Docker containers
if: always()
run: make docker-down

msrv:
name: Verify MSRV
needs: lint
Expand Down
12 changes: 12 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,18 @@ site: install-mdbook
docker-up:
docker compose -f dev/docker-compose.yaml up -d --build --wait

# Starts the containers without blocking so their startup can overlap other
# work (e.g. the CI build); docker-wait joins on the result.
# The subshell's stdio is fully detached so the caller (e.g. the CI runner)
# isn't left holding open pipes until the containers finish starting.
docker-up-background:
(docker compose -f dev/docker-compose.yaml up -d --build --wait > /tmp/docker-up.log 2>&1; echo $$? > /tmp/docker-up.exit) < /dev/null > /dev/null 2>&1 &

docker-wait:
@while [ ! -f /tmp/docker-up.exit ]; do sleep 2; done
@cat /tmp/docker-up.log
@exit $$(cat /tmp/docker-up.exit)

docker-down:
docker compose -f dev/docker-compose.yaml down -v --remove-orphans --timeout 0

Expand Down
Loading