CI improvements #130
Workflow file for this run
This file contains 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
# yaml-language-server: $schema=./main.yaml | |
name: CI | |
on: | |
push: | |
branches: ["main"] | |
pull_request: | |
branches: ["main"] | |
env: | |
RUST_TOOLCHAIN: 1.70.0 | |
EXASOL_VERSION: 7.0.22 | |
NUM_NODES: 3 | |
ETL_TEST_THREADS: 4 | |
# The exadt tool always creates the Exasol cluster with this subnet | |
DATABASE_URL: exa://sys:[email protected]..$((10 + $NUM_NODES - 1)):8563 | |
TLS_URL: $DATABASE_URL?ssl-mode=required | |
NON_TLS_UTL: $DATABASE_URL:8563?ssl-mode=disabled | |
jobs: | |
format: | |
name: Format | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: nightly | |
override: true | |
components: rustfmt | |
- uses: actions-rs/cargo@v1 | |
with: | |
command: fmt | |
args: -- --check | |
clippy: | |
name: Clippy | |
needs: format | |
runs-on: ubuntu-20.04 | |
strategy: | |
matrix: | |
etl: | |
[ | |
"--features etl_native_tls", | |
"--features etl_rustls", | |
"--features etl", | |
"", | |
] | |
compression: ["--features compression", ""] | |
migrate: ["--features migrate", ""] | |
extra_datatypes: ["--features rust_decimal,uuid,chrono", ""] | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: stable | |
override: true | |
components: clippy | |
- uses: Swatinem/rust-cache@v2 | |
- uses: actions-rs/cargo@v1 | |
with: | |
command: clippy | |
args: --tests ${{ matrix.etl }} ${{ matrix.migrate }} ${{ matrix.compression }} ${{ matrix.extra_datatypes }} | |
env: | |
RUSTFLAGS: -D warnings | |
tests: | |
name: Tests | |
needs: clippy | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Free disk space | |
run: | | |
echo "Getting initial free space" | |
df . -h | |
sudo rm -rf \ | |
/usr/share/dotnet /usr/local/lib/android /opt/ghc \ | |
/usr/local/share/powershell /usr/share/swift /usr/local/.ghcup \ | |
/usr/lib/jvm /opt/hostedtoolcache/CodeQL || true | |
echo "Removed language runtimes" | |
df . -h | |
sudo docker image prune --all --force | |
echo "Removed docker images" | |
df . -h | |
- name: Restore Exasol image | |
id: cache-docker-exasol | |
uses: actions/cache@v3 | |
with: | |
path: ~/ci/cache/docker | |
key: cache-docker-exasol-$EXASOL_VERSION | |
- name: Store Exasol image if cache miss | |
if: steps.cache-docker-exasol.outputs.cache-hit != 'true' | |
run: docker pull exasol/docker-db:$EXASOL_VERSION && mkdir -p ~/ci/cache/docker && docker image save exasol/docker-db:$EXASOL_VERSION --output ~/ci/cache/docker/exasol-$EXASOL_VERSION.tar | |
- name: Load Exasol image | |
run: docker image load --input ~/ci/cache/docker/exasol-$EXASOL_VERSION.tar | |
- name: Set up Python 3.10 | |
uses: actions/setup-python@v3 | |
with: | |
python-version: "3.10" | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install pipenv | |
- uses: actions/checkout@v3 | |
with: | |
repository: Exasol/docker-db | |
ref: $EXASOL_VERSION | |
- name: Set up Exasol Cluster | |
run: | | |
pipenv install -r exadt_requirements.txt | |
pipenv run ./exadt create-cluster --root ~/sqlx --create-root sqlx | |
pipenv run ./exadt init-cluster --image exasol/docker-db:$EXASOL_VERSION --license ./license/license.xml --num-nodes $NUM_NODES --auto-storage sqlx | |
pipenv run ./exadt start-cluster sqlx | |
- name: Setup Rust toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: $RUST_TOOLCHAIN | |
override: true | |
- uses: Swatinem/rust-cache@v2 | |
- uses: actions/checkout@v3 | |
- name: Connection tests | |
run: cargo test --features migrate,rust_decimal,uuid,chrono -- --nocapture | |
env: | |
DATABASE_URL: $NO_TLS_URL | |
- name: Connection tests with compression | |
run: cargo test --features migrate,compression -- --ignored --nocapture | |
env: | |
DATABASE_URL: $NO_TLS_URL | |
- name: TLS connection tests | |
run: cargo test --features migrate,rust_decimal,uuid,chrono -- --nocapture | |
env: | |
DATABASE_URL: $TLS_URL | |
- name: TLS connection tests with compression | |
run: cargo test --features migrate,compression -- --ignored --nocapture | |
env: | |
DATABASE_URL: $TLS_URL | |
- name: Tests compilation failure if both ETL TLS features are enabled | |
run: cargo test --features etl_native_tls,etl_rustls || true | |
env: | |
DATABASE_URL: $TLS_URL | |
- name: ETL tests | |
timeout-minutes: 15 | |
run: cargo test --features migrate,compression,etl -- --ignored --nocapture --test-threads $ETL_TEST_THREADS | |
env: | |
DATABASE_URL: $NO_TLS_URL | |
- name: ETL without TLS feature but TLS connection (should fail) | |
run: cargo test --features migrate,etl -- --ignored --nocapture --test-threads $ETL_TEST_THREADS || true | |
env: | |
DATABASE_URL: $TLS_URL | |
- name: Native-TLS ETL tests | |
timeout-minutes: 15 | |
run: cargo test --features migrate,compression,etl_native_tls -- --ignored --nocapture --test-threads $ETL_TEST_THREADS | |
env: | |
DATABASE_URL: $TLS_URL | |
- name: Rustls ETL tests | |
timeout-minutes: 15 | |
run: cargo test --features migrate,compression,etl_rustls -- --ignored --nocapture --test-threads $ETL_TEST_THREADS | |
env: | |
DATABASE_URL: $TLS_URL |