fix(ci): optimize GitHub Actions to prevent disk space issues #185
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: Rust | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Rust | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
toolchain: 'stable' | |
- name: Setup Rust cache | |
uses: Swatinem/rust-cache@v2 | |
with: | |
# Cache key differentiation | |
key: "v1-rust" | |
# Clean cache if it gets too large | |
cache-directories: | | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
target/ | |
- name: Install PostgreSQL client | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y postgresql-client | |
- name: Build and test | |
run: | | |
# Build in release mode to save space and be faster | |
cargo build --release | |
# Run tests (this will reuse the release build where possible) | |
cargo test --release | |
- name: Install bc (for test timing calculations) | |
run: sudo apt-get install -y bc | |
- name: Run integration tests - TCP with SSL | |
run: | | |
chmod +x tests/runner/run_ssl_tests.sh | |
./tests/runner/run_ssl_tests.sh --mode tcp-ssl | |
- name: Run integration tests - TCP without SSL | |
run: ./tests/runner/run_ssl_tests.sh --mode tcp-no-ssl | |
- name: Run integration tests - Unix socket | |
run: ./tests/runner/run_ssl_tests.sh --mode unix-socket | |
- name: Run integration tests - File DB with SSL | |
run: ./tests/runner/run_ssl_tests.sh --mode file-ssl | |
- name: Run integration tests - File DB without SSL | |
run: ./tests/runner/run_ssl_tests.sh --mode file-no-ssl |