-
Notifications
You must be signed in to change notification settings - Fork 217
135 lines (117 loc) · 4.58 KB
/
build_wasm_postgres.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
name: Build WASM PGlite files
permissions:
pull-requests: write
issues: write
contents: read
on:
workflow_call:
jobs:
build:
name: Build WASM Postgres
runs-on: ubuntu-22.04
env:
BUILD_CONFIG_FILE: .buildconfig
SDK_ARCHIVE: python3.13-wasm-sdk-Ubuntu-22.04.tar.lz4
WASI_SDK_ARCHIVE: python3.13-wasi-sdk-Ubuntu-22.04.tar.lz4
SDKROOT: /opt/python-wasm-sdk
SYS_PYTHON: /usr/bin/python3
PGROOT: /tmp/pglite
TOTAL_MEMORY: 128MB
CMA_MB: 16
DEBUG: false
OBJDUMP: true
contrib: contrib
extra: extra
EXTRA_EXT: vector postgis
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Set build parameters
run: |
cat ${{ env.BUILD_CONFIG_FILE }} >> $GITHUB_ENV
- name: Restore cached build
id: cache-restore
uses: actions/cache@v4
with:
path: |
/opt/python-wasm-sdk
/tmp/web
/tmp/pglite
/tmp/sdk/postgres-*.tar.gz
postgres
postgresql-*
key: build-cache-${{ hashFiles('.buildconfig', 'cibuild.sh', '.github/workflows/build_wasm_postgres.yml', 'package.json', 'cibuild/**', 'extra/**', 'patches/*.c', 'patches/*.h', 'patches/**/*.diff') }}
- name: Install python-wasm-sdk for emsdk/wasi+prebuilts
if: steps.cache-restore.outputs.cache-hit != 'true'
working-directory: /
run: |
sudo apt-get install -y lz4 wget pv bash
echo https://github.com/pygame-web/python-wasm-sdk/releases/download/$SDK_VERSION/$SDK_ARCHIVE
curl -sL --retry 5 https://github.com/pygame-web/python-wasm-sdk/releases/download/$SDK_VERSION/$SDK_ARCHIVE | tar xvP --use-compress-program=lz4 | pv -p -l -s 34500 >/dev/null
echo https://github.com/pygame-web/python-wasi-sdk/releases/download/$WASI_SDK_VERSION/$WASI_SDK_ARCHIVE
curl -sL --retry 5 https://github.com/pygame-web/python-wasi-sdk/releases/download/$WASI_SDK_VERSION/$WASI_SDK_ARCHIVE | tar xvP --use-compress-program=lz4 | pv -p -l -s 23000 >/dev/null
- name: Build postgres WASM via emsdk
if: steps.cache-restore.outputs.cache-hit != 'true'
run: |
bash ./cibuild.sh
- name: Build contributed extensions
if: steps.cache-restore.outputs.cache-hit != 'true'
run: |
bash ./cibuild.sh contrib
- name: Build extra extensions
if: steps.cache-restore.outputs.cache-hit != 'true'
run: |
bash ./cibuild.sh extra
- name: Pack node distribution
if: steps.cache-restore.outputs.cache-hit != 'true'
run: |
bash ./cibuild.sh node
- name: Link postgres WASM for web
if: steps.cache-restore.outputs.cache-hit != 'true'
run: |
bash ./cibuild.sh linkweb
- name: Copy release for PGlite build
run: |
bash ./cibuild.sh pglite-prep
- name: Upload Postgres to Github artifacts
id: upload-postgres-wasm
uses: actions/upload-artifact@v4
with:
name: postgres-wasm
path: /tmp/sdk/postgres-*.tar.gz
retention-days: 60
- name: Upload PGlite Interim to Github artifacts
id: upload-pglite-interim-build-files
uses: actions/upload-artifact@v4
with:
name: pglite-interim-build-files
path: ./packages/pglite/release/**
retention-days: 60
- name: Upload PGlite Web Interim to Github artifacts
id: upload-demos
uses: actions/upload-artifact@v4
with:
name: pglite-web-build-files
path: /tmp/web/**
retention-days: 60
- name: Find Comment
uses: peter-evans/find-comment@v3
id: fc
if: github.event_name == 'pull_request'
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body-includes: Built bundles
- name: Create or update build outputs comment
uses: peter-evans/create-or-update-comment@v4
if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository
continue-on-error: true
with:
comment-id: ${{ steps.fc.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
body: |
Built bundles:
- Postgres WASM: ${{ steps.upload-postgres-wasm.outputs.artifact-url }}
- Interim build files: ${{ steps.upload-pglite-interim-build-files.outputs.artifact-url }}
edit-mode: replace