Add delta table support #12
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
pull_request: | |
types: [opened, synchronize, reopened, labeled] | |
workflow_dispatch: | |
env: | |
CARGO_TERM_COLOR: always | |
permissions: | |
contents: read | |
jobs: | |
check: | |
name: Check | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
check: [fmt, clippy] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Install Rust toolchain | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
components: ${{ matrix.check == 'fmt' && 'rustfmt' || 'clippy' }} | |
- name: Setup Rust cache | |
uses: Swatinem/rust-cache@v2 | |
with: | |
key: ${{ matrix.check }} | |
- name: Run cargo fmt | |
if: matrix.check == 'fmt' | |
run: cargo fmt --check | |
- name: Run cargo clippy | |
if: matrix.check == 'clippy' | |
run: cargo clippy --all-targets --all-features --no-deps -- -D warnings | |
test: | |
name: Test | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
id-token: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Install Rust toolchain | |
uses: dtolnay/rust-toolchain@stable | |
- name: Setup Rust cache | |
uses: Swatinem/rust-cache@v2 | |
with: | |
key: test | |
- name: Start Docker Compose Environment | |
run: | | |
docker compose -f ./scripts/docker-compose.yaml up -d | |
- name: Install sqlx-cli | |
run: | | |
cargo install sqlx-cli \ | |
--features native-tls,postgres \ | |
--no-default-features \ | |
--locked | |
- name: Migrate database | |
env: | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: postgres | |
POSTGRES_DB: postgres | |
POSTGRES_PORT: 5430 | |
POSTGRES_HOST: localhost | |
run: | | |
sudo apt-get install libpq-dev -y | |
./etl-api/scripts/run_migrations.sh | |
- name: Install cargo-llvm-cov | |
uses: taiki-e/install-action@cargo-llvm-cov | |
- name: Set up BigQuery environment variables and credentials | |
env: | |
BIGQUERY_SA_KEY: ${{ secrets.TESTS_BIGQUERY_SA_KEY_JSON }} | |
BIGQUERY_PROJECT_ID: ${{ secrets.TESTS_BIGQUERY_PROJECT_ID }} | |
run: | | |
if [ -n "$BIGQUERY_SA_KEY" ] && [ -n "$BIGQUERY_PROJECT_ID" ]; then | |
echo "BigQuery credentials found - setting up BigQuery testing environment" | |
printf '%s' '${{ secrets.TESTS_BIGQUERY_SA_KEY_JSON }}' > /tmp/bigquery-sa-key.json | |
echo "TESTS_BIGQUERY_PROJECT_ID=${{ secrets.TESTS_BIGQUERY_PROJECT_ID }}" >> $GITHUB_ENV | |
echo "TESTS_BIGQUERY_SA_KEY_PATH=/tmp/bigquery-sa-key.json" >> $GITHUB_ENV | |
echo "BIGQUERY_TESTS_ENABLED=true" >> $GITHUB_ENV | |
else | |
echo "BigQuery credentials not available - BigQuery tests will be skipped" | |
echo "BIGQUERY_TESTS_ENABLED=false" >> $GITHUB_ENV | |
fi | |
- name: Generate code coverage | |
id: coverage | |
run: | | |
if [ "$BIGQUERY_TESTS_ENABLED" = "true" ]; then | |
echo "Running all tests including BigQuery integration tests" | |
cargo llvm-cov test \ | |
--workspace --no-fail-fast \ | |
--all-features \ | |
--lcov --output-path lcov.info | |
else | |
echo "Running tests excluding BigQuery integration tests (credentials not available)" | |
cargo llvm-cov test \ | |
--workspace --no-fail-fast \ | |
--all-features \ | |
--lcov --output-path lcov.info \ | |
-- --skip bigquery | |
fi | |
- name: Upload coverage to Coveralls | |
uses: coverallsapp/github-action@v2 | |
with: | |
fail-on-error: false | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
path-to-lcov: lcov.info | |
debug: true |