Skip to content

Commit 01260fa

Browse files
should be it…
1 parent 81a8c34 commit 01260fa

File tree

3 files changed

+56
-68
lines changed

3 files changed

+56
-68
lines changed

.github/workflows/publish.reusable.yml

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -34,25 +34,20 @@ jobs:
3434
RELEASE_TAG: ${{ inputs.release-tag }}
3535
PRERELEASE: ${{ inputs.is-prerelease }}
3636

37-
- name: LS those packages
37+
- name: Publish npm packages as nightly
38+
if: inputs.is-prerelease == 'true'
3839
run: |
39-
ls packages/@postgrestools
40-
cat packages/@postgrestools/postgrestools/package.json
41-
42-
# - name: Publish npm packages as nightly
43-
# if: inputs.is-prerelease == 'true'
44-
# run: |
45-
# for package in packages/@postgrestools/*; do
46-
# npm publish "$package" --tag nightly --access public --provenance
47-
# done
48-
# env:
49-
# NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} #
40+
for package in packages/@postgrestools/*; do
41+
npm publish "$package" --tag nightly --access public --provenance
42+
done
43+
env:
44+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} #
5045

51-
# - name: Publish npm packages as latest
52-
# if: inputs.is-prerelease != 'true'
53-
# run: |
54-
# for package in packages/@postgrestools/*; do
55-
# npm publish "$package" --tag latest --access public --provenance
56-
# done
57-
# env:
58-
# NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
46+
- name: Publish npm packages as latest
47+
if: inputs.is-prerelease != 'true'
48+
run: |
49+
for package in packages/@postgrestools/*; do
50+
npm publish "$package" --tag latest --access public --provenance
51+
done
52+
env:
53+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.github/workflows/release.yml

Lines changed: 7 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ permissions:
99
env:
1010
# Need these guys for cross-compilation
1111
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc
12-
# CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER: aarch64-linux-gnu-gcc
12+
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER: aarch64-linux-gnu-gcc
1313

1414
jobs:
1515
# windows does not run git cliff so we need to do it here
@@ -38,14 +38,9 @@ jobs:
3838
- { os: ubuntu-22.04, target: aarch64-unknown-linux-gnu }
3939
- { os: macos-14, target: x86_64-apple-darwin }
4040
- { os: macos-14, target: aarch64-apple-darwin }
41-
# - { os: windows-2022, target: x86_64-pc-windows-msvc }
42-
# - { os: windows-2022, target: aarch64-pc-windows-msvc }
41+
- { os: windows-2022, target: x86_64-pc-windows-msvc }
42+
- { os: windows-2022, target: aarch64-pc-windows-msvc }
4343
- { os: ubuntu-22.04, target: x86_64-unknown-linux-musl }
44-
- {
45-
os: ubuntu-22.04,
46-
target: aarch64-unknown-linux-musl,
47-
container: "messense/rust-musl-cross:aarch64-musl",
48-
}
4944

5045
runs-on: ${{ matrix.config.os }}
5146
container: ${{ matrix.config.container }}
@@ -58,27 +53,13 @@ jobs:
5853
with:
5954
submodules: true
6055

61-
- name: DEBUG Rust Container
62-
if: matrix.config.container != null
63-
run: |
64-
which rustc
65-
rustc --version
66-
rustup show
67-
rustup target list --installed
68-
6956
- uses: actions-rust-lang/setup-rust-toolchain@v1
70-
if: matrix.config.container == null
7157
with:
7258
target: ${{ matrix.config.target }}
7359

7460
- uses: Swatinem/rust-cache@v2
75-
if: matrix.config.container == null
7661
id: rust-cache
7762

78-
- name: Add Rust target in container
79-
if: matrix.config.container != null
80-
run: rustup target add ${{ matrix.config.target }}
81-
8263
# The Aarch64 Linux is a special snowflake, we need to install its toolchain
8364
- name: Install arm64 toolchain
8465
if: matrix.config.target == 'aarch64-unknown-linux-gnu'
@@ -93,13 +74,12 @@ jobs:
9374
sudo apt-get install -y musl-tools
9475
9576
- name: Setup Postgres
96-
if: matrix.config.container == null
9777
uses: ./.github/actions/setup-postgres
9878

99-
# - name: 🧪 Run Tests
100-
# run: cargo test --release
101-
# env:
102-
# DATABASE_URL: postgres://postgres:postgres@localhost:5432/postgres
79+
- name: 🧪 Run Tests
80+
run: cargo test --release
81+
env:
82+
DATABASE_URL: postgres://postgres:postgres@localhost:5432/postgres
10383

10484
- name: 🛠️ Run Build
10585
run: cargo build -p pgt_cli --release --target ${{ matrix.config.target }}
@@ -108,7 +88,6 @@ jobs:
10888
RUSTFLAGS: "-C strip=symbols -C codegen-units=1"
10989
# Inline the version in the CLI binary
11090
PGT_VERSION: ${{ needs.extract_version.outputs.version }}
111-
SQLX_OFFLINE: ${{ matrix.config.container != null }}
11291

11392
# windows is a special snowflake too, it saves binaries as .exe
11493
- name: 👦 Name the Binary

packages/@postgrestools/postgrestools/scripts/generate-packages.mjs

Lines changed: 34 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,34 @@ const streamPipeline = promisify(pipeline);
99
const CLI_ROOT = resolve(fileURLToPath(import.meta.url), "../..");
1010
const PACKAGES_POSTGRESTOOLS_ROOT = resolve(CLI_ROOT, "..");
1111
const POSTGRESTOOLS_ROOT = resolve(PACKAGES_POSTGRESTOOLS_ROOT, "../..");
12-
const SUPPORTED_PLATFORMS = [
13-
// "pc-windows-msvc",
14-
"apple-darwin",
15-
"unknown-linux-gnu",
16-
"unknown-linux-musl",
17-
];
1812
const MANIFEST_PATH = resolve(CLI_ROOT, "package.json");
19-
const SUPPORTED_ARCHITECTURES = ["x86_64", "aarch64"];
13+
14+
function platformArchCombinations() {
15+
const SUPPORTED_PLATFORMS = [
16+
"pc-windows-msvc",
17+
"apple-darwin",
18+
"unknown-linux-gnu",
19+
"unknown-linux-musl",
20+
];
21+
22+
const SUPPORTED_ARCHITECTURES = ["x86_64", "aarch64"];
23+
24+
return SUPPORTED_PLATFORMS.flatMap((platform) => {
25+
return SUPPORTED_ARCHITECTURES.flatMap((arch) => {
26+
// we do not support MUSL builds on aarch64, as this would
27+
// require difficult cross compilation and most aarch64 users should
28+
// have sufficiently modern glibc versions
29+
if (platform.endsWith("musl") && arch === "aarch64") {
30+
return [];
31+
}
32+
33+
return {
34+
platform,
35+
arch,
36+
};
37+
});
38+
});
39+
}
2040

2141
async function downloadSchema(releaseTag, githubToken) {
2242
const assetUrl = `https://github.com/supabase-community/postgres-language-server/releases/download/${releaseTag}/schema.json`;
@@ -80,11 +100,8 @@ async function writeManifest(packagePath, version) {
80100
fs.readFileSync(manifestPath).toString("utf-8")
81101
);
82102

83-
const nativePackages = SUPPORTED_PLATFORMS.flatMap((platform) =>
84-
SUPPORTED_ARCHITECTURES.map((arch) => [
85-
getPackageName(platform, arch),
86-
version,
87-
])
103+
const nativePackages = platformArchCombinations().map(
104+
({ platform, arch }) => [getPackageName(platform, arch), version]
88105
);
89106

90107
manifestData.version = version;
@@ -243,15 +260,12 @@ function getVersion(releaseTag, isPrerelease) {
243260
await writeManifest("postgrestools", version);
244261
await writeManifest("backend-jsonrpc", version);
245262

246-
for (const platform of SUPPORTED_PLATFORMS) {
263+
for (const { platform, arch } of platformArchCombinations()) {
247264
const os = getOs(platform);
248-
249-
for (const arch of SUPPORTED_ARCHITECTURES) {
250-
await makePackageDir(platform, arch);
251-
await downloadBinary(platform, arch, os, releaseTag, githubToken);
252-
copyBinaryToNativePackage(platform, arch, os);
253-
copySchemaToNativePackage(platform, arch);
254-
}
265+
await makePackageDir(platform, arch);
266+
await downloadBinary(platform, arch, os, releaseTag, githubToken);
267+
copyBinaryToNativePackage(platform, arch, os);
268+
copySchemaToNativePackage(platform, arch);
255269
}
256270

257271
process.exit(0);

0 commit comments

Comments
 (0)