name: pr CI on: pull_request: branches: [ "main" ] concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: test: name: Test Suite runs-on: ubuntu-24.04 timeout-minutes: 20 services: postgres: image: postgres:18.4-alpine env: POSTGRES_USER: ${{ secrets.DB_TEST_USER || 'testuser' }} POSTGRES_PASSWORD: ${{ secrets.DB_TEST_PASSWORD || 'testpassword' }} POSTGRES_DB: ${{ secrets.DB_TEST_NAME || 'testdb' }} options: >- --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 # Garage S3 service - just like in docker-compose! garage: image: dxflrs/garage:v2.3.0 env: GARAGE_SERVER_BIND_ADDR: "0.0.0.0:3900" GARAGE_S3_API_BIND_ADDR: "0.0.0.0:3900" GARAGE_CLUSTER_REPLICATION_MODE: "none" GARAGE_RPC_SECRET: "w03ABWJDfYsrkd+WpT/7G7gVkFCJQi+MGt/+1nyy0hc=" GARAGE_ADMIN_TOKEN: "test-admin-token" GARAGE_DEFAULT_ACCESS_KEY: "test" GARAGE_DEFAULT_SECRET_KEY: "test" GARAGE_DEFAULT_BUCKET: "soaricarus-ci-bucket" GARAGE_S3_REGION: "us-east-1" GARAGE_DATA_DIR: "/data" GARAGE_METADATA_DIR: "/data/meta" ports: - 3900:3900 options: >- --health-cmd "curl -f http://localhost:3900/ || exit 1" --health-interval 10s --health-timeout 5s --health-retries 5 command: ["/garage", "server", "--single-node", "--default-bucket"] steps: - uses: actions/checkout@v6 - uses: actions-rust-lang/setup-rust-toolchain@v1 with: toolchain: 1.97 - uses: Swatinem/rust-cache@v2 - name: Verify Docker Environment run: | echo "Runner User Info:" id echo "Checking Docker Version:" docker --version echo "Checking Docker Daemon Status (info):" docker info echo "Checking Docker Daemon Status (ps):" docker ps -a echo "Docker environment check complete." - name: Setup S3 run: | sudo apt update sudo apt install curl unzip -y curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" unzip awscliv2.zip sudo ./aws/install aws --version # Garage is accessible at localhost:3900 sleep 15 docker ps -a | grep garage || echo "Garage container not found" sleep 15 echo "Same old" curl -v http://localhost:3900 # Create bucket aws --endpoint-url=http://localhost:3900 s3 mb s3://soaricarus-ci-bucket --region us-east-1 - name: Run tests env: # Define DATABASE_URL for tests to use DATABASE_URL: postgresql://${{ secrets.DB_TEST_USER || 'testuser' }}:${{ secrets.DB_TEST_PASSWORD || 'testpassword' }}@postgres:5432/${{ secrets.DB_TEST_NAME || 'testdb' }} RUST_LOG: info # Optional: configure test log level SECRET_MAIN_KEY: ${{ secrets.TOKEN_SECRET_KEY }} SSH_AUTH_SOCK: ${{ env.SSH_AUTH_SOCK }} ROOT_DIRECTORY: "/tmp" AWS_ACCESS_KEY_ID: test AWS_SECRET_ACCESS_KEY: test AWS_DEFAULT_REGION: us-east-1 GARAGE_DEFAULT_ACCESS_KEY: test GARAGE_DEFAULT_SECRET_KEY: test GARAGE_S3_REGION: us-east-1 S3_BUCKET_NAME: "soaricarus-ci-bucket" S3_ENDPOINT_URL: "http://localhost:9090" AWS_S3_FORCE_PATH_STYLE: "true" run: | mkdir -p ~/.ssh echo "${{ secrets.MYREPO_TOKEN }}" > ~/.ssh/soaricarus_models_deploy_key chmod 600 ~/.ssh/soaricarus_models_deploy_key ssh-keyscan ${{ secrets.MYHOST }} >> ~/.ssh/known_hosts eval $(ssh-agent -s) ssh-add -v ~/.ssh/soaricarus_models_deploy_key cargo test