Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix cargo-pgrx and pgrx-tests on Windows #1934

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@ r = "run --features"
[target.'cfg(target_os="macos")']
# Postgres symbols won't be available until runtime
rustflags = ["-Clink-arg=-Wl,-undefined,dynamic_lookup"]

[target.'cfg(target_env="msvc")']
linker = "lld-link"
4 changes: 3 additions & 1 deletion .github/workflows/runas.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,4 +93,6 @@ jobs:
run: cargo pgrx init --pg14=$(which pg_config)

- name: Test cargo pgrx test --runas
run: cd pgrx-examples/arrays && cargo pgrx test pg14 --runas postgres --pgdata=/tmp/pgdata
run: |
echo 0 | sudo tee /proc/sys/fs/protected_fifos
cd pgrx-examples/arrays && cargo pgrx test pg14 --runas postgres --pgdata=/tmp/pgdata
73 changes: 73 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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-2022" ]
postgresql: [ 13, 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
Loading
Loading