Repository navigation
Add support for listing workflows for all users (#104) #300
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: Test | |
| on: | |
| pull_request: | |
| branches: | |
| - main | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| test: | |
| name: Test on ${{ matrix.os }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, windows-latest] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Free Disk Space (Ubuntu) | |
| if: matrix.os == 'ubuntu-latest' | |
| uses: jlumbroso/free-disk-space@main | |
| with: | |
| # Remove large packages we don't need | |
| tool-cache: true | |
| android: true | |
| dotnet: true | |
| haskell: true | |
| large-packages: true | |
| docker-images: true | |
| swap-storage: false | |
| - name: Install OpenSSL for Windows | |
| if: matrix.os == 'windows-latest' | |
| run: | | |
| vcpkg install openssl:x64-windows-static-md | |
| echo "OPENSSL_DIR=C:/vcpkg/installed/x64-windows-static-md" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
| echo "OPENSSL_ROOT_DIR=C:/vcpkg/installed/x64-windows-static-md" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
| echo "OPENSSL_INCLUDE_DIR=C:/vcpkg/installed/x64-windows-static-md/include" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
| echo "OPENSSL_LIB_DIR=C:/vcpkg/installed/x64-windows-static-md/lib" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
| echo "VCPKG_ROOT=C:/vcpkg" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
| - name: Setup Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Ensure cargo in PATH (Windows) | |
| if: matrix.os == 'windows-latest' | |
| run: echo "$HOME/.cargo/bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append | |
| - name: Cache cargo registry | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cargo/registry | |
| key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-cargo-registry- | |
| - name: Cache cargo index | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cargo/git | |
| key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-cargo-index- | |
| - name: Cache cargo build | |
| uses: actions/cache@v4 | |
| with: | |
| path: target | |
| key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-cargo-build-target- | |
| - name: Install SQLx CLI | |
| run: cargo install sqlx-cli --no-default-features --features sqlite | |
| - name: Setup database | |
| run: | | |
| sqlx database setup | |
| env: | |
| DATABASE_URL: sqlite:db/sqlite/dev.db | |
| - name: Build test binaries (only necessary packages) | |
| run: cargo build --all-features -p torc -p torc-server | |
| env: | |
| RUST_BACKTRACE: 1 | |
| CARGO_INCREMENTAL: 0 | |
| CARGO_TERM_COLOR: always | |
| - name: Run tests (Windows - limited test set) | |
| if: matrix.os == 'windows-latest' | |
| run: cargo test --all-features --test test_full_workflows test_many_jobs_parameterized -- --test-threads 1 | |
| env: | |
| RUST_BACKTRACE: 1 | |
| CARGO_INCREMENTAL: 0 | |
| OPENSSL_DIR: C:/vcpkg/installed/x64-windows-static-md | |
| OPENSSL_ROOT_DIR: C:/vcpkg/installed/x64-windows-static-md | |
| OPENSSL_INCLUDE_DIR: C:/vcpkg/installed/x64-windows-static-md/include | |
| OPENSSL_LIB_DIR: C:/vcpkg/installed/x64-windows-static-md/lib | |
| VCPKG_ROOT: C:/vcpkg | |
| - name: Run tests (Unix - full test suite) | |
| if: matrix.os != 'windows-latest' | |
| run: cargo test --all-features -- --test-threads 1 | |
| env: | |
| RUST_BACKTRACE: 1 | |
| CARGO_INCREMENTAL: 0 | |
| # Clean up intermediate build artifacts to free disk space for Julia | |
| # Keep only the binaries needed to run the server | |
| - name: Clean up build artifacts | |
| if: matrix.os == 'ubuntu-latest' | |
| run: | | |
| echo "Disk space before cleanup:" | |
| df -h . | |
| # Remove intermediate build artifacts but keep binaries | |
| rm -rf target/debug/deps | |
| rm -rf target/debug/incremental | |
| rm -rf target/debug/build | |
| rm -rf target/debug/.fingerprint | |
| rm -rf target/debug/examples | |
| # Clean up the entire cargo registry cache (will be restored next time) | |
| rm -rf ~/.cargo/registry/cache | |
| rm -rf ~/.cargo/registry/index | |
| rm -rf ~/.cargo/git/db | |
| echo "Disk space after cleanup:" | |
| df -h . | |
| # Python and Julia client tests (Unix only for now) | |
| - name: Setup Python | |
| if: matrix.os == 'ubuntu-latest' | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.12' | |
| - name: Install Python client dependencies | |
| if: matrix.os == 'ubuntu-latest' | |
| run: | | |
| cd python_client | |
| pip install -e .[dev] | |
| - name: Setup Julia | |
| if: matrix.os == 'ubuntu-latest' | |
| uses: julia-actions/setup-julia@v2 | |
| with: | |
| version: '1.12' | |
| - name: Install Julia dependencies | |
| if: matrix.os == 'ubuntu-latest' | |
| run: | | |
| julia --project=julia_client/Torc -e 'using Pkg; Pkg.instantiate(); using Torc' | |
| julia --project=julia_client/Torc/test -e 'using Pkg; Pkg.develop(path="julia_client/Torc"); Pkg.instantiate()' | |
| - name: Start torc server | |
| if: matrix.os == 'ubuntu-latest' | |
| run: | | |
| export DATABASE_URL=sqlite:db/sqlite/dev.db | |
| ./target/debug/torc-server run > server.log 2>&1 & | |
| SERVER_PID=$! | |
| echo "Server started with PID $SERVER_PID" | |
| # Wait for server to be ready | |
| for i in {1..30}; do | |
| if curl -s http://localhost:8080/torc-service/v1/ping > /dev/null 2>&1; then | |
| echo "Server is ready" | |
| break | |
| fi | |
| echo "Waiting for server... ($i/30)" | |
| sleep 1 | |
| done | |
| # Show server log if it failed to start | |
| if ! curl -s http://localhost:8080/torc-service/v1/ping > /dev/null 2>&1; then | |
| echo "Server failed to start. Log:" | |
| cat server.log | |
| exit 1 | |
| fi | |
| - name: Run Python client tests | |
| if: matrix.os == 'ubuntu-latest' | |
| run: | | |
| cd python_client | |
| pytest tests/ -v | |
| env: | |
| TORC_API_URL: http://localhost:8080/torc-service/v1 | |
| - name: Run Julia client tests | |
| if: matrix.os == 'ubuntu-latest' | |
| run: | | |
| julia --project=julia_client/Torc -e "import Pkg; Pkg.test()" | |
| env: | |
| TORC_API_URL: http://localhost:8080/torc-service/v1 | |
| PATH: ${{ github.workspace }}/target/debug:$PATH | |
| # - name: Install cargo-llvm-cov | |
| # if: matrix.os == 'ubuntu-latest' | |
| # run: cargo install cargo-llvm-cov | |
| # - name: Generate coverage | |
| # if: matrix.os == 'ubuntu-latest' | |
| # run: cargo llvm-cov --all-features --workspace --lcov --output-path lcov.info -- --test-threads 1 | |
| # env: | |
| # RUST_BACKTRACE: 1 | |
| # DATABASE_URL: sqlite:db/sqlite/dev.db | |
| # - name: Upload coverage to Codecov | |
| # if: matrix.os == 'ubuntu-latest' | |
| # uses: codecov/codecov-action@v4 | |
| # with: | |
| # files: lcov.info | |
| # fail_ci_if_error: false |