Skip to content

Commit

Permalink
update workflow to build darwin arm
Browse files Browse the repository at this point in the history
  • Loading branch information
pskrbasu committed Apr 12, 2024
1 parent d51b4f4 commit 5f88fd1
Showing 1 changed file with 114 additions and 1 deletion.
115 changes: 114 additions & 1 deletion .github/workflows/buildimage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,111 @@ jobs:
path: ./fdw/steampipe_postgres_fdw--1.0.sql
if-no-files-found: error

build-osx-arm:
name: Build for Darwin ARM64
runs-on: macos-14
steps:
- name: Install PostgreSQL@14
run: brew install --force postgresql@14

- name: PGConfig
run: |-
which pg_config
ls -l $(which pg_config)
PGXS=$(pg_config --pgxs)
SERVER_LIB=$(pg_config --includedir)/server
INTERNAL_LIB=$(pg_config --includedir)/internal
echo $PGXS
echo $SERVER_LIB
echo $INTERNAL_LIB
ls -l $PGXS
ls -l $SERVER_LIB
ls -l $INTERNAL_LIB
- name: Checkout
uses: actions/checkout@v4

- name: Setup Golang
uses: actions/setup-go@v5
with:
go-version: 1.21

- name: Fetching Go Cache Paths
id: go-cache-paths
run: |
echo "go-build=$(go env GOCACHE)" >> $GITHUB_OUTPUT
echo "go-mod=$(go env GOMODCACHE)" >> $GITHUB_OUTPUT
- name: Go Build Cache
id: build-cache
uses: actions/cache@v4
with:
path: ${{ steps.go-cache-paths.outputs.go-build }}
key: ${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }}

- name: Go Mod Cache
id: mod-cache
uses: actions/cache@v4
with:
path: ${{ steps.go-cache-paths.outputs.go-mod }}
key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }}

- name: make clean
run: |-
go version
which pg_config
pg_config --version
export PATH=$(pg_config --bindir):$PATH
export PGXS=$(pg_config --pgxs)
export SERVER_LIB=$(pg_config --includedir)/server
export INTERNAL_LIB=$(pg_config --includedir)/internal

export CFLAGS="$(pg_config --cflags) -I${SERVER_LIB} -I${INTERNAL_LIB} -g"
export PG_CFLAGS="$(pg_config --cflags) -I${SERVER_LIB} -I${INTERNAL_LIB} -g"

export LDFLAGS=$(pg_config --ldfalgs)
export PG_LDFLAGS=$(pg_config --ldfalgs)

make clean

- name: make
run: |-
go version
which pg_config
pg_config --version
export PATH=$(pg_config --bindir):$PATH
export PGXS=$(pg_config --pgxs)
export SERVER_LIB=$(pg_config --includedir)/server
export INTERNAL_LIB=$(pg_config --includedir)/internal

export CFLAGS="$(pg_config --cflags) -I${SERVER_LIB} -I${INTERNAL_LIB} -g"
export PG_CFLAGS="$(pg_config --cflags) -I${SERVER_LIB} -I${INTERNAL_LIB} -g"

export LDFLAGS=$(pg_config --ldfalgs)
export PG_LDFLAGS=$(pg_config --ldfalgs)

make

- name: gzip the steampipe_postgres_fdw.so
run: |-
gzip build-Darwin/steampipe_postgres_fdw.so
mv build-Darwin/steampipe_postgres_fdw.so.gz build-Darwin/steampipe_postgres_fdw.so.darwin_arm64.gz
- name: Save MacOS Build Artifact - AMD64
uses: actions/upload-artifact@v4
with:
name: steampipe_postgres_fdw.so.darwin_arm64
path: build-Darwin/steampipe_postgres_fdw.so.darwin_arm64.gz
if-no-files-found: error

build-linux:
name: Build for Linux x86_64
runs-on: ubuntu-20.04
Expand Down Expand Up @@ -308,6 +413,7 @@ jobs:
- build-linux
- build-linux-arm
- build-osx
- build-osx-arm
steps:

- name: Get latest version tag
Expand All @@ -329,6 +435,12 @@ jobs:
with:
name: steampipe_postgres_fdw.so.darwin_amd64

- name: Download steampipe_postgres_fdw.so - darwin_arm64
id: download_fdw_so_darwin_arm64
uses: actions/download-artifact@v4
with:
name: steampipe_postgres_fdw.so.darwin_arm64

- name: Download steampipe_postgres_fdw.so - linux_amd64
id: download_fdw_so_linux_amd64
uses: actions/download-artifact@v4
Expand Down Expand Up @@ -358,7 +470,7 @@ jobs:
ls -la
- name: Create a draft release
uses: softprops/action-gh-release@v1
uses: softprops/action-gh-release@v2
id: create_draft_release
with:
token: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -372,3 +484,4 @@ jobs:
${{ steps.download_fdw_so_linux_amd64.outputs.download-path }}/steampipe_postgres_fdw.so.linux_amd64.gz
${{ steps.download_fdw_so_linux_arm64.outputs.download-path }}/steampipe_postgres_fdw.so.linux_arm64.gz
${{ steps.download_fdw_so_darwin_amd64.outputs.download-path }}/steampipe_postgres_fdw.so.darwin_amd64.gz
${{ steps.download_fdw_so_darwin_arm64.outputs.download-path }}/steampipe_postgres_fdw.so.darwin_arm64.gz

0 comments on commit 5f88fd1

Please sign in to comment.