From b182a94c0af91eb5b9cfdf5b955c3cc7d96fcc63 Mon Sep 17 00:00:00 2001 From: usamoi Date: Sun, 3 Nov 2024 00:47:29 +0800 Subject: [PATCH] add Windows CI --- .github/workflows/tests.yml | 73 +++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index f9e16464c..2320ded61 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -579,3 +579,76 @@ jobs: - name: Stop sccache server run: sccache --stop-server || true + + build_windows: + name: Windows build & test + needs: lintck + runs-on: ${{ matrix.os }} + if: "!contains(github.event.head_commit.message, 'nogha')" + env: + RUSTC_WRAPPER: sccache + SCCACHE_DIR: C:\Users\runneradmin\sccache + SCCACHE_IDLE_TIMEOUT: 0 + PG_VER: ${{ matrix.postgresql }} + + strategy: + matrix: + os: [ "windows-latest" ] + postgresql: [ 17 ] + + steps: + - uses: actions/checkout@v4 + + - name: Set up prerequisites and environment + run: | + Write-Output "" + + echo "----- Install sccache -----" + Invoke-WebRequest -Uri "https://github.com/mozilla/sccache/releases/download/v0.5.4/sccache-v0.5.4-x86_64-pc-windows-msvc.tar.gz" -OutFile "sccache.tar.gz" + tar -xzvf sccache.tar.gz + Move-Item -Force "sccache-v0.5.4-x86_64-pc-windows-msvc\sccache.exe" -Destination "C:\Windows\System32" + New-Item -ItemType Directory -Force -Path $env:SCCACHE_DIR | Out-Null + sccache --version + + Write-Output "----- Outputting env -----" + Get-ChildItem Env: + Write-Output "" + + + - name: Cache sccache directory + uses: actions/cache@v4 + continue-on-error: false + with: + path: C:\Users\runneradmin\sccache + key: pgrx-sccache-${{matrix.os}}-${{ hashFiles('**/Cargo.lock', '.github/workflows/tests.yml', '.cargo/config.toml') }} + + - name: Cache cargo directory + uses: actions/cache@v4 + with: + path: | + ~/.cargo + key: pgrx-cargo-${{matrix.os}}-tests-${{ hashFiles('**/Cargo.lock', '.github/workflows/tests.yml', '.cargo/config.toml') }} + + - name: Start sccache server + run: sccache --start-server + + - name: Print sccache stats + run: sccache --show-stats + + - name: Install cargo-pgrx + run: cargo install --path cargo-pgrx/ --debug --force + + - name: Print sccache stats + run: sccache --show-stats + + - name: Run 'cargo pgrx init' + run: cargo pgrx init --pg$env:PG_VER=download + + - name: Run tests + run: cargo test --all --no-default-features --features "pg$env:PG_VER pg_test cshim proptest" --all-targets + + - name: Print sccache stats + run: sccache --show-stats + + - name: Stop sccache server + run: sccache --stop-server || true