Skip to content

Windows and linux builds for loadable extension #8

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 28 commits into from
Jun 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .cargo/config → .cargo/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ rustflags = [
"-C", "link-arg=-lgcc_eh",
]

[target.aarch64-unknown-linux-gnu]
rustflags = [
"-C", "link-arg=-lgcc_eh",
]


# For iOS and macOS, we need to specify the minimum/target version.
# This must match the versions in the podspec file.
Expand Down
11 changes: 6 additions & 5 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
on:
push:
pull_request:
tags:
- "*"
name: "android"
jobs:
build:
Expand All @@ -13,8 +14,8 @@ jobs:

- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
distribution: "temurin"
java-version: "17"

- uses: nttld/setup-ndk@v1
with:
Expand All @@ -25,8 +26,8 @@ jobs:

- name: Setup
run: |
rustup toolchain install nightly-2023-08-28-x86_64-unknown-linux-gnu
rustup component add rust-src --toolchain nightly-2023-08-28-x86_64-unknown-linux-gnu
rustup toolchain install nightly-2024-05-18-x86_64-unknown-linux-gnu
rustup component add rust-src --toolchain nightly-2024-05-18-unknown-linux-gnu
rustup target add \
aarch64-linux-android \
armv7-linux-androideabi \
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/ios.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
on:
push:
pull_request:
tags:
- "*"
name: "ios"
jobs:
build:
Expand All @@ -13,8 +14,8 @@ jobs:

- name: Setup
run: |
rustup toolchain install nightly-2023-08-28-x86_64-apple-darwin
rustup component add rust-src --toolchain nightly-2023-08-28-x86_64-apple-darwin
rustup toolchain install nightly-2024-05-18-aarch64-apple-darwin
rustup component add rust-src --toolchain nightly-2024-05-18-aarch64-apple-darwin
rustup target add \
x86_64-apple-darwin \
aarch64-apple-darwin \
Expand Down
22 changes: 22 additions & 0 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
on:
push:
tags:
- "*"
name: "linux"
jobs:
build_x86_64:
name: Building Linux x86_64
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: true

- name: Install Rust Nightly
uses: dtolnay/rust-toolchain@stable
with:
toolchain: nightly-2024-05-18
components: rust-src

- name: Build binaries
run: bash tool/build_linux.sh x64
52 changes: 50 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ jobs:

- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
distribution: "temurin"
java-version: "17"

- uses: nttld/setup-ndk@v1
with:
Expand Down Expand Up @@ -110,3 +110,51 @@ jobs:
GH_REPO: ${{ github.repository }}
run: |
gh release upload "${{ needs.draft_release.outputs.tag }}" powersync-sqlite-core.xcframework.tar.xz

publish_linux_x86_64:
name: Publish Linux x86_64
needs: [draft_release]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: true

- name: Install Rust Nightly
uses: dtolnay/rust-toolchain@stable
with:
toolchain: nightly-2024-05-18
components: rust-src

- name: Build binaries
run: bash tool/build_linux.sh x64

- name: Upload binary
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
overwrite: true
file: libpowersync_x64.so
asset_name: libpowersync_x64.so
tag: ${{ needs.draft_release.outputs.tag }}

publish_windows_x64:
name: Publish Widnows x64
needs: [draft_release]
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
with:
submodules: true

- name: Build binary
run: bash tool/build_windows.sh x64

- name: Upload binary x64
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
overwrite: true
file: powersync_x64.dll
asset_name: powersync_x64.dll
tag: ${{ needs.draft_release.outputs.tag }}
16 changes: 16 additions & 0 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
on:
push:
tags:
- "*"
name: "windows"
jobs:
build_windows:
name: Building Windows
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
with:
submodules: true

- name: Build binary
run: bash tool/build_windows.sh x64
13 changes: 11 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,23 @@ SELECT powersync_init();

# Building and running

Initialize submodules recursively

```
git submodule update --init --recursive
```

```sh
# Build the shell
cargo build -t powersync_sqlite
cargo build -p powersync_sqlite
./target/debug/powersync_sqlite test.db "select powersync_rs_version()"

# Build the loadable extension
cargo build -p powersync_loadable
sqlite3 ":memory:" ".load ./target/debug/libpowersync" "select powersync_rs_version()"
sqlite3 ":memory:" ".load ./target/debug/libpowersync" "select powersync_rs_version()" #This requires sqlite3 installed

# Build the release loadable extension
cargo build -p powersync_loadable --release

# Build for iOS
./all-ios-loadable.sh
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[toolchain]
channel = "nightly-2023-08-28"
channel = "nightly-2024-05-18"
10 changes: 10 additions & 0 deletions tool/build_linux.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
if [ "$1" = "x64" ]; then
rustup target add target x86_64-unknown-linux-gnu
cargo build -p powersync_loadable --release
mv "target/release/libpowersync.so" "libpowersync_x64.so"
else
#Note: aarch64-unknown-linux-gnu has not been tested.
rustup target add aarch64-unknown-linux-gnu
cargo build -p powersync_loadable --release
mv "target/release/libpowersync.so" "libpowersync_aarch64.so"
fi
10 changes: 10 additions & 0 deletions tool/build_windows.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
if [ "$1" = "x64" ]; then
rustup target add x86_64-pc-windows-msvc
cargo build -p powersync_loadable --release
mv "target/release/powersync.dll" "powersync_x64.dll"
else
#Note: aarch64-pc-windows-msvc has not been tested.
rustup target add aarch64-pc-windows-msvc
cargo build -p powersync_loadable --release
mv "target/release/powersync.dll" "powersync_aarch64.dll"
fi
Loading