From e5bda06f03a1ee7736467a38560a65cf0b2294a7 Mon Sep 17 00:00:00 2001 From: Mugi Khan Date: Fri, 12 Jul 2024 16:30:27 +0200 Subject: [PATCH 1/3] Enable linux arm64 builds --- .github/workflows/linux.yml | 38 +++++++++++++++++++++++++++++++++++++ tool/build_linux.sh | 1 - 2 files changed, 38 insertions(+), 1 deletion(-) diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index d130afd..8ab4339 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -2,6 +2,7 @@ on: push: tags: - "*" + workflow_dispatch: name: "linux" jobs: build_x86_64: @@ -20,3 +21,40 @@ jobs: - name: Build binaries run: bash tool/build_linux.sh x64 + + - name: Upload binary + if: github.event_name == 'workflow_dispatch' + uses: svenstaro/upload-release-action@v2 + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + overwrite: true + file: libpowersync_x64.so + asset_name: libpowersync_x64.so + tag: ${{ github.ref_name }} + + build_aarch64: + name: Building Linux aarch64 + runs-on: ubuntu-arm64 + 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 aarch64 + + - name: Upload binary + if: github.event_name == 'workflow_dispatch' + uses: svenstaro/upload-release-action@v2 + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + overwrite: true + file: libpowersync_aarch64.so + asset_name: libpowersync_aarch64.so + tag: ${{ github.ref_name }} diff --git a/tool/build_linux.sh b/tool/build_linux.sh index 50f5b03..b7f904f 100644 --- a/tool/build_linux.sh +++ b/tool/build_linux.sh @@ -3,7 +3,6 @@ if [ "$1" = "x64" ]; then 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" From 9040f224a20e0b873839e4c80deb47a35a45d59e Mon Sep 17 00:00:00 2001 From: Mugi Khan Date: Mon, 15 Jul 2024 15:18:38 +0200 Subject: [PATCH 2/3] Add composite action for uploading --- .github/workflows/actions/upload.yml | 24 ++++++++++++++++++++++++ .github/workflows/linux.yml | 16 ++++++---------- .github/workflows/windows.yml | 8 ++++++++ 3 files changed, 38 insertions(+), 10 deletions(-) create mode 100644 .github/workflows/actions/upload.yml diff --git a/.github/workflows/actions/upload.yml b/.github/workflows/actions/upload.yml new file mode 100644 index 0000000..e0c4bc9 --- /dev/null +++ b/.github/workflows/actions/upload.yml @@ -0,0 +1,24 @@ +name: "Upload binary file" +description: "Upload binary file to GitHub releases" +inputs: + repo-token: + required: true + description: "The secret created for the workflow run" + file-name: + required: true + description: "The file name to be uploaded" + tag: + required: false + description: "The short ref name of the branch or tag that triggered the workflow run." + default: ${{ github.ref_name }} +runs: + using: "composite" + steps: + - name: Upload binary + uses: svenstaro/upload-release-action@v2 + with: + repo_token: ${{ inputs.repo-token }} + overwrite: true + file: ${{ inputs.file-name }} + asset_name: ${{ inputs.file-name }} + tag: ${{ inputs.tag }} diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 8ab4339..c9fbc81 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -24,12 +24,10 @@ jobs: - name: Upload binary if: github.event_name == 'workflow_dispatch' - uses: svenstaro/upload-release-action@v2 + uses: ./.github/actions/upload with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - overwrite: true - file: libpowersync_x64.so - asset_name: libpowersync_x64.so + repo-token: ${{ secrets.GITHUB_TOKEN }} + file-name: libpowersync_x64.so tag: ${{ github.ref_name }} build_aarch64: @@ -51,10 +49,8 @@ jobs: - name: Upload binary if: github.event_name == 'workflow_dispatch' - uses: svenstaro/upload-release-action@v2 + uses: ./.github/actions/upload with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - overwrite: true - file: libpowersync_aarch64.so - asset_name: libpowersync_aarch64.so + repo-token: ${{ secrets.GITHUB_TOKEN }} + file-name: libpowersync_aarch64.so tag: ${{ github.ref_name }} diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 133bd0d..142b187 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -14,3 +14,11 @@ jobs: - name: Build binary run: bash tool/build_windows.sh x64 + + - name: Upload binary + if: github.event_name == 'workflow_dispatch' + uses: ./.github/actions/upload + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + file-name: powersync_x64.so + tag: ${{ github.ref_name }} From baff8a3c5c2cc03769c7fae0dd6affaf4edd566c Mon Sep 17 00:00:00 2001 From: Mugi Khan Date: Mon, 15 Jul 2024 15:29:48 +0200 Subject: [PATCH 3/3] Fix windows file name --- .github/workflows/windows.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 142b187..de91986 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -20,5 +20,5 @@ jobs: uses: ./.github/actions/upload with: repo-token: ${{ secrets.GITHUB_TOKEN }} - file-name: powersync_x64.so + file-name: powersync_x64.dll tag: ${{ github.ref_name }}