Skip to content

Commit a78fab1

Browse files
feat(build): x86 musl build (#518)
1 parent f6bbdc6 commit a78fab1

File tree

5 files changed

+184
-204
lines changed

5 files changed

+184
-204
lines changed

.github/workflows/release.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ jobs:
4343
- { os: macos-14, target: aarch64-apple-darwin }
4444
- { os: windows-2022, target: x86_64-pc-windows-msvc }
4545
- { os: windows-2022, target: aarch64-pc-windows-msvc }
46+
- { os: ubuntu-22.04, target: x86_64-unknown-linux-musl }
4647

4748
runs-on: ${{ matrix.config.os }}
4849

@@ -53,6 +54,7 @@ jobs:
5354
- uses: actions/checkout@v4
5455
with:
5556
submodules: true
57+
5658
- uses: actions-rust-lang/setup-rust-toolchain@v1
5759
with:
5860
target: ${{ matrix.config.target }}
@@ -67,6 +69,12 @@ jobs:
6769
sudo apt-get update
6870
sudo apt-get install -y gcc-aarch64-linux-gnu
6971
72+
- name: Install musl toolchain
73+
if: matrix.config.target == 'x86_64-unknown-linux-musl'
74+
run: |
75+
sudo apt-get update
76+
sudo apt-get install -y musl-tools
77+
7078
- name: Setup Postgres
7179
uses: ./.github/actions/setup-postgres
7280

@@ -130,7 +138,9 @@ jobs:
130138

131139
- name: Ensure tag matches
132140
if: steps.create_changelog.outputs.version != needs.extract_version.outputs.version
133-
run: exit 1
141+
run: |
142+
echo "Tag does not match: ${{ steps.create_changelog.outputs.version }} vs ${{ needs.extract_version.outputs.version }}"
143+
exit 1
134144
135145
- name: 👇 Download Artifacts
136146
uses: actions/download-artifact@v4

bun.lock

Lines changed: 55 additions & 133 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
"name": "postgres_lsp",
66
"devDependencies": {
77
"@biomejs/biome": "1.9.4",
8-
"@types/bun": "latest"
8+
"@types/bun": "latest",
99
},
1010
"peerDependencies": {
11-
"typescript": "^5"
12-
}
11+
"typescript": "^5",
12+
},
1313
},
1414
"packages/@postgrestools/backend-jsonrpc": {
1515
"name": "@postgrestools/backend-jsonrpc",
@@ -19,148 +19,70 @@
1919
"@postgrestools/cli-linux-arm64": "<placeholder>",
2020
"@postgrestools/cli-linux-x64": "<placeholder>",
2121
"@postgrestools/cli-win32-arm64": "<placeholder>",
22-
"@postgrestools/cli-win32-x64": "<placeholder>"
23-
}
22+
"@postgrestools/cli-win32-x64": "<placeholder>",
23+
},
2424
},
2525
"packages/@postgrestools/postgrestools": {
2626
"name": "@postgrestools/postgrestools",
2727
"bin": {
28-
"postgrestools": "bin/postgrestools"
28+
"postgrestools": "bin/postgrestools",
2929
},
3030
"optionalDependencies": {
3131
"@postgrestools/cli-aarch64-apple-darwin": "<placeholder>",
3232
"@postgrestools/cli-aarch64-linux-gnu": "<placeholder>",
3333
"@postgrestools/cli-aarch64-windows-msvc": "<placeholder>",
3434
"@postgrestools/cli-x86_64-apple-darwin": "<placeholder>",
3535
"@postgrestools/cli-x86_64-linux-gnu": "<placeholder>",
36-
"@postgrestools/cli-x86_64-windows-msvc": "<placeholder>"
37-
}
38-
}
36+
"@postgrestools/cli-x86_64-linux-musl": "<placeholder>",
37+
"@postgrestools/cli-x86_64-windows-msvc": "<placeholder>",
38+
},
39+
},
3940
},
4041
"packages": {
41-
"@biomejs/biome": [
42-
"@biomejs/[email protected]",
43-
"",
44-
{
45-
"optionalDependencies": {
46-
"@biomejs/cli-darwin-arm64": "1.9.4",
47-
"@biomejs/cli-darwin-x64": "1.9.4",
48-
"@biomejs/cli-linux-arm64": "1.9.4",
49-
"@biomejs/cli-linux-arm64-musl": "1.9.4",
50-
"@biomejs/cli-linux-x64": "1.9.4",
51-
"@biomejs/cli-linux-x64-musl": "1.9.4",
52-
"@biomejs/cli-win32-arm64": "1.9.4",
53-
"@biomejs/cli-win32-x64": "1.9.4"
54-
},
55-
"bin": { "biome": "bin/biome" }
56-
},
57-
"sha512-1rkd7G70+o9KkTn5KLmDYXihGoTaIGO9PIIN2ZB7UJxFrWw04CZHPYiMRjYsaDvVV7hP1dYNRLxSANLaBFGpog=="
58-
],
59-
60-
"@biomejs/cli-darwin-arm64": [
61-
"@biomejs/[email protected]",
62-
"",
63-
{ "os": "darwin", "cpu": "arm64" },
64-
"sha512-bFBsPWrNvkdKrNCYeAp+xo2HecOGPAy9WyNyB/jKnnedgzl4W4Hb9ZMzYNbf8dMCGmUdSavlYHiR01QaYR58cw=="
65-
],
66-
67-
"@biomejs/cli-darwin-x64": [
68-
"@biomejs/[email protected]",
69-
"",
70-
{ "os": "darwin", "cpu": "x64" },
71-
"sha512-ngYBh/+bEedqkSevPVhLP4QfVPCpb+4BBe2p7Xs32dBgs7rh9nY2AIYUL6BgLw1JVXV8GlpKmb/hNiuIxfPfZg=="
72-
],
73-
74-
"@biomejs/cli-linux-arm64": [
75-
"@biomejs/[email protected]",
76-
"",
77-
{ "os": "linux", "cpu": "arm64" },
78-
"sha512-fJIW0+LYujdjUgJJuwesP4EjIBl/N/TcOX3IvIHJQNsAqvV2CHIogsmA94BPG6jZATS4Hi+xv4SkBBQSt1N4/g=="
79-
],
80-
81-
"@biomejs/cli-linux-arm64-musl": [
82-
"@biomejs/[email protected]",
83-
"",
84-
{ "os": "linux", "cpu": "arm64" },
85-
"sha512-v665Ct9WCRjGa8+kTr0CzApU0+XXtRgwmzIf1SeKSGAv+2scAlW6JR5PMFo6FzqqZ64Po79cKODKf3/AAmECqA=="
86-
],
87-
88-
"@biomejs/cli-linux-x64": [
89-
"@biomejs/[email protected]",
90-
"",
91-
{ "os": "linux", "cpu": "x64" },
92-
"sha512-lRCJv/Vi3Vlwmbd6K+oQ0KhLHMAysN8lXoCI7XeHlxaajk06u7G+UsFSO01NAs5iYuWKmVZjmiOzJ0OJmGsMwg=="
93-
],
94-
95-
"@biomejs/cli-linux-x64-musl": [
96-
"@biomejs/[email protected]",
97-
"",
98-
{ "os": "linux", "cpu": "x64" },
99-
"sha512-gEhi/jSBhZ2m6wjV530Yy8+fNqG8PAinM3oV7CyO+6c3CEh16Eizm21uHVsyVBEB6RIM8JHIl6AGYCv6Q6Q9Tg=="
100-
],
101-
102-
"@biomejs/cli-win32-arm64": [
103-
"@biomejs/[email protected]",
104-
"",
105-
{ "os": "win32", "cpu": "arm64" },
106-
"sha512-tlbhLk+WXZmgwoIKwHIHEBZUwxml7bRJgk0X2sPyNR3S93cdRq6XulAZRQJ17FYGGzWne0fgrXBKpl7l4M87Hg=="
107-
],
108-
109-
"@biomejs/cli-win32-x64": [
110-
"@biomejs/[email protected]",
111-
"",
112-
{ "os": "win32", "cpu": "x64" },
113-
"sha512-8Y5wMhVIPaWe6jw2H+KlEm4wP/f7EW3810ZLmDlrEEy5KvBsb9ECEfu/kMWD484ijfQ8+nIi0giMgu9g1UAuuA=="
114-
],
115-
116-
"@postgrestools/backend-jsonrpc": [
117-
"@postgrestools/backend-jsonrpc@workspace:packages/@postgrestools/backend-jsonrpc"
118-
],
119-
120-
"@postgrestools/postgrestools": [
121-
"@postgrestools/postgrestools@workspace:packages/@postgrestools/postgrestools"
122-
],
123-
124-
"@types/bun": [
125-
126-
"",
127-
{ "dependencies": { "bun-types": "1.2.5" } },
128-
"sha512-w2OZTzrZTVtbnJew1pdFmgV99H0/L+Pvw+z1P67HaR18MHOzYnTYOi6qzErhK8HyT+DB782ADVPPE92Xu2/Opg=="
129-
],
130-
131-
"@types/node": [
132-
133-
"",
134-
{ "dependencies": { "undici-types": "~6.20.0" } },
135-
"sha512-I6LPUvlRH+O6VRUqYOcMudhaIdUVWfsjnZavnsraHvpBwaEyMN29ry+0UVJhImYL16xsscu0aske3yA+uPOWfw=="
136-
],
137-
138-
"@types/ws": [
139-
140-
"",
141-
{ "dependencies": { "@types/node": "*" } },
142-
"sha512-bd/YFLW+URhBzMXurx7lWByOu+xzU9+kb3RboOteXYDfW+tr+JZa99OyNmPINEGB/ahzKrEuc8rcv4gnpJmxTw=="
143-
],
144-
145-
"bun-types": [
146-
147-
"",
148-
{ "dependencies": { "@types/node": "*", "@types/ws": "~8.5.10" } },
149-
"sha512-3oO6LVGGRRKI4kHINx5PIdIgnLRb7l/SprhzqXapmoYkFl5m4j6EvALvbDVuuBFaamB46Ap6HCUxIXNLCGy+tg=="
150-
],
151-
152-
"typescript": [
153-
154-
"",
155-
{ "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } },
156-
"sha512-aJn6wq13/afZp/jT9QZmwEjDqqvSGp1VT5GVg+f/t6/oVyrgXM6BY1h9BRh/O5p3PlUPAe+WuiEZOmb/49RqoQ=="
157-
],
158-
159-
"undici-types": [
160-
161-
"",
162-
{},
163-
"sha512-Ny6QZ2Nju20vw1SRHe3d9jVu6gJ+4e3+MMpqu7pqE5HT6WsTSlce++GQmK5UXS8mzV8DSYHrQH+Xrf2jVcuKNg=="
164-
]
42+
"@biomejs/biome": ["@biomejs/[email protected]", "", { "optionalDependencies": { "@biomejs/cli-darwin-arm64": "1.9.4", "@biomejs/cli-darwin-x64": "1.9.4", "@biomejs/cli-linux-arm64": "1.9.4", "@biomejs/cli-linux-arm64-musl": "1.9.4", "@biomejs/cli-linux-x64": "1.9.4", "@biomejs/cli-linux-x64-musl": "1.9.4", "@biomejs/cli-win32-arm64": "1.9.4", "@biomejs/cli-win32-x64": "1.9.4" }, "bin": { "biome": "bin/biome" } }, "sha512-1rkd7G70+o9KkTn5KLmDYXihGoTaIGO9PIIN2ZB7UJxFrWw04CZHPYiMRjYsaDvVV7hP1dYNRLxSANLaBFGpog=="],
43+
44+
"@biomejs/cli-darwin-arm64": ["@biomejs/[email protected]", "", { "os": "darwin", "cpu": "arm64" }, "sha512-bFBsPWrNvkdKrNCYeAp+xo2HecOGPAy9WyNyB/jKnnedgzl4W4Hb9ZMzYNbf8dMCGmUdSavlYHiR01QaYR58cw=="],
45+
46+
"@biomejs/cli-darwin-x64": ["@biomejs/[email protected]", "", { "os": "darwin", "cpu": "x64" }, "sha512-ngYBh/+bEedqkSevPVhLP4QfVPCpb+4BBe2p7Xs32dBgs7rh9nY2AIYUL6BgLw1JVXV8GlpKmb/hNiuIxfPfZg=="],
47+
48+
"@biomejs/cli-linux-arm64": ["@biomejs/[email protected]", "", { "os": "linux", "cpu": "arm64" }, "sha512-fJIW0+LYujdjUgJJuwesP4EjIBl/N/TcOX3IvIHJQNsAqvV2CHIogsmA94BPG6jZATS4Hi+xv4SkBBQSt1N4/g=="],
49+
50+
"@biomejs/cli-linux-arm64-musl": ["@biomejs/[email protected]", "", { "os": "linux", "cpu": "arm64" }, "sha512-v665Ct9WCRjGa8+kTr0CzApU0+XXtRgwmzIf1SeKSGAv+2scAlW6JR5PMFo6FzqqZ64Po79cKODKf3/AAmECqA=="],
51+
52+
"@biomejs/cli-linux-x64": ["@biomejs/[email protected]", "", { "os": "linux", "cpu": "x64" }, "sha512-lRCJv/Vi3Vlwmbd6K+oQ0KhLHMAysN8lXoCI7XeHlxaajk06u7G+UsFSO01NAs5iYuWKmVZjmiOzJ0OJmGsMwg=="],
53+
54+
"@biomejs/cli-linux-x64-musl": ["@biomejs/[email protected]", "", { "os": "linux", "cpu": "x64" }, "sha512-gEhi/jSBhZ2m6wjV530Yy8+fNqG8PAinM3oV7CyO+6c3CEh16Eizm21uHVsyVBEB6RIM8JHIl6AGYCv6Q6Q9Tg=="],
55+
56+
"@biomejs/cli-win32-arm64": ["@biomejs/[email protected]", "", { "os": "win32", "cpu": "arm64" }, "sha512-tlbhLk+WXZmgwoIKwHIHEBZUwxml7bRJgk0X2sPyNR3S93cdRq6XulAZRQJ17FYGGzWne0fgrXBKpl7l4M87Hg=="],
57+
58+
"@biomejs/cli-win32-x64": ["@biomejs/[email protected]", "", { "os": "win32", "cpu": "x64" }, "sha512-8Y5wMhVIPaWe6jw2H+KlEm4wP/f7EW3810ZLmDlrEEy5KvBsb9ECEfu/kMWD484ijfQ8+nIi0giMgu9g1UAuuA=="],
59+
60+
"@postgrestools/backend-jsonrpc": ["@postgrestools/backend-jsonrpc@workspace:packages/@postgrestools/backend-jsonrpc"],
61+
62+
"@postgrestools/cli-aarch64-apple-darwin": ["@postgrestools/[email protected]", "", { "os": "darwin", "cpu": "arm64" }, "sha512-LqgpsiupuNR1m8rSqcMdwep1UsSG5z7RZ9MYHODBB0+AsN/e1YzcyutqGeKs+AfDBdKdv7QmSbpf7KruBYL+tg=="],
63+
64+
"@postgrestools/cli-aarch64-linux-gnu": ["@postgrestools/[email protected]", "", { "os": "linux", "cpu": "arm64" }, "sha512-QxZZBvg9qAo9raTA5cSuSXlrqo+eCUtYMWSR2dgDCEqogNlo/62ubWYgPi+SMEtfm9euqG1GOItxyRv6xUriEA=="],
65+
66+
"@postgrestools/cli-aarch64-windows-msvc": ["@postgrestools/[email protected]", "", { "os": "win32", "cpu": "arm64" }, "sha512-C8BRZOPQA16eGL8Kk7D4M+9h2Y7x0GOJEBzjR3ZV54besoH8gcZqSxzaA8WbFczQ3dgEZ5CStny6asl3B5JMHA=="],
67+
68+
"@postgrestools/cli-x86_64-apple-darwin": ["@postgrestools/[email protected]", "", { "os": "darwin", "cpu": "x64" }, "sha512-stbU4+en82DofjzpAQlfgKemJe1lbkGhuOAxfWce4jyT25+cil6cEWBia0hZyrve9sVEJctE1MHy9os8s3EGww=="],
69+
70+
"@postgrestools/cli-x86_64-linux-gnu": ["@postgrestools/[email protected]", "", { "os": "linux", "cpu": "x64" }, "sha512-RPFdgcAiD+BWhSFw7suI0jTkJysHlHzrD4in27OGlKt9AvZ6TgKrCfDatUkn2VQfn6Ib8o/+1roFOKwFbfQIOw=="],
71+
72+
"@postgrestools/cli-x86_64-windows-msvc": ["@postgrestools/[email protected]", "", { "os": "win32", "cpu": "x64" }, "sha512-4S6mbvc9u6ipeMcZHwX3RqGMJaNR9B5utMQN/N3LBnvLx62N9MHU1bk3bnGxfHoALXQTMq+us7M9GvEe1izGHQ=="],
73+
74+
"@postgrestools/postgrestools": ["@postgrestools/postgrestools@workspace:packages/@postgrestools/postgrestools"],
75+
76+
"@types/bun": ["@types/[email protected]", "", { "dependencies": { "bun-types": "1.2.5" } }, "sha512-w2OZTzrZTVtbnJew1pdFmgV99H0/L+Pvw+z1P67HaR18MHOzYnTYOi6qzErhK8HyT+DB782ADVPPE92Xu2/Opg=="],
77+
78+
"@types/node": ["@types/[email protected]", "", { "dependencies": { "undici-types": "~6.20.0" } }, "sha512-I6LPUvlRH+O6VRUqYOcMudhaIdUVWfsjnZavnsraHvpBwaEyMN29ry+0UVJhImYL16xsscu0aske3yA+uPOWfw=="],
79+
80+
"@types/ws": ["@types/[email protected]", "", { "dependencies": { "@types/node": "*" } }, "sha512-bd/YFLW+URhBzMXurx7lWByOu+xzU9+kb3RboOteXYDfW+tr+JZa99OyNmPINEGB/ahzKrEuc8rcv4gnpJmxTw=="],
81+
82+
"bun-types": ["[email protected]", "", { "dependencies": { "@types/node": "*", "@types/ws": "~8.5.10" } }, "sha512-3oO6LVGGRRKI4kHINx5PIdIgnLRb7l/SprhzqXapmoYkFl5m4j6EvALvbDVuuBFaamB46Ap6HCUxIXNLCGy+tg=="],
83+
84+
"typescript": ["[email protected]", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-aJn6wq13/afZp/jT9QZmwEjDqqvSGp1VT5GVg+f/t6/oVyrgXM6BY1h9BRh/O5p3PlUPAe+WuiEZOmb/49RqoQ=="],
85+
86+
"undici-types": ["[email protected]", "", {}, "sha512-Ny6QZ2Nju20vw1SRHe3d9jVu6gJ+4e3+MMpqu7pqE5HT6WsTSlce++GQmK5UXS8mzV8DSYHrQH+Xrf2jVcuKNg=="],
16587
}
16688
}

packages/@postgrestools/postgrestools/bin/postgrestools

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
#!/usr/bin/env node
22
const { platform, arch, env } = process;
33

4-
/**
5-
* platform and arch are values injected into the node runtime.
6-
* We use the values documented on https://nodejs.org.
7-
*/
84
const PLATFORMS = {
95
win32: {
106
x64: "@postgrestools/cli-x86_64-windows-msvc/postgrestools.exe",
@@ -18,9 +14,40 @@ const PLATFORMS = {
1814
x64: "@postgrestools/cli-x86_64-linux-gnu/postgrestools",
1915
arm64: "@postgrestools/cli-aarch64-linux-gnu/postgrestools",
2016
},
17+
"linux-musl": {
18+
x64: "@postgrestools/cli-x86_64-linux-musl/postgrestools",
19+
// no arm64 build for musl
20+
},
2121
};
2222

23-
const binPath = env.POSTGRESTOOLS_BINARY || PLATFORMS?.[platform]?.[arch];
23+
function isMusl() {
24+
let stderr;
25+
try {
26+
stderr = execSync("ldd --version", {
27+
stdio: [
28+
"ignore", // stdin
29+
"pipe", // stdout – glibc systems print here
30+
"pipe", // stderr – musl systems print here
31+
],
32+
});
33+
} catch (err) {
34+
stderr = err.stderr;
35+
}
36+
if (stderr.indexOf("musl") > -1) {
37+
return true;
38+
}
39+
return false;
40+
}
41+
42+
function getPlatform() {
43+
if (platform === "linux") {
44+
return isMusl() ? "linux-musl" : "linux";
45+
}
46+
47+
return platform;
48+
}
49+
50+
const binPath = env.POSTGRESTOOLS_BINARY || PLATFORMS?.[getPlatform()]?.[arch];
2451

2552
if (binPath) {
2653
const result = require("child_process").spawnSync(
Lines changed: 42 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,44 @@
11
{
2-
"name": "@postgrestools/postgrestools",
3-
"version": "<placeholder>",
4-
"bin": {
5-
"postgrestools": "bin/postgrestools"
6-
},
7-
"repository": {
8-
"type": "git",
9-
"url": "git+https://github.com/supabase-community/postgres-language-server.git",
10-
"directory": "packages/@postgrestools/postgrestools"
11-
},
12-
"author": "Supabase Community",
13-
"contributors": [
14-
{
15-
"name": "Philipp Steinrötter",
16-
"url": "https://github.com/psteinroe"
17-
},
18-
{
19-
"name": "Julian Domke",
20-
"url": "https://github.com/juleswritescode"
21-
}
22-
],
23-
"license": "MIT or Apache-2.0",
24-
"description": "A collection of language tools and a Language Server Protocol (LSP) implementation for Postgres, focusing on developer experience and reliable SQL tooling.",
25-
"files": ["bin/postgrestools", "schema.json"],
26-
"engines": {
27-
"node": ">=20"
28-
},
29-
"publishConfig": {
30-
"provenance": true
31-
},
32-
"optionalDependencies": {
33-
"@postgrestools/cli-x86_64-windows-msvc": "<placeholder>",
34-
"@postgrestools/cli-aarch64-windows-msvc": "<placeholder>",
35-
"@postgrestools/cli-x86_64-apple-darwin": "<placeholder>",
36-
"@postgrestools/cli-aarch64-apple-darwin": "<placeholder>",
37-
"@postgrestools/cli-x86_64-linux-gnu": "<placeholder>",
38-
"@postgrestools/cli-aarch64-linux-gnu": "<placeholder>"
39-
}
2+
"name": "@postgrestools/postgrestools",
3+
"version": "<placeholder>",
4+
"bin": {
5+
"postgrestools": "bin/postgrestools"
6+
},
7+
"repository": {
8+
"type": "git",
9+
"url": "git+https://github.com/supabase-community/postgres-language-server.git",
10+
"directory": "packages/@postgrestools/postgrestools"
11+
},
12+
"author": "Supabase Community",
13+
"contributors": [
14+
{
15+
"name": "Philipp Steinrötter",
16+
"url": "https://github.com/psteinroe"
17+
},
18+
{
19+
"name": "Julian Domke",
20+
"url": "https://github.com/juleswritescode"
21+
}
22+
],
23+
"license": "MIT or Apache-2.0",
24+
"description": "A collection of language tools and a Language Server Protocol (LSP) implementation for Postgres, focusing on developer experience and reliable SQL tooling.",
25+
"files": [
26+
"bin/postgrestools",
27+
"schema.json"
28+
],
29+
"engines": {
30+
"node": ">=20"
31+
},
32+
"publishConfig": {
33+
"provenance": true
34+
},
35+
"optionalDependencies": {
36+
"@postgrestools/cli-x86_64-windows-msvc": "<placeholder>",
37+
"@postgrestools/cli-aarch64-windows-msvc": "<placeholder>",
38+
"@postgrestools/cli-x86_64-apple-darwin": "<placeholder>",
39+
"@postgrestools/cli-aarch64-apple-darwin": "<placeholder>",
40+
"@postgrestools/cli-x86_64-linux-gnu": "<placeholder>",
41+
"@postgrestools/cli-aarch64-linux-gnu": "<placeholder>",
42+
"@postgrestools/cli-x86_64-linux-musl": "<placeholder>"
43+
}
4044
}

0 commit comments

Comments
 (0)