Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
130 changes: 130 additions & 0 deletions .github/workflows/native_build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
name: Build Native
on:
workflow_dispatch:

jobs:
prepare:
runs-on: ubuntu-latest
outputs:
build_date: ${{ steps.get_date.outputs.date }}
steps:
- name: Generate build date
id: get_date
run: echo "date=$(date +%s)" >> "$GITHUB_OUTPUT"

build-linux:
name: Build ${{ matrix.target }}
needs: prepare
runs-on: ${{ matrix.runner }}
container: almalinux:8
defaults:
run:
working-directory: ./native
strategy:
fail-fast: false
matrix:
include:
# Linux (x86_64)
- runner: ubuntu-latest
target: x86_64-unknown-linux-gnu
appimage_arch: x86_64
# Linux (aarch64)
- runner: ubuntu-24.04-arm
target: aarch64-unknown-linux-gnu
appimage_arch: aarch64
env:
CI_BUILD_DATE: ${{ needs.prepare.outputs.build_date }}
steps:
- name: Checkout repository
uses: actions/checkout@v7
- name: Install dependencies
run: dnf install -y gcc gcc-c++ make openssl-devel libcurl-devel pkgconf-pkg-config git file
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: nightly
targets: ${{ matrix.target }}
- name: Build
run: cargo build --release --target ${{ matrix.target }}

- name: Build AppImage
env:
APPIMAGE_EXTRACT_AND_RUN: 1
run: |
curl -LO https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-${{ matrix.appimage_arch }}.AppImage
chmod +x linuxdeploy-${{ matrix.appimage_arch }}.AppImage

# Create mandatory AppImage metadata (Replace these inline files with committed assets in your repository)
cat > paperclip.desktop <<EOF
[Desktop Entry]
Name=paperclip
Exec=paperclip
Icon=paperclip
Type=Application
Categories=Utility;
EOF
echo '<svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg"><circle cx="50" cy="50" r="50"/></svg>' > paperclip.svg

# Package the binary and copy shared libraries into the AppDir
./linuxdeploy-${{ matrix.appimage_arch }}.AppImage \
--appdir AppDir \
--executable target/${{ matrix.target }}/release/paperclip \
--desktop-file paperclip.desktop \
--icon-file paperclip.svg \
--output appimage

- name: Upload binary artifact
uses: actions/upload-artifact@v7
with:
name: paperclip-${{ matrix.target }}
path: native/target/${{ matrix.target }}/release/paperclip
- name: Upload AppImage artifact
uses: actions/upload-artifact@v7
with:
name: paperclip-appimage-${{ matrix.target }}
path: native/paperclip-${{ matrix.appimage_arch }}.AppImage

build-native:
name: Build ${{ matrix.target }}
needs: prepare
runs-on: ${{ matrix.os }}
defaults:
run:
working-directory: ./native
strategy:
fail-fast: false
matrix:
include:
# macOS (x86_64)
- os: macos-latest
target: x86_64-apple-darwin
extension: ""
# macOS (aarch64)
- os: macos-latest
target: aarch64-apple-darwin
extension: ""
# Windows (x86_64)
- os: windows-latest
target: x86_64-pc-windows-msvc
extension: ".exe"
# Windows (aarch64)
- os: windows-latest
target: aarch64-pc-windows-msvc
extension: ".exe"
env:
CI_BUILD_DATE: ${{ needs.prepare.outputs.build_date }}
steps:
- name: Checkout repository
uses: actions/checkout@v7
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: nightly
targets: ${{ matrix.target }}
- name: Build
run: cargo build --release --target ${{ matrix.target }}
- name: Upload binary artifact
uses: actions/upload-artifact@v7
with:
name: paperclip-${{ matrix.target }}
path: native/target/${{ matrix.target }}/release/paperclip${{ matrix.extension }}
6 changes: 6 additions & 0 deletions native/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.idea/
/target
.DS_Store

run/
paperclip.jar
Loading