Skip to content

CI improvements

CI improvements #138

Workflow file for this run

# 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
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-${{ env.EXASOL_VERSION }}
- name: Store Exasol image if cache miss
if: steps.cache-docker-exasol.outputs.cache-hit != 'true'
run: docker pull exasol/docker-db:${{ env.EXASOL_VERSION }} && mkdir -p ~/ci/cache/docker && docker image save exasol/docker-db:${{ env.EXASOL_VERSION }} --output ~/ci/cache/docker/exasol-${{ env.EXASOL_VERSION }}.tar
- name: Load Exasol image
run: docker image load --input ~/ci/cache/docker/exasol-${{ env.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: ${{ env.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:${{ env.EXASOL_VERSION }} --license ./license/license.xml --num-nodes ${{ env.NUM_NODES }} --auto-storage sqlx
pipenv run ./exadt start-cluster sqlx
docker update --memory=2g --memory-swap=2g $(docker ps | awk 'NR>1 {print $1}')
- name: Setup Rust toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ env.RUST_TOOLCHAIN }}
override: true
- uses: Swatinem/rust-cache@v2
- uses: actions/checkout@v3
# The exadt tool always creates the Exasol cluster with this subnet
- name: Create connection strings
run: |
DATABASE_URL="exa://sys:[email protected]$NUM_NODES:8563"
echo "NO_TLS_URL=$DATABASE_URL?ssl-mode=disabled" >> $GITHUB_ENV
echo "TLS_URL=$DATABASE_URL?ssl-mode=required" >> $GITHUB_ENV
- name: Connection tests
run: cargo test --features migrate,rust_decimal,uuid,chrono -- --nocapture
env:
DATABASE_URL: ${{ env.NO_TLS_URL }}
- name: Connection tests with compression
run: cargo test --features migrate,compression -- --ignored --nocapture
env:
DATABASE_URL: ${{ env.NO_TLS_URL }}
- name: TLS connection tests
run: cargo test --features migrate,rust_decimal,uuid,chrono -- --nocapture
env:
DATABASE_URL: ${{ env.TLS_URL }}
- name: TLS connection tests with compression
run: cargo test --features migrate,compression -- --ignored --nocapture
env:
DATABASE_URL: ${{ env.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: ${{ env.TLS_URL }}
- name: ETL tests
timeout-minutes: 15
run: cargo test --features migrate,compression,etl -- --ignored --nocapture --test-threads ${{ env.ETL_TEST_THREADS }}
env:
DATABASE_URL: ${{ env.NO_TLS_URL }}
- name: ETL without TLS feature but TLS connection (should fail)
run: cargo test --features migrate,etl -- --ignored --nocapture --test-threads ${{ env.ETL_TEST_THREADS }} || true
env:
DATABASE_URL: ${{ env.TLS_URL }}
- name: Native-TLS ETL tests
timeout-minutes: 15
run: cargo test --features migrate,compression,etl_native_tls -- --ignored --nocapture --test-threads ${{ env.ETL_TEST_THREADS }}
env:
DATABASE_URL: ${{ env.TLS_URL }}
- name: Rustls ETL tests
timeout-minutes: 15
run: cargo test --features migrate,compression,etl_rustls -- --ignored --nocapture --test-threads ${{ env.ETL_TEST_THREADS }}
env:
DATABASE_URL: ${{ env.TLS_URL }}