Skip to content

Commit ab9f949

Browse files
committed
Refactor builds into reusable actions
1 parent 466906d commit ab9f949

File tree

15 files changed

+264
-219
lines changed

15 files changed

+264
-219
lines changed

.github/actions/linux/action.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: "Build Linux libraries"
2+
description: "Create artifact for Linux libraries"
3+
4+
runs:
5+
using: "composite"
6+
steps:
7+
- name: Install Rust Nightly
8+
uses: dtolnay/rust-toolchain@stable
9+
with:
10+
toolchain: nightly-2025-04-15
11+
components: rust-src
12+
targets: aarch64-unknown-linux-gnu,x86_64-unknown-linux-gnu,riscv64gc-unknown-linux-gnu,armv7-unknown-linux-gnueabihf
13+
14+
- name: Install cross-compiling GCC
15+
shell: bash
16+
run: |
17+
sudo apt install -y gcc-aarch64-linux-gnu gcc-riscv64-linux-gnu gcc-arm-linux-gnueabihf
18+
19+
- name: Build binaries
20+
shell: bash
21+
run: |
22+
./tool/build_linux.sh x64
23+
./tool/build_linux.sh aarch64
24+
./tool/build_linux.sh armv7
25+
./tool/build_linux.sh riscv64gc
26+
27+
- uses: actions/upload-artifact@v4
28+
with:
29+
name: linux-library
30+
retention-days: 1
31+
path: |
32+
libpowersync_x64.so
33+
libpowersync_aarch64.so
34+
libpowersync_armv7.so
35+
libpowersync_riscv64gc.so

.github/actions/macos/action.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: "Build macoS libraries"
2+
description: "Create artifact for macOS libraries"
3+
4+
runs:
5+
using: "composite"
6+
steps:
7+
- name: Install Rust Nightly
8+
uses: dtolnay/rust-toolchain@stable
9+
with:
10+
toolchain: nightly-2025-04-15
11+
components: rust-src
12+
targets: x86_64-apple-darwin,aarch64-apple-darwin
13+
14+
- name: Build binaries
15+
shell: bash
16+
run: |
17+
./tool/build_macos.sh x64
18+
./tool/build_macos.sh aarch64
19+
20+
- uses: actions/upload-artifact@v4
21+
with:
22+
name: macos-library
23+
retention-days: 1
24+
path: |
25+
libpowersync_x64.dylib
26+
libpowersync_aarch64.dylib

.github/actions/wasm/action.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: "Build wasm libraries"
2+
description: "Create artifact for wasm libraries"
3+
4+
runs:
5+
using: "composite"
6+
steps:
7+
- name: Install Rust Nightly
8+
uses: dtolnay/rust-toolchain@stable
9+
with:
10+
toolchain: nightly-2025-04-15
11+
components: rust-src
12+
13+
- name: Setup emsdk
14+
uses: mymindstorm/setup-emsdk@v14
15+
with:
16+
version: 4.0.10
17+
18+
- name: Build WASM
19+
shell: bash
20+
run: ./tool/build_wasm.sh
21+
22+
- uses: actions/upload-artifact@v4
23+
with:
24+
name: wasm-library
25+
retention-days: 1
26+
path: |
27+
libpowersync-async.wasm
28+
libpowersync.wasm
29+
libpowersync-wasm.a

.github/actions/windows/action.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: "Build Windows libraries"
2+
description: "Create artifact for Windows libraries"
3+
4+
runs:
5+
using: "composite"
6+
steps:
7+
- name: Install Rust Nightly
8+
uses: dtolnay/rust-toolchain@stable
9+
with:
10+
toolchain: nightly-2025-04-15
11+
components: rust-src
12+
targets: x86_64-pc-windows-msvc,aarch64-pc-windows-msvc
13+
14+
- name: Build binaries
15+
shell: bash
16+
run: |
17+
./tool/build_windows.sh x64
18+
./tool/build_windows.sh aarch64
19+
20+
- uses: actions/upload-artifact@v4
21+
with:
22+
name: windows-library
23+
retention-days: 1
24+
path: |
25+
powersync_x64.dll
26+
powersync_aarch64.dll
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: "Build xcframework"
2+
description: "Create artifact with XCFramework for apple targets"
3+
4+
runs:
5+
using: "composite"
6+
steps:
7+
- name: Setup
8+
shell: bash
9+
run: |
10+
rustup toolchain install nightly-2025-04-15-aarch64-apple-darwin
11+
rustup component add rust-src --toolchain nightly-2025-04-15-aarch64-apple-darwin
12+
rustup target add \
13+
x86_64-apple-darwin \
14+
aarch64-apple-darwin \
15+
aarch64-apple-ios \
16+
aarch64-apple-ios-sim \
17+
x86_64-apple-ios
18+
19+
- name: setup-cocoapods
20+
uses: maxim-lobanov/setup-cocoapods@v1
21+
with:
22+
version: 1.16.2
23+
24+
- name: Build iOS & macOS xcframework
25+
shell: bash
26+
run: |
27+
./tool/build_xcframework.sh
28+
29+
- name: Lint pod
30+
shell: bash
31+
run: |
32+
pod lib lint

.github/workflows/android.yml

Lines changed: 0 additions & 17 deletions
This file was deleted.

.github/workflows/ios.yml

Lines changed: 0 additions & 37 deletions
This file was deleted.

.github/workflows/linux.yml

Lines changed: 0 additions & 40 deletions
This file was deleted.

.github/workflows/macos.yml

Lines changed: 0 additions & 40 deletions
This file was deleted.

.github/workflows/tests.yml

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,75 @@ on:
44
name: "tests"
55

66
jobs:
7+
libs_linux:
8+
name: Building Linux libraries
9+
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository)
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
with:
14+
submodules: true
15+
- name: Build Android
16+
uses: ./.github/actions/linux
17+
18+
libs_macos:
19+
name: Building macOS libraries
20+
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository)
21+
runs-on: ubuntu-latest
22+
steps:
23+
- uses: actions/checkout@v4
24+
with:
25+
submodules: true
26+
- name: Build macOS
27+
uses: ./.github/actions/macos
28+
29+
libs_windows:
30+
name: Building Windows libraries
31+
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository)
32+
runs-on: ubuntu-latest
33+
steps:
34+
- uses: actions/checkout@v4
35+
with:
36+
submodules: true
37+
- name: Build Windows
38+
uses: ./.github/actions/windows
39+
40+
libs_android:
41+
name: Building Android libraries
42+
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository)
43+
runs-on: ubuntu-latest
44+
steps:
45+
- uses: actions/checkout@v4
46+
with:
47+
submodules: true
48+
- name: Build Android
49+
uses: ./.github/actions/android
50+
with:
51+
sign-publication: '0'
52+
53+
libs_wasm:
54+
name: Basic WASM build
55+
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository)
56+
runs-on: ubuntu-latest
57+
steps:
58+
- uses: actions/checkout@v4
59+
with:
60+
submodules: true
61+
62+
- name: Build wasm
63+
uses: ./.github/actions/wasm
64+
65+
libs_xcframework:
66+
name: Build XCFramework
67+
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository)
68+
runs-on: macos-latest
69+
steps:
70+
- uses: actions/checkout@v4
71+
with:
72+
submodules: true
73+
- name: Build XCFramework
74+
uses: ./.github/actions/xcframework
75+
776
build:
877
name: Testing on ${{ matrix.os }}
978
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository)
@@ -82,3 +151,27 @@ jobs:
82151
run: |
83152
CORE_TEST_SQLITE=.dart_tool/sqlite3/latest/libsqlite3.dylib dart test -P skip_slow
84153
CORE_TEST_SQLITE=.dart_tool/sqlite3/minimum/libsqlite3.dylib dart test -P skip_slow
154+
155+
valgrind:
156+
name: Testing with Valgrind on ${{ matrix.os }}
157+
runs-on: ${{ matrix.os }}
158+
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository)
159+
strategy:
160+
matrix:
161+
include:
162+
- os: ubuntu-latest
163+
steps:
164+
- uses: actions/checkout@v4
165+
with:
166+
submodules: true
167+
168+
- name: Install valgrind
169+
run: sudo apt update && sudo apt install -y valgrind
170+
171+
- name: Install Cargo Valgrind
172+
run: |
173+
cargo install cargo-valgrind
174+
175+
- name: Test Core
176+
run: |
177+
cargo valgrind test -p powersync_core --features loadable_extension

0 commit comments

Comments
 (0)