11name : Build and Test
22on : [push, pull_request]
3-
43jobs :
54 build :
65 strategy :
109 steps :
1110 - name : Check out
1211 uses : actions/checkout@v3
13-
12+
1413 - name : Install Rust
1514 uses : actions-rs/toolchain@v1
1615 with :
1716 profile : minimal
1817 toolchain : stable
1918 override : true
2019 components : rustfmt, clippy
21-
22- - name : Install pkg-config (macOS)
20+
21+ # OS-specific setup
22+ - name : Install dependencies (Ubuntu)
23+ if : runner.os == 'Linux'
24+ run : |
25+ sudo apt-get update
26+ sudo apt-get install -y pkg-config libssl-dev postgresql-server-dev-all
27+
28+ - name : Install dependencies (macOS)
2329 if : runner.os == 'macOS'
24- run : brew install git icu4c pkg-config
25-
30+ run : brew install git icu4c pkg-config postgresql
31+
32+ - name : Install PostgreSQL (Windows)
33+ if : runner.os == 'Windows'
34+ run : |
35+ choco install postgresql --params '/Password:postgres' -y
36+ echo "C:\Program Files\PostgreSQL\latest\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
37+ echo "C:\Program Files\PostgreSQL\latest\lib" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
38+
2639 - name : Cache Rust dependencies
2740 uses : actions/cache@v3
2841 with :
@@ -33,62 +46,77 @@ jobs:
3346 key : ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
3447 restore-keys : |
3548 ${{ runner.os }}-cargo-
36-
49+
3750 - name : Cache pgrx
3851 uses : actions/cache@v3
3952 with :
4053 path : ~/.pgrx
4154 key : ${{ runner.os }}-pgrx-${{ hashFiles('**/Cargo.lock') }}
4255 restore-keys : |
4356 ${{ runner.os }}-pgrx-
44-
57+
4558 - name : Install pgrx
4659 run : |
4760 cargo install --locked cargo-pgrx --version 0.13.1 || true
4861 cargo pgrx init
4962 env :
5063 CARGO_HTTP_TIMEOUT : 300
51- PKG_CONFIG_PATH : /opt/homebrew/opt/icu4c/lib/pkgconfig
52-
64+ PKG_CONFIG_PATH : ${{ runner.os == 'macOS' && ' /opt/homebrew/opt/icu4c/lib/pkgconfig' || '' }}
65+
5366 - name : Lint
5467 run : |
5568 cargo fmt --all -- --check
5669 cargo clippy --all -- -D warnings
57-
70+
5871 - name : Build Extension (Windows)
5972 if : runner.os == 'Windows'
6073 run : |
6174 cargo pgrx package --target x86_64-pc-windows-msvc
62-
75+
6376 - name : Build Extension (Other OS)
6477 if : runner.os != 'Windows'
6578 run : cargo pgrx package
66-
67- - name : Upload Extension Artifact
79+
80+ - name : Upload Extension Artifact (Linux)
81+ if : runner.os == 'Linux'
82+ uses : actions/upload-artifact@v4
83+ with :
84+ name : pg_sqids-${{ runner.os }}
85+ path : |
86+ target/release/pg_sqids-pg*/lib/pg_sqids.so
87+
88+ - name : Upload Extension Artifact (macOS)
89+ if : runner.os == 'macOS'
6890 uses : actions/upload-artifact@v4
6991 with :
7092 name : pg_sqids-${{ runner.os }}
7193 path : |
72- target/release/libpg_sqids.so
73- target/release/libpg_sqids.dylib
74- target/release/pg_sqids.dll
75-
94+ target/release/pg_sqids-pg*/lib/pg_sqids.dylib
95+
96+ - name : Upload Extension Artifact (Windows)
97+ if : runner.os == 'Windows'
98+ uses : actions/upload-artifact@v4
99+ with :
100+ name : pg_sqids-${{ runner.os }}
101+ path : |
102+ target/release/pg_sqids-pg*/lib/pg_sqids.dll
103+
76104 - name : Test
77105 run : cargo test --all
78-
106+
79107 check :
80108 runs-on : ubuntu-latest
81109 steps :
82110 - name : Check out
83111 uses : actions/checkout@v3
84-
112+
85113 - name : Install Rust
86114 uses : actions-rs/toolchain@v1
87115 with :
88116 profile : minimal
89117 toolchain : stable
90118 override : true
91-
119+
92120 - name : Cache Rust dependencies
93121 uses : actions/cache@v3
94122 with :
98126 target
99127 key : ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
100128 restore-keys : |
101- ${{ runner.os }}-cargo-
129+ ${{ runner.os }}-cargo-
0 commit comments