Skip to content

build mac bunble with specific target #51

build mac bunble with specific target

build mac bunble with specific target #51

Workflow file for this run

name: CI
on:
push:
branches: [ main ]
tags:
- 'v*'
pull_request:
branches: [ main ]
env:
CARGO_TERM_COLOR: always
jobs:
format:
name: Format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- name: Check formatting
run: cargo fmt --all -- --check
clippy:
name: Clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- name: Cache dependencies
uses: Swatinem/rust-cache@v2
- name: Install system dependencies (Linux only)
run: sudo apt-get update && sudo apt-get install -y libfontconfig1-dev
- name: Clippy
run: cargo clippy -- -D warnings
test:
name: Test (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Setup mold linker (Linux only)
if: runner.os == 'Linux'
uses: rui314/setup-mold@v1
- name: Install system dependencies (Linux only)
if: runner.os == 'Linux'
run: sudo apt-get update && sudo apt-get install -y libfontconfig1-dev
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Cache dependencies
uses: Swatinem/rust-cache@v2
- name: Run tests (Linux)
if: runner.os == 'Linux'
run: mold -run cargo test
- name: Run tests (macOS)
if: runner.os == 'macOS'
run: cargo test
- name: Run tests (Windows)
if: runner.os == 'Windows'
# disable terminal on windows
run: cargo test --no-default-features
bundle-linux:
name: Bundle Packaging (Linux)
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- uses: rui314/setup-mold@v1
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Install system dependencies (Linux only)
run: sudo apt-get update && sudo apt-get install -y libfontconfig1-dev
- name: Cache dependencies
uses: Swatinem/rust-cache@v2
- name: Build release binary
run: |
mold -run cargo build --release
cd target/release
zip -r ../../kiorg-x86_64-linux.zip kiorg
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: kiorg-${{ github.event.pull_request.head.sha || github.sha }}--x86_64-linux.zip
path: kiorg-x86_64-linux.zip
if-no-files-found: error
bundle-macos:
name: Bundle Packaging (macOS)
needs: test
runs-on: macos-15
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Cache dependencies
uses: Swatinem/rust-cache@v2
- uses: cargo-bins/cargo-binstall@v1.12.4
- name: Install cargo-bundle
env:
# avoid rate limits
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: cargo binstall --force cargo-bundle@0.6.1 && cargo-bundle --version
- name: Create App bundle
run: |
cargo bundle --release --target aarch64-apple-darwin
cd target/release/bundle/osx
- name: Install create-dmg
run: npm install --global create-dmg
- name: Create DMG using create-dmg
run: |
cd target/aarch64-apple-darwin/release/bundle/osx
# create-dmg will fail without code signing identity, ignore that error for now
create-dmg --overwrite --dmg-title="Kiorg" Kiorg.app ../../../.. || true
mv ../../../Kiorg\ *.dmg Kiorg-aarch64.dmg
- name: Create CLI binary
run: |
cargo build --release --target aarch64-apple-darwin
cd target/aarch64-apple-darwin/release
zip -r ../../../kiorg-aarch64-macos.zip kiorg
- name: Upload DMG artifact
uses: actions/upload-artifact@v4
with:
name: Kiorg_${{ github.event.pull_request.head.sha || github.sha }}-aarch64.dmg
path: target/Kiorg-aarch64.dmg
if-no-files-found: error
- name: Upload macOS CLI binary
uses: actions/upload-artifact@v4
with:
name: kiorg-${{ github.event.pull_request.head.sha || github.sha }}-aarch64-macos.zip
path: kiorg-aarch64-macos.zip
if-no-files-found: error
bundle-windows:
name: Bundle Packaging (Windows)
needs: test
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Cache dependencies
uses: Swatinem/rust-cache@v2
- name: Build release binary
run: |
cargo build --release
cd target\release
Compress-Archive -Path kiorg.exe -DestinationPath ..\..\kiorg-x86_64-windows.zip
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: kiorg-${{ github.event.pull_request.head.sha || github.sha }}--x86_64-windows.zip
path: kiorg-x86_64-windows.zip
if-no-files-found: error