Skip to content

Commit 5f88fd1

Browse files
committed
update workflow to build darwin arm
1 parent d51b4f4 commit 5f88fd1

File tree

1 file changed

+114
-1
lines changed

1 file changed

+114
-1
lines changed

.github/workflows/buildimage.yml

Lines changed: 114 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,111 @@ jobs:
133133
path: ./fdw/steampipe_postgres_fdw--1.0.sql
134134
if-no-files-found: error
135135

136+
build-osx-arm:
137+
name: Build for Darwin ARM64
138+
runs-on: macos-14
139+
steps:
140+
- name: Install PostgreSQL@14
141+
run: brew install --force postgresql@14
142+
143+
- name: PGConfig
144+
run: |-
145+
which pg_config
146+
ls -l $(which pg_config)
147+
PGXS=$(pg_config --pgxs)
148+
SERVER_LIB=$(pg_config --includedir)/server
149+
INTERNAL_LIB=$(pg_config --includedir)/internal
150+
151+
echo $PGXS
152+
echo $SERVER_LIB
153+
echo $INTERNAL_LIB
154+
155+
ls -l $PGXS
156+
ls -l $SERVER_LIB
157+
ls -l $INTERNAL_LIB
158+
159+
- name: Checkout
160+
uses: actions/checkout@v4
161+
162+
- name: Setup Golang
163+
uses: actions/setup-go@v5
164+
with:
165+
go-version: 1.21
166+
167+
- name: Fetching Go Cache Paths
168+
id: go-cache-paths
169+
run: |
170+
echo "go-build=$(go env GOCACHE)" >> $GITHUB_OUTPUT
171+
echo "go-mod=$(go env GOMODCACHE)" >> $GITHUB_OUTPUT
172+
173+
- name: Go Build Cache
174+
id: build-cache
175+
uses: actions/cache@v4
176+
with:
177+
path: ${{ steps.go-cache-paths.outputs.go-build }}
178+
key: ${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }}
179+
180+
- name: Go Mod Cache
181+
id: mod-cache
182+
uses: actions/cache@v4
183+
with:
184+
path: ${{ steps.go-cache-paths.outputs.go-mod }}
185+
key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }}
186+
187+
- name: make clean
188+
run: |-
189+
go version
190+
191+
which pg_config
192+
pg_config --version
193+
194+
export PATH=$(pg_config --bindir):$PATH
195+
export PGXS=$(pg_config --pgxs)
196+
197+
export SERVER_LIB=$(pg_config --includedir)/server
198+
export INTERNAL_LIB=$(pg_config --includedir)/internal
199+
200+
export CFLAGS="$(pg_config --cflags) -I${SERVER_LIB} -I${INTERNAL_LIB} -g"
201+
export PG_CFLAGS="$(pg_config --cflags) -I${SERVER_LIB} -I${INTERNAL_LIB} -g"
202+
203+
export LDFLAGS=$(pg_config --ldfalgs)
204+
export PG_LDFLAGS=$(pg_config --ldfalgs)
205+
206+
make clean
207+
208+
- name: make
209+
run: |-
210+
go version
211+
212+
which pg_config
213+
pg_config --version
214+
215+
export PATH=$(pg_config --bindir):$PATH
216+
export PGXS=$(pg_config --pgxs)
217+
218+
export SERVER_LIB=$(pg_config --includedir)/server
219+
export INTERNAL_LIB=$(pg_config --includedir)/internal
220+
221+
export CFLAGS="$(pg_config --cflags) -I${SERVER_LIB} -I${INTERNAL_LIB} -g"
222+
export PG_CFLAGS="$(pg_config --cflags) -I${SERVER_LIB} -I${INTERNAL_LIB} -g"
223+
224+
export LDFLAGS=$(pg_config --ldfalgs)
225+
export PG_LDFLAGS=$(pg_config --ldfalgs)
226+
227+
make
228+
229+
- name: gzip the steampipe_postgres_fdw.so
230+
run: |-
231+
gzip build-Darwin/steampipe_postgres_fdw.so
232+
mv build-Darwin/steampipe_postgres_fdw.so.gz build-Darwin/steampipe_postgres_fdw.so.darwin_arm64.gz
233+
234+
- name: Save MacOS Build Artifact - AMD64
235+
uses: actions/upload-artifact@v4
236+
with:
237+
name: steampipe_postgres_fdw.so.darwin_arm64
238+
path: build-Darwin/steampipe_postgres_fdw.so.darwin_arm64.gz
239+
if-no-files-found: error
240+
136241
build-linux:
137242
name: Build for Linux x86_64
138243
runs-on: ubuntu-20.04
@@ -308,6 +413,7 @@ jobs:
308413
- build-linux
309414
- build-linux-arm
310415
- build-osx
416+
- build-osx-arm
311417
steps:
312418

313419
- name: Get latest version tag
@@ -329,6 +435,12 @@ jobs:
329435
with:
330436
name: steampipe_postgres_fdw.so.darwin_amd64
331437

438+
- name: Download steampipe_postgres_fdw.so - darwin_arm64
439+
id: download_fdw_so_darwin_arm64
440+
uses: actions/download-artifact@v4
441+
with:
442+
name: steampipe_postgres_fdw.so.darwin_arm64
443+
332444
- name: Download steampipe_postgres_fdw.so - linux_amd64
333445
id: download_fdw_so_linux_amd64
334446
uses: actions/download-artifact@v4
@@ -358,7 +470,7 @@ jobs:
358470
ls -la
359471
360472
- name: Create a draft release
361-
uses: softprops/action-gh-release@v1
473+
uses: softprops/action-gh-release@v2
362474
id: create_draft_release
363475
with:
364476
token: ${{ secrets.GITHUB_TOKEN }}
@@ -372,3 +484,4 @@ jobs:
372484
${{ steps.download_fdw_so_linux_amd64.outputs.download-path }}/steampipe_postgres_fdw.so.linux_amd64.gz
373485
${{ steps.download_fdw_so_linux_arm64.outputs.download-path }}/steampipe_postgres_fdw.so.linux_arm64.gz
374486
${{ steps.download_fdw_so_darwin_amd64.outputs.download-path }}/steampipe_postgres_fdw.so.darwin_amd64.gz
487+
${{ steps.download_fdw_so_darwin_arm64.outputs.download-path }}/steampipe_postgres_fdw.so.darwin_arm64.gz

0 commit comments

Comments
 (0)