Skip to content

Commit be02075

Browse files
committed
add workflow to build linux arm binary
1 parent 8f1eb19 commit be02075

File tree

1 file changed

+129
-0
lines changed

1 file changed

+129
-0
lines changed
Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
name: Build Linux ARM Binary
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
version:
6+
description: "The version where the binary will be uploaded(must not be prefixed with 'v')"
7+
required: true
8+
tag:
9+
description: "The github tag which will be built(must be prefixed with 'v')"
10+
required: true
11+
12+
jobs:
13+
build-linux-arm:
14+
name: Build for Linux ARM64
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Build binary
18+
uses: uraimo/run-on-arch-action@v2
19+
with:
20+
arch: aarch64
21+
distro: ubuntu_latest
22+
run: |
23+
uname -m
24+
25+
apt-get update -y
26+
apt-get -y install sudo git curl tar gzip file postgresql-server-dev-14 build-essential make
27+
28+
echo "install go"
29+
curl -LO https://go.dev/dl/go1.18beta1.linux-arm64.tar.gz
30+
tar -C /usr/local -xzf go1.18beta1.linux-arm64.tar.gz
31+
export GOROOT=/usr/local/go
32+
export GOPATH=$HOME/go
33+
export PATH=$GOPATH/bin:$GOROOT/bin:$PATH
34+
go version
35+
36+
echo "find stuff"
37+
which pg_config
38+
pg_config --version
39+
40+
export PATH=$(pg_config --bindir):$PATH
41+
export PGXS=$(pg_config --pgxs)
42+
43+
export SERVER_LIB=$(pg_config --includedir)/14/server
44+
export INTERNAL_LIB=$(pg_config --includedir)/internal
45+
46+
echo "clone repo"
47+
git clone https://github.com/turbot/steampipe-postgres-fdw.git
48+
git checkout ${{ github.event.inputs.tag }}
49+
cd steampipe-postgres-fdw/fdw
50+
pwd
51+
52+
echo "make clean"
53+
go version
54+
55+
which pg_config
56+
pg_config --version
57+
58+
export PATH=$(pg_config --bindir):$PATH
59+
export PGXS=$(pg_config --pgxs)
60+
61+
export SERVER_LIB=$(pg_config --includedir)/server
62+
export INTERNAL_LIB=$(pg_config --includedir)/internal
63+
64+
export CFLAGS="$(pg_config --cflags) -I${SERVER_LIB} -I${INTERNAL_LIB} -g"
65+
export PG_CFLAGS="$(pg_config --cflags) -I${SERVER_LIB} -I${INTERNAL_LIB} -g"
66+
67+
export LDFLAGS=$(pg_config --ldflags)
68+
export PG_LDFLAGS=$(pg_config --ldflags)
69+
70+
make clean
71+
72+
echo "make go"
73+
go version
74+
75+
which pg_config
76+
pg_config --version
77+
78+
export PATH=$(pg_config --bindir):$PATH
79+
export PGXS=$(pg_config --pgxs)
80+
81+
export SERVER_LIB=$(pg_config --includedir)/postgresql/server
82+
export INTERNAL_LIB=$(pg_config --includedir)/postgresql/internal
83+
84+
export CFLAGS="$(pg_config --cflags) -I${SERVER_LIB} -I${INTERNAL_LIB} -g"
85+
export PG_CFLAGS="$(pg_config --cflags) -I${SERVER_LIB} -I${INTERNAL_LIB} -g"
86+
87+
export CPPFLAGS="$(pg_config --cppflags) -I${SERVER_LIB} -I${INTERNAL_LIB} -g"
88+
export PG_CPPFLAGS="$(pg_config --cppflags) -I${SERVER_LIB} -I${INTERNAL_LIB} -g"
89+
90+
export LDFLAGS=$(pg_config --ldflags)
91+
export PG_LDFLAGS=$(pg_config --ldflags)
92+
93+
make go
94+
95+
echo "make"
96+
go version
97+
98+
which pg_config
99+
pg_config --version
100+
101+
export PATH=$(pg_config --bindir):$PATH
102+
export PGXS=$(pg_config --pgxs)
103+
104+
export SERVER_LIB=$(pg_config --includedir)/server
105+
export INTERNAL_LIB=$(pg_config --includedir)/internal
106+
107+
export CFLAGS="$(pg_config --cflags) -I${SERVER_LIB} -I${INTERNAL_LIB} -g"
108+
export PG_CFLAGS="$(pg_config --cflags) -I${SERVER_LIB} -I${INTERNAL_LIB} -g"
109+
110+
export LDFLAGS=$(pg_config --ldflags)
111+
export PG_LDFLAGS=$(pg_config --ldflags)
112+
113+
make
114+
115+
echo "check binary"
116+
file steampipe_postgres_fdw.so
117+
gzip steampipe_postgres_fdw.so
118+
mv steampipe_postgres_fdw.so.gz steampipe_postgres_fdw.so.linux_arm64.gz
119+
ls
120+
121+
echo "install gh"
122+
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg
123+
sudo chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg
124+
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null
125+
sudo apt update
126+
sudo apt install gh
127+
128+
gh --version
129+

0 commit comments

Comments
 (0)