mirror of
https://github.com/aljazceru/notedeck.git
synced 2025-12-17 08:44:20 +01:00
build: cross compile binary packages (rpm/deb/dmg)
Windows build still has issues on aarch64 so we postpone that for now
This commit is contained in:
2
.cargo/config.toml
Normal file
2
.cargo/config.toml
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
[target.aarch64-unknown-linux-gnu]
|
||||||
|
linker = "aarch64-linux-gnu-gcc"
|
||||||
29
.github/workflows/build-and-test.yml
vendored
29
.github/workflows/build-and-test.yml
vendored
@@ -1,4 +1,4 @@
|
|||||||
name: Build & Test
|
name: Test
|
||||||
|
|
||||||
on:
|
on:
|
||||||
workflow_call:
|
workflow_call:
|
||||||
@@ -6,12 +6,6 @@ on:
|
|||||||
os:
|
os:
|
||||||
required: true
|
required: true
|
||||||
type: string
|
type: string
|
||||||
upload-artifact-name:
|
|
||||||
required: true
|
|
||||||
type: string
|
|
||||||
upload-artifact-path:
|
|
||||||
required: true
|
|
||||||
type: string
|
|
||||||
additional-setup:
|
additional-setup:
|
||||||
required: false
|
required: false
|
||||||
type: string
|
type: string
|
||||||
@@ -19,28 +13,17 @@ on:
|
|||||||
jobs:
|
jobs:
|
||||||
run:
|
run:
|
||||||
runs-on: ${{ inputs.os }}
|
runs-on: ${{ inputs.os }}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout Code
|
- name: Checkout Code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Rust toolchain
|
|
||||||
uses: dtolnay/rust-toolchain@stable
|
|
||||||
|
|
||||||
- name: Rust cache
|
|
||||||
uses: Swatinem/rust-cache@v2
|
|
||||||
|
|
||||||
- name: Additional Setup (if specified)
|
- name: Additional Setup (if specified)
|
||||||
if: ${{ inputs.additional-setup != '' }}
|
if: ${{ inputs.additional-setup != '' }}
|
||||||
run: ${{ inputs.additional-setup }}
|
run: ${{ inputs.additional-setup }}
|
||||||
|
|
||||||
- name: Run Tests
|
- name: Rust cache
|
||||||
run: cargo test --release
|
uses: Swatinem/rust-cache@v2
|
||||||
|
|
||||||
- name: Build
|
- name: Run Tests (Native Only)
|
||||||
run: cargo build --release
|
run: cargo test
|
||||||
|
|
||||||
- name: Upload Build Artifacts
|
|
||||||
uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: ${{ inputs.upload-artifact-name }}
|
|
||||||
path: ${{ inputs.upload-artifact-path }}
|
|
||||||
|
|||||||
138
.github/workflows/rust.yml
vendored
138
.github/workflows/rust.yml
vendored
@@ -30,37 +30,37 @@ jobs:
|
|||||||
components: clippy
|
components: clippy
|
||||||
- run: cargo clippy -- -D warnings
|
- run: cargo clippy -- -D warnings
|
||||||
|
|
||||||
linux-build-test:
|
linux-test:
|
||||||
name: Build and Test (Linux)
|
name: Test (Linux)
|
||||||
uses: ./.github/workflows/build-and-test.yml
|
uses: ./.github/workflows/build-and-test.yml
|
||||||
with:
|
with:
|
||||||
os: ubuntu-latest
|
os: ubuntu-latest
|
||||||
upload-artifact-name: notedeck-linux-bin
|
|
||||||
upload-artifact-path: target/release/notedeck
|
|
||||||
additional-setup: |
|
additional-setup: |
|
||||||
sudo apt-get install libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev libspeechd-dev libxkbcommon-dev libssl-dev
|
sudo apt-get install libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev libspeechd-dev libxkbcommon-dev libssl-dev
|
||||||
|
|
||||||
macos-build-test:
|
macos-test:
|
||||||
name: Build and Test (macOS)
|
name: Test (macOS)
|
||||||
uses: ./.github/workflows/build-and-test.yml
|
uses: ./.github/workflows/build-and-test.yml
|
||||||
with:
|
with:
|
||||||
os: macos-latest
|
os: macos-latest
|
||||||
upload-artifact-name: notedeck-macos-bin
|
|
||||||
upload-artifact-path: target/release/notedeck
|
|
||||||
|
|
||||||
windows-build-test:
|
windows-test:
|
||||||
name: Build and Test (Windows)
|
name: Test (Windows)
|
||||||
uses: ./.github/workflows/build-and-test.yml
|
uses: ./.github/workflows/build-and-test.yml
|
||||||
with:
|
with:
|
||||||
os: windows-latest
|
os: windows-latest
|
||||||
upload-artifact-name: notedeck.exe
|
|
||||||
upload-artifact-path: target/release/notedeck.exe
|
|
||||||
|
|
||||||
packaging:
|
packaging:
|
||||||
name: Build Linux Packages
|
name: rpm/deb
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: linux-build-test
|
needs: linux-test
|
||||||
if: github.ref_name == 'master'
|
if: github.ref_name == 'master'
|
||||||
|
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
arch: [x86_64, aarch64]
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
# Checkout the repository
|
# Checkout the repository
|
||||||
- name: Checkout Code
|
- name: Checkout Code
|
||||||
@@ -70,69 +70,84 @@ jobs:
|
|||||||
- name: Install Packaging Tools
|
- name: Install Packaging Tools
|
||||||
run: |
|
run: |
|
||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
sudo apt-get install -y rpm binutils
|
if [ "${{ matrix.arch }}" != "$(uname -m)" ]; then
|
||||||
|
sudo apt-get install -y gcc-${{ matrix.arch }}-linux-gnu g++-aarch64-linux-gnu
|
||||||
|
rustup target add ${{ matrix.arch }}-unknown-linux-gnu
|
||||||
|
fi
|
||||||
cargo install cargo-generate-rpm cargo-deb
|
cargo install cargo-generate-rpm cargo-deb
|
||||||
|
|
||||||
# download!
|
# Cache
|
||||||
- name: Download Build Artifacts
|
- name: Rust cache
|
||||||
uses: actions/download-artifact@v4
|
uses: Swatinem/rust-cache@v2
|
||||||
with:
|
|
||||||
name: notedeck-linux-bin
|
|
||||||
path: target/release
|
|
||||||
|
|
||||||
# Build Packages
|
# Build
|
||||||
- name: Build Packages
|
- name: Build (${{ matrix.arch }})
|
||||||
run: |
|
run: |
|
||||||
cargo generate-rpm
|
echo "arch: $(uname -m)"
|
||||||
cargo deb
|
if [ "${{ matrix.arch }}" != "$(uname -m)" ]; then
|
||||||
|
cargo build --release --target=${{ matrix.arch }}-unknown-linux-gnu
|
||||||
|
else
|
||||||
|
cargo build --release
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Build RPM Package
|
||||||
|
- name: Build RPM Package
|
||||||
|
run: |
|
||||||
|
if [ "${{ matrix.arch }}" != "$(uname -m)" ]; then
|
||||||
|
cargo generate-rpm --target=${{ matrix.arch }}-unknown-linux-gnu
|
||||||
|
else
|
||||||
|
cargo generate-rpm
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Build Debian Package
|
||||||
|
- name: Build Debian Package
|
||||||
|
run: |
|
||||||
|
if [ "${{ matrix.arch }}" != "$(uname -m)" ]; then
|
||||||
|
cargo deb --target=${{ matrix.arch }}-unknown-linux-gnu
|
||||||
|
else
|
||||||
|
cargo deb
|
||||||
|
fi
|
||||||
|
|
||||||
# Upload RPM Package
|
# Upload RPM Package
|
||||||
- name: Upload RPM Package
|
- name: Upload RPM Package
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: notedeck.rpm
|
name: ${{ inputs.artifact-name }}-${{ matrix.arch }}.rpm
|
||||||
path: target/generate-rpm/*.rpm
|
path: target/${{ matrix.arch }}-unknown-linux-gnu/generate-rpm/*.rpm
|
||||||
|
|
||||||
# Upload Debian Package
|
# Upload Debian Package
|
||||||
- name: Upload Debian Package
|
- name: Upload Debian Package
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: notedeck.deb
|
name: ${{ inputs.artifact-name }}-${{ inputs.arch }}.deb
|
||||||
path: target/debian/*.deb
|
path: target/${{ matrix.arch }}-unknown-linux-gnu/debian/*.deb
|
||||||
|
|
||||||
macos-dmg:
|
macos-dmg:
|
||||||
name: Build macOS DMG
|
name: macOS dmg
|
||||||
runs-on: macos-latest
|
runs-on: macos-latest
|
||||||
needs: macos-build-test
|
needs: macos-test
|
||||||
if: github.ref_name == 'master'
|
if: github.ref_name == 'master'
|
||||||
env:
|
env:
|
||||||
NOTEDECK_APPLE_RELEASE_CERT_ID: ${{ secrets.NOTEDECK_APPLE_RELEASE_CERT_ID }}
|
NOTEDECK_APPLE_RELEASE_CERT_ID: ${{ secrets.NOTEDECK_APPLE_RELEASE_CERT_ID }}
|
||||||
NOTEDECK_RELEASE_APPLE_ID: ${{ secrets.NOTEDECK_RELEASE_APPLE_ID }}
|
NOTEDECK_RELEASE_APPLE_ID: ${{ secrets.NOTEDECK_RELEASE_APPLE_ID }}
|
||||||
NOTEDECK_APPLE_APP_SPECIFIC_PW: ${{ secrets.NOTEDECK_APPLE_APP_SPECIFIC_PW }}
|
NOTEDECK_APPLE_APP_SPECIFIC_PW: ${{ secrets.NOTEDECK_APPLE_APP_SPECIFIC_PW }}
|
||||||
NOTEDECK_APPLE_TEAM_ID: ${{ secrets.NOTEDECK_APPLE_TEAM_ID }}
|
NOTEDECK_APPLE_TEAM_ID: ${{ secrets.NOTEDECK_APPLE_TEAM_ID }}
|
||||||
|
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
arch: [x86_64, aarch64]
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
# Checkout the repository
|
# Checkout the repository
|
||||||
- name: Checkout Code
|
- name: Checkout Code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
# Set up Rust
|
|
||||||
- name: Setup Rust
|
|
||||||
uses: dtolnay/rust-toolchain@stable
|
|
||||||
|
|
||||||
# create-dmg and cargo-bundle caching
|
|
||||||
- name: Rust cache
|
|
||||||
uses: Swatinem/rust-cache@v2
|
|
||||||
|
|
||||||
- name: Download Build Artifacts (MacOS)
|
|
||||||
uses: actions/download-artifact@v4
|
|
||||||
with:
|
|
||||||
name: notedeck-macos-bin # Assuming you need the Release build
|
|
||||||
path: target/release
|
|
||||||
|
|
||||||
- name: Install Required Tools
|
- name: Install Required Tools
|
||||||
run: |
|
run: |
|
||||||
brew install create-dmg
|
brew install create-dmg
|
||||||
cargo install cargo-bundle
|
cargo install cargo-bundle
|
||||||
|
rustup target add ${{ matrix.arch }}-apple-darwin
|
||||||
|
|
||||||
- name: Import apple codesign cert
|
- name: Import apple codesign cert
|
||||||
uses: apple-actions/import-codesign-certs@v3
|
uses: apple-actions/import-codesign-certs@v3
|
||||||
@@ -140,30 +155,35 @@ jobs:
|
|||||||
p12-file-base64: ${{ secrets.CERTIFICATES_P12 }}
|
p12-file-base64: ${{ secrets.CERTIFICATES_P12 }}
|
||||||
p12-password: ${{ secrets.CERTIFICATES_P12_PASSWORD }}
|
p12-password: ${{ secrets.CERTIFICATES_P12_PASSWORD }}
|
||||||
|
|
||||||
|
- name: Rust cache
|
||||||
|
uses: Swatinem/rust-cache@v2
|
||||||
|
|
||||||
- name: Run macOS DMG Build Script
|
- name: Run macOS DMG Build Script
|
||||||
run: ./scripts/macos_build.sh
|
run: ARCH=${{ matrix.arch }} ./scripts/macos_build.sh
|
||||||
|
|
||||||
- name: Upload DMG Artifact
|
- name: Upload DMG Artifact
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: notedeck.dmg
|
name: notedeck-${{ matrix.arch }}.dmg
|
||||||
path: packages/notedeck.dmg
|
path: packages/notedeck-${{ matrix.arch }}.dmg
|
||||||
|
|
||||||
windows-installer:
|
windows-installer:
|
||||||
name: Build Windows Installer
|
name: Build Windows Installer (x86_64)
|
||||||
runs-on: windows-latest
|
runs-on: windows-latest
|
||||||
needs: windows-build-test
|
needs: windows-test
|
||||||
if: github.ref_name == 'master'
|
if: github.ref_name == 'master'
|
||||||
steps:
|
steps:
|
||||||
# Checkout the repository
|
# Checkout the repository
|
||||||
- name: Checkout Code
|
- name: Checkout Code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Download Build Artifacts
|
# Build cache
|
||||||
uses: actions/download-artifact@v4
|
- name: Rust cache
|
||||||
with:
|
uses: Swatinem/rust-cache@v2
|
||||||
name: notedeck.exe # Assuming you need the Release build
|
|
||||||
path: target/release
|
# Build
|
||||||
|
- name: Build (Native Only)
|
||||||
|
run: cargo build --release
|
||||||
|
|
||||||
# Create packages directory
|
# Create packages directory
|
||||||
- name: Create packages directory
|
- name: Create packages directory
|
||||||
@@ -173,13 +193,6 @@ jobs:
|
|||||||
- name: Install Inno Setup
|
- name: Install Inno Setup
|
||||||
run: choco install innosetup --no-progress --yes
|
run: choco install innosetup --no-progress --yes
|
||||||
|
|
||||||
# Validate executable exists
|
|
||||||
- name: Validate required files
|
|
||||||
run: |
|
|
||||||
if (!(Test-Path -Path target\release\notedeck.exe)) {
|
|
||||||
throw "Executable 'notedeck.exe' not found in 'target/release'."
|
|
||||||
}
|
|
||||||
|
|
||||||
# Build Installer
|
# Build Installer
|
||||||
- name: Run Inno Setup Script
|
- name: Run Inno Setup Script
|
||||||
run: |
|
run: |
|
||||||
@@ -195,3 +208,4 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
name: DamusNotedeckInstaller.exe
|
name: DamusNotedeckInstaller.exe
|
||||||
path: packages\DamusNotedeckInstaller.exe
|
path: packages\DamusNotedeckInstaller.exe
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ set -o pipefail # Catch errors in pipelines
|
|||||||
|
|
||||||
# Ensure the script is running in the correct directory
|
# Ensure the script is running in the correct directory
|
||||||
REQUIRED_DIR="notedeck"
|
REQUIRED_DIR="notedeck"
|
||||||
|
ARCH=${ARCH:-"aarch64"}
|
||||||
|
TARGET=${TARGET:-${ARCH}-apple-darwin}
|
||||||
CURRENT_DIR=$(basename "$PWD")
|
CURRENT_DIR=$(basename "$PWD")
|
||||||
|
|
||||||
if [ "$CURRENT_DIR" != "$REQUIRED_DIR" ]; then
|
if [ "$CURRENT_DIR" != "$REQUIRED_DIR" ]; then
|
||||||
@@ -40,7 +42,7 @@ fi
|
|||||||
|
|
||||||
# Build the .app bundle
|
# Build the .app bundle
|
||||||
echo "Building .app bundle..."
|
echo "Building .app bundle..."
|
||||||
cargo bundle --release
|
cargo bundle --release --target $TARGET
|
||||||
|
|
||||||
# Sign the app
|
# Sign the app
|
||||||
echo "Codesigning the app..."
|
echo "Codesigning the app..."
|
||||||
@@ -51,11 +53,11 @@ codesign \
|
|||||||
--options runtime \
|
--options runtime \
|
||||||
--entitlements entitlements.plist \
|
--entitlements entitlements.plist \
|
||||||
--sign "$NOTEDECK_APPLE_RELEASE_CERT_ID" \
|
--sign "$NOTEDECK_APPLE_RELEASE_CERT_ID" \
|
||||||
target/release/bundle/osx/notedeck.app
|
target/${TARGET}/release/bundle/osx/notedeck.app
|
||||||
|
|
||||||
# Create a zip for notarization
|
# Create a zip for notarization
|
||||||
echo "Creating zip for notarization..."
|
echo "Creating zip for notarization..."
|
||||||
zip -r notedeck.zip target/release/bundle/osx/notedeck.app
|
zip -r notedeck.zip target/${TARGET}/release/bundle/osx/notedeck.app
|
||||||
|
|
||||||
# Submit for notarization
|
# Submit for notarization
|
||||||
echo "Submitting for notarization..."
|
echo "Submitting for notarization..."
|
||||||
@@ -68,7 +70,7 @@ xcrun notarytool submit \
|
|||||||
|
|
||||||
# Staple the notarization
|
# Staple the notarization
|
||||||
echo "Stapling notarization to the app..."
|
echo "Stapling notarization to the app..."
|
||||||
xcrun stapler staple target/release/bundle/osx/notedeck.app
|
xcrun stapler staple target/${TARGET}/release/bundle/osx/notedeck.app
|
||||||
|
|
||||||
echo "Removing notedeck.zip"
|
echo "Removing notedeck.zip"
|
||||||
rm notedeck.zip
|
rm notedeck.zip
|
||||||
@@ -79,7 +81,7 @@ mkdir -p packages
|
|||||||
create-dmg \
|
create-dmg \
|
||||||
--window-size 600 400 \
|
--window-size 600 400 \
|
||||||
--app-drop-link 400 100 \
|
--app-drop-link 400 100 \
|
||||||
packages/notedeck.dmg \
|
packages/notedeck-${ARCH}.dmg \
|
||||||
target/release/bundle/osx/notedeck.app
|
target/${TARGET}/release/bundle/osx/notedeck.app
|
||||||
|
|
||||||
echo "Build and signing process completed successfully."
|
echo "Build and signing process completed successfully."
|
||||||
|
|||||||
Reference in New Issue
Block a user