|
| 1 | +# This GitHub Actions workflow runs PostgreSQL integration tests for the orchestrator-rs project. |
| 2 | +# It is designed to run on Ubuntu 24.04 or later, and will: |
| 3 | +# - Checkout the repository |
| 4 | +# - Install Rust (stable toolchain) |
| 5 | +# - Install Docker (required for database tests) |
| 6 | +# - Run the Rust tests for the database::postgresql module in single-threaded mode |
| 7 | +# |
| 8 | +# Usage: |
| 9 | +# - Triggered on push or pull request to the main branch |
| 10 | +# - The RUST_LOG=debug environment variable is set for verbose test output |
| 11 | +# - Only tests matching the filter `database::postgresql` are run, with `--test-threads=1` to avoid migration race conditions |
| 12 | + |
| 13 | +name: PostgreSQL Integration Tests |
| 14 | + |
| 15 | +on: |
| 16 | + push: |
| 17 | + branches: [ main ] |
| 18 | + pull_request: |
| 19 | + branches: [ main ] |
| 20 | + |
| 21 | +jobs: |
| 22 | + test-postgresql: |
| 23 | + runs-on: ubuntu-24.04 |
| 24 | + steps: |
| 25 | + - name: Checkout repository |
| 26 | + uses: actions/checkout@v4 |
| 27 | + # Checks out the source code so it can be built and tested |
| 28 | + |
| 29 | + - name: Install Rust Nightly |
| 30 | + uses: actions-rs/toolchain@v1 |
| 31 | + with: |
| 32 | + toolchain: nightly |
| 33 | + profile: minimal |
| 34 | + override: true |
| 35 | + # Installs the nightly Rust toolchain for building and testing |
| 36 | + |
| 37 | + - name: Remove conflicting container packages |
| 38 | + run: | |
| 39 | + for pkg in docker.io docker-doc docker-compose docker-compose-v2 podman-docker containerd runc; do sudo apt-get remove -y $pkg; done |
| 40 | + # Removes any potentially conflicting container packages before installing Docker |
| 41 | + |
| 42 | + - name: Install Docker (official method) |
| 43 | + run: | |
| 44 | + sudo apt-get update |
| 45 | + sudo apt-get install -y ca-certificates curl |
| 46 | + sudo install -m 0755 -d /etc/apt/keyrings |
| 47 | + sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc |
| 48 | + sudo chmod a+r /etc/apt/keyrings/docker.asc |
| 49 | + echo \ |
| 50 | + "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \ |
| 51 | + $(. /etc/os-release && echo \"${UBUNTU_CODENAME:-$VERSION_CODENAME}\") stable" | \ |
| 52 | + sudo tee /etc/apt/sources.list.d/docker.list > /dev/null |
| 53 | + sudo apt-get update |
| 54 | + sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin |
| 55 | + # Installs Docker using the official apt repository and recommended packages |
| 56 | + |
| 57 | + - name: Run PostgreSQL integration tests |
| 58 | + env: |
| 59 | + RUST_LOG: debug |
| 60 | + run: | |
| 61 | + cargo test database::postgresql -- --test-threads=1 |
| 62 | + # Runs only the database::postgresql tests in single-threaded mode for reliability |
0 commit comments