Skip to content

Commit 6282d8f

Browse files
committed
generated workflows for windows and no-windows
1 parent c5418ef commit 6282d8f

19 files changed

+251
-19
lines changed
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
name: Generated Build libpg-query no windows 🛠
2+
'on':
3+
workflow_dispatch: null
4+
jobs:
5+
build-artifacts:
6+
runs-on: ${{ matrix.os }}
7+
strategy:
8+
matrix:
9+
os:
10+
- macos-latest
11+
- ubuntu-latest
12+
steps:
13+
- name: Checkout Repository 📥
14+
uses: actions/checkout@v4
15+
- name: Setup Node.js 🌐
16+
uses: actions/setup-node@v4
17+
with:
18+
node-version: 20.x
19+
cache: yarn
20+
- name: Configure Git 🛠
21+
run: |
22+
git config user.name "Cosmology"
23+
git config user.email "[email protected]"
24+
- name: Install and Build 📦
25+
run: |
26+
yarn
27+
yarn binary:build
28+
- name: Save Artifacts For Supabase CDN 🏗
29+
uses: actions/upload-artifact@v4
30+
with:
31+
name: build-supabase-artifact-${{ matrix.os }}
32+
path: ./build/stage/libpg-query-node/
33+
- name: Save Artifacts For NPM 🏗
34+
uses: actions/upload-artifact@v4
35+
with:
36+
name: build-npm-artifact-${{ matrix.os }}
37+
path: |
38+
${{ matrix.os == 'macos-latest' && './libpg_query/osx/libpg_query.a' ||
39+
matrix.os == 'ubuntu-latest' && './libpg_query/linux/libpg_query.a' }}
40+
build-wasm:
41+
needs: build-artifacts
42+
runs-on: ubuntu-latest
43+
steps:
44+
- name: Checkout Repository 📥
45+
uses: actions/checkout@v4
46+
- name: Setup Node.js 🌐
47+
uses: actions/setup-node@v4
48+
with:
49+
node-version: 20.x
50+
cache: yarn
51+
- name: Install and Build 🚀
52+
run: |
53+
yarn
54+
- name: Install Emscripten ✍🏻
55+
run: |
56+
sudo apt-get update
57+
sudo apt-get install cmake python3 python3-pip
58+
git clone --branch 3.1.59 --depth 1 https://github.com/emscripten-core/emsdk.git
59+
cd emsdk
60+
./emsdk install 3.1.59
61+
./emsdk activate 3.1.59
62+
source ./emsdk_env.sh
63+
- name: Build with Emscripten 🏗
64+
run: |
65+
source ./emsdk/emsdk_env.sh
66+
emmake make
67+
emmake make build
68+
- name: Archive production artifacts 🏛
69+
uses: actions/upload-artifact@v4
70+
with:
71+
name: wasm-artifacts
72+
path: wasm
73+
prepare-and-log:
74+
needs: build-wasm
75+
runs-on: ubuntu-latest
76+
steps:
77+
- name: Checkout Repository 📥
78+
uses: actions/checkout@v4
79+
- name: Get Artifacts 📚
80+
uses: actions/download-artifact@v4
81+
with:
82+
path: downloaded-artifacts
83+
- name: Prepare artifacts 📦
84+
run: |
85+
find ./downloaded-artifacts/
86+
cp ./downloaded-artifacts/build-npm-artifact-windows-latest/pg_query.lib ./libpg_query/windows/queryparser.lib
87+
cp ./downloaded-artifacts/build-npm-artifact-ubuntu-latest/libpg_query.a ./libpg_query/linux/libpg_query.a
88+
cp ./downloaded-artifacts/build-npm-artifact-macos-latest/libpg_query.a ./libpg_query/osx/libpg_query.a
89+
cp ./downloaded-artifacts/wasm-artifacts/libpg-query.js ./wasm/libpg-query.js
90+
cp ./downloaded-artifacts/wasm-artifacts/libpg-query.wasm ./wasm/libpg-query.wasm
91+
rm -rf ./downloaded-artifacts
92+
- name: Log
93+
run: |
94+
find ./libpg_query/
95+
find ./wasm

.github/workflows/generated-build-and-test.yaml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Build and Test 🛠
1+
name: Generated Build libpg-query 🛠
22
'on':
33
workflow_dispatch: null
44
jobs:
@@ -7,6 +7,7 @@ jobs:
77
strategy:
88
matrix:
99
os:
10+
- windows-latest
1011
- macos-latest
1112
- ubuntu-latest
1213
steps:
@@ -36,7 +37,8 @@ jobs:
3637
name: build-npm-artifact-${{ matrix.os }}
3738
path: |
3839
${{ matrix.os == 'macos-latest' && './libpg_query/osx/libpg_query.a' ||
39-
matrix.os == 'ubuntu-latest' && './libpg_query/linux/libpg_query.a' }}
40+
matrix.os == 'ubuntu-latest' && './libpg_query/linux/libpg_query.a' ||
41+
matrix.os == 'windows-latest' && './libpg_query/windows/pg_query.lib' }}
4042
build-wasm:
4143
needs: build-artifacts
4244
runs-on: ubuntu-latest
@@ -70,7 +72,7 @@ jobs:
7072
with:
7173
name: wasm-artifacts
7274
path: wasm
73-
prepare-and-publish:
75+
prepare-and-log:
7476
needs: build-wasm
7577
runs-on: ubuntu-latest
7678
steps:

.github/workflows/run-tests-linux.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
name: Linux 🧪
22

33
on:
4+
push:
45
pull_request:
5-
types: [opened, push, reopened]
6+
types: [opened, synchronize, reopened]
67
workflow_dispatch:
78

89
jobs:

.github/workflows/run-tests-mac.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
name: Mac 🧪
22

33
on:
4+
push:
45
pull_request:
5-
types: [opened, push, reopened]
6+
types: [opened, synchronize, reopened]
67
workflow_dispatch:
78

89
jobs:

.github/workflows/run-tests-win.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
name: Windows 🛠
22

33
on:
4+
push:
45
pull_request:
5-
types: [opened, push, reopened]
6+
types: [opened, synchronize, reopened]
67
workflow_dispatch:
78

89
jobs:
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: Build and Publish 🚀
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
build-artifacts:
8+
import-yaml: yaml/build-artifacts-no-win.yaml
9+
10+
build-wasm:
11+
needs: build-artifacts
12+
import-yaml: yaml/build-wasm.yaml
13+
14+
prepare-and-publish:
15+
needs: build-wasm
16+
import-yaml: yaml/prepare-and-publish.yaml
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: Build and Test 🛠
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
build-artifacts:
8+
import-yaml: yaml/build-artifacts-no-win.yaml
9+
10+
build-wasm:
11+
needs: build-artifacts
12+
import-yaml: yaml/build-wasm.yaml
13+
14+
prepare-and-log:
15+
needs: build-wasm
16+
import-yaml: yaml/prepare-and-log.yaml

.yamlize/workflows/build-and-test.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ jobs:
1111
needs: build-artifacts
1212
import-yaml: yaml/build-wasm.yaml
1313

14-
prepare-and-publish:
14+
prepare-and-log:
1515
needs: build-wasm
1616
import-yaml: yaml/prepare-and-log.yaml
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
name: Save Artifacts For NPM 🏗
2+
uses: actions/upload-artifact@v4
3+
with:
4+
name: build-npm-artifact-${{ matrix.os }}
5+
path: |
6+
${{ matrix.os == 'macos-latest' && './libpg_query/osx/libpg_query.a' ||
7+
matrix.os == 'ubuntu-latest' && './libpg_query/linux/libpg_query.a' }}

.yamlize/workflows/yaml/artifacts/npm.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@ with:
44
name: build-npm-artifact-${{ matrix.os }}
55
path: |
66
${{ matrix.os == 'macos-latest' && './libpg_query/osx/libpg_query.a' ||
7-
matrix.os == 'ubuntu-latest' && './libpg_query/linux/libpg_query.a' }}
7+
matrix.os == 'ubuntu-latest' && './libpg_query/linux/libpg_query.a' ||
8+
matrix.os == 'windows-latest' && './libpg_query/windows/pg_query.lib' }}

0 commit comments

Comments
 (0)