Skip to content

Split monolithic crate lib.rs files into focused modules #491

Split monolithic crate lib.rs files into focused modules

Split monolithic crate lib.rs files into focused modules #491

name: Integration Tests
on:
push:
branches: [main]
pull_request:
branches: [main]
env:
CARGO_TERM_COLOR: always
jobs:
integration-tests:
name: Integration Tests (${{ matrix.group }})
runs-on: ubuntu-latest
timeout-minutes: 6
strategy:
fail-fast: false
matrix:
include:
- group: core
packages: -p git-cache-core -p git-cache-worker
- group: git
packages: -p git-cache-git
- group: disk
packages: -p git-cache-disk
- group: objectstore
packages: -p git-cache-objectstore
- group: api
packages: -p git-cache-api
- group: fuzz
packages: -p git-cache-fuzz
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Cache Cargo registry & build artifacts
uses: Swatinem/rust-cache@v2
with:
shared-key: integration-${{ matrix.group }}
- name: Run integration tests
env:
TMPDIR: ${{ runner.temp }}
run: |
for attempt in 1 2 3; do
echo "::group::Attempt $attempt"
if timeout 120 cargo test ${{ matrix.packages }} --test '*' 2>&1; then
echo "::endgroup::"
echo "Tests passed on attempt $attempt"
exit 0
fi
echo "::endgroup::"
if [ "$attempt" -lt 3 ]; then
echo "::warning::Attempt $attempt failed, retrying..."
sleep 2
fi
done
echo "::error::Tests failed after 3 attempts"
exit 1
minio-rust-tests:
name: MinIO Rust Tests (${{ matrix.group }})
runs-on: ubuntu-latest
timeout-minutes: 6
strategy:
fail-fast: false
matrix:
include:
- group: objectstore
command: cargo test -p git-cache-objectstore --features s3 minio_
- group: materializer
command: cargo test -p git-cache-domain --features s3-tests minio_
env:
CARGO_TERM_COLOR: always
GIT_CACHE_S3_INTEGRATION: "1"
GIT_CACHE_S3_ENDPOINT: http://127.0.0.1:9000
GIT_CACHE_S3_BUCKET: gitmirrorcache-test
GIT_CACHE_S3_ACCESS_KEY: minioadmin
GIT_CACHE_S3_SECRET_KEY: minioadmin
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Cache Cargo registry & build artifacts
uses: Swatinem/rust-cache@v2
with:
shared-key: minio-rust-${{ matrix.group }}
- name: Start MinIO
run: |
for attempt in 1 2 3; do
echo "Starting MinIO attempt ${attempt}"
if docker compose -f docker-compose.minio.yml up -d minio &&
docker compose -f docker-compose.minio.yml run --rm createbuckets; then
exit 0
fi
docker compose -f docker-compose.minio.yml down -v --remove-orphans || true
if [ "${attempt}" -lt 3 ]; then
sleep $((attempt * 5))
fi
done
exit 1
- name: Run MinIO Rust test shard
run: ${{ matrix.command }}
minio-python-api-build:
name: MinIO Python API Build
runs-on: ubuntu-latest
timeout-minutes: 6
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Cache Cargo registry & build artifacts
uses: Swatinem/rust-cache@v2
with:
shared-key: minio-python-api
- name: Build git-cache-api with S3 backend
run: cargo build -p git-cache-api --features s3
- name: Upload git-cache-api binary
uses: actions/upload-artifact@v4
with:
name: git-cache-api-s3
path: target/debug/git-cache-api
if-no-files-found: error
retention-days: 1
minio-python-integration-tests:
name: MinIO Python Integration (${{ matrix.test_name }})
runs-on: ubuntu-latest
timeout-minutes: 8
needs: minio-python-api-build
strategy:
fail-fast: false
matrix:
include:
- test_name: default-branch
test_target: integration_tests.test_astral_uv.AstralUvIntegrationTest.test_default_branch_materializes
- test_name: strict-main
test_target: integration_tests.test_astral_uv.AstralUvIntegrationTest.test_strict_main_materializes_astral_uv_and_fetches_direct_branch
- test_name: exact-cache-rehydrate
test_target: integration_tests.test_astral_uv.AstralUvIntegrationTest.test_exact_commit_rehydrates_after_hot_cache_deletion
- test_name: short-commit
test_target: integration_tests.test_astral_uv.AstralUvIntegrationTest.test_short_commit_resolves_to_full_commit
env:
CARGO_TERM_COLOR: always
GIT_CACHE_S3_INTEGRATION: "1"
GIT_CACHE_S3_ENDPOINT: http://127.0.0.1:9000
GIT_CACHE_S3_BUCKET: gitmirrorcache-test
GIT_CACHE_S3_ACCESS_KEY: minioadmin
GIT_CACHE_S3_SECRET_KEY: minioadmin
steps:
- uses: actions/checkout@v4
- name: Download git-cache-api binary
uses: actions/download-artifact@v4
with:
name: git-cache-api-s3
path: target/debug
- name: Prepare git-cache-api binary
run: chmod +x target/debug/git-cache-api
- name: Start MinIO
run: |
for attempt in 1 2 3; do
echo "Starting MinIO attempt ${attempt}"
if docker compose -f docker-compose.minio.yml up -d minio &&
docker compose -f docker-compose.minio.yml run --rm createbuckets; then
exit 0
fi
docker compose -f docker-compose.minio.yml down -v --remove-orphans || true
if [ "${attempt}" -lt 3 ]; then
sleep $((attempt * 5))
fi
done
exit 1
- name: Run Python integration tests with MinIO backend
env:
PYTHONUNBUFFERED: "1"
RUN_GITHUB_INTEGRATION: "1"
GIT_CACHE_USE_MINIO_BACKEND: "1"
GIT_CACHE_TEST_REPO: github.com/astral-sh/uv
GIT_CACHE_TEST_BRANCH: main
GIT_CACHE_API_BIN: target/debug/git-cache-api
run: python3 -m unittest -v ${{ matrix.test_target }}
cleanup-minio-python-api-artifact:
name: Delete MinIO API Artifact
runs-on: ubuntu-latest
timeout-minutes: 3
needs:
- minio-python-api-build
- minio-python-integration-tests
if: always()
permissions:
actions: write
contents: read
steps:
- name: Delete git-cache-api-s3 artifact
env:
GH_TOKEN: ${{ github.token }}
GH_REPO: ${{ github.repository }}
GH_RUN_ID: ${{ github.run_id }}
run: |
if ! artifact_ids="$(gh api "/repos/${GH_REPO}/actions/runs/${GH_RUN_ID}/artifacts?per_page=100" \
--jq '.artifacts[] | select(.name == "git-cache-api-s3") | .id')"; then
echo "::warning::Could not list artifacts for this run; continuing."
exit 0
fi
if [ -z "${artifact_ids}" ]; then
echo "No git-cache-api-s3 artifact found for this run."
exit 0
fi
while IFS= read -r artifact_id; do
[ -n "${artifact_id}" ] || continue
echo "Deleting artifact ${artifact_id} (git-cache-api-s3)"
if ! gh api --method DELETE "/repos/${GH_REPO}/actions/artifacts/${artifact_id}" >/dev/null; then
echo "::warning::Could not delete artifact ${artifact_id}; continuing."
fi
done <<< "${artifact_ids}"