Skip to content

enable all linux jobs #29

enable all linux jobs

enable all linux jobs #29

Workflow file for this run

name: Release SideSign CLI
on:
push:
tags:
- "v*"
workflow_dispatch:
permissions:
contents: write
jobs:
build-macos:
name: Build macOS Universal Binary
if: false
runs-on: macos-26
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Restore Cache (exact)
id: spm-cache-exact
uses: actions/cache/restore@v4
with:
path: |
~/Library/Developer/Xcode/DerivedData
~/Library/Caches/org.swift.swiftpm
.build
key: spm-release-cache-${{ runner.os }}-${{ github.ref_name }}-${{ github.sha }}
- name: Restore Cache (fallback)
if: steps.spm-cache-exact.outputs.cache-hit != 'true'
id: spm-cache-fallback
uses: actions/cache/restore@v4
with:
path: |
~/Library/Developer/Xcode/DerivedData
~/Library/Caches/org.swift.swiftpm
.build
key: spm-release-cache-${{ runner.os }}-${{ github.ref_name }}-
restore-keys: |
spm-release-cache-${{ runner.os }}-
- name: Pre-populate Binary Artifacts
run: |
ARTIFACTS_DIR="$HOME/Library/Caches/org.swift.swiftpm/artifacts"
mkdir -p "$ARTIFACTS_DIR"
OPENSSL_FILE="$ARTIFACTS_DIR/https___github_com_krzyzanowskim_OpenSSL_releases_download_3_6_2000_OpenSSL_xcframework_zip"
if [ ! -f "$OPENSSL_FILE" ]; then
curl -fsSL "https://github.com/krzyzanowskim/OpenSSL/releases/download/3.6.2000/OpenSSL.xcframework.zip" -o "$OPENSSL_FILE"
fi
UNICORN_FILE="$ARTIFACTS_DIR/https___github_com_mahee96_unicorn_releases_download_2_1_4_multiarch_Unicorn_xcframework_zip"
if [ ! -f "$UNICORN_FILE" ]; then
curl -fsSL "https://github.com/mahee96/unicorn/releases/download/2.1.4-multiarch/Unicorn.xcframework.zip" -o "$UNICORN_FILE"
fi
- name: Build arm64 & x86_64
run: |
swift build -c release --triple arm64-apple-macosx --product sidesign
swift build -c release --triple x86_64-apple-macosx --product sidesign
mkdir -p dist
lipo -create -output dist/sidesign \
.build/arm64-apple-macosx/release/sidesign \
.build/x86_64-apple-macosx/release/sidesign
codesign --force --options runtime --sign - dist/sidesign
cd dist && tar -czvf ../sidesign-macos-universal.tar.gz sidesign && cd ..
shasum -a 256 sidesign-macos-universal.tar.gz > sidesign-macos-universal.tar.gz.sha256
- name: Save Cache
if: steps.spm-cache-exact.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
path: |
~/Library/Developer/Xcode/DerivedData
~/Library/Caches/org.swift.swiftpm
.build
key: spm-release-cache-${{ runner.os }}-${{ github.ref_name }}-${{ github.sha }}
- uses: actions/upload-artifact@v4
with:
name: macos-assets
path: sidesign-macos-universal.tar.gz*
build-linux:
name: Build Linux (${{ matrix.arch }})
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- arch: x86_64
os: ubuntu-latest
- arch: aarch64
os: ubuntu-24.04-arm
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install System Dependencies
run: |
sudo apt-get update
sudo apt-get install -y binutils git gnupg2 libc6-dev libcurl4-openssl-dev libedit2 libgcc-s1 libsqlite3-0 libstdc++-13-dev libxml2-dev libz3-dev pkg-config tzdata zlib1g-dev libssl-dev
- name: Setup Swift
run: |
if [ "${{ matrix.arch }}" = "aarch64" ]; then
SWIFT_PKG="swift-6.0.3-RELEASE-ubuntu24.04-aarch64"
SWIFT_URL="https://download.swift.org/swift-6.0.3-release/ubuntu2404-aarch64/swift-6.0.3-RELEASE/$SWIFT_PKG.tar.gz"
else
SWIFT_PKG="swift-6.0.3-RELEASE-ubuntu24.04"
SWIFT_URL="https://download.swift.org/swift-6.0.3-release/ubuntu2404/swift-6.0.3-RELEASE/$SWIFT_PKG.tar.gz"
fi
curl -fsSL "$SWIFT_URL" -o /tmp/swift.tar.gz
sudo mkdir -p /usr/local/swift
sudo tar -xzf /tmp/swift.tar.gz -C /usr/local/swift --strip-components=1
echo "/usr/local/swift/usr/bin" >> $GITHUB_PATH
/usr/local/swift/usr/bin/swift --version
- name: Restore Cache (exact)
id: spm-cache-exact
uses: actions/cache/restore@v4
with:
path: |
~/.cache/org.swift.swiftpm
.build
key: spm-release-linux-${{ matrix.arch }}-${{ github.ref_name }}-${{ github.sha }}
- name: Restore Cache (fallback)
if: steps.spm-cache-exact.outputs.cache-hit != 'true'
id: spm-cache-fallback
uses: actions/cache/restore@v4
with:
path: |
~/.cache/org.swift.swiftpm
.build
key: spm-release-linux-${{ matrix.arch }}-${{ github.ref_name }}-
restore-keys: |
spm-release-linux-${{ matrix.arch }}-
- name: Pre-populate Binary Artifacts
run: |
ARTIFACTS_DIR="$HOME/.cache/org.swift.swiftpm/artifacts"
mkdir -p "$ARTIFACTS_DIR"
OPENSSL_FILE="$ARTIFACTS_DIR/https___github_com_krzyzanowskim_OpenSSL_releases_download_3_6_2000_OpenSSL_xcframework_zip"
if [ ! -f "$OPENSSL_FILE" ]; then
curl -fsSL "https://github.com/krzyzanowskim/OpenSSL/releases/download/3.6.2000/OpenSSL.xcframework.zip" -o "$OPENSSL_FILE"
fi
UNICORN_FILE="$ARTIFACTS_DIR/https___github_com_mahee96_unicorn_releases_download_2_1_4_multiarch_Unicorn_xcframework_zip"
if [ ! -f "$UNICORN_FILE" ]; then
curl -fsSL "https://github.com/mahee96/unicorn/releases/download/2.1.4-multiarch/Unicorn.xcframework.zip" -o "$UNICORN_FILE"
fi
- name: Install Unicorn (Headers & Static Library)
run: |
curl -fsSL "https://github.com/mahee96/unicorn/releases/download/2.1.4-multiarch/unicorn-linux-${{ matrix.arch }}.tar.gz" -o /tmp/unicorn.tar.gz
mkdir -p /tmp/unicorn-pkg
tar -xzf /tmp/unicorn.tar.gz -C /tmp/unicorn-pkg
sudo mkdir -p /usr/include/unicorn /usr/local/include/unicorn /usr/lib /usr/local/lib
sudo cp -r /tmp/unicorn-pkg/include/unicorn/* /usr/include/unicorn/
sudo cp -r /tmp/unicorn-pkg/include/unicorn/* /usr/local/include/unicorn/
sudo cp /tmp/unicorn-pkg/lib/libunicorn.a /usr/lib/
sudo cp /tmp/unicorn-pkg/lib/libunicorn.a /usr/local/lib/
- name: Build Linux Binary
run: |
swift build -c release --product sidesign
mkdir -p dist
cp .build/release/sidesign dist/
cd dist && tar -czvf ../sidesign-linux-${{ matrix.arch }}.tar.gz sidesign && cd ..
shasum -a 256 sidesign-linux-${{ matrix.arch }}.tar.gz > sidesign-linux-${{ matrix.arch }}.tar.gz.sha256
- name: Save Cache
if: steps.spm-cache-exact.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
path: |
~/.cache/org.swift.swiftpm
.build
key: spm-release-linux-${{ matrix.arch }}-${{ github.ref_name }}-${{ github.sha }}
- uses: actions/upload-artifact@v4
with:
name: linux-assets-${{ matrix.arch }}
path: sidesign-linux-${{ matrix.arch }}.tar.gz*
build-windows:
name: Build Windows (${{ matrix.arch }})
if: false
runs-on: windows-latest
strategy:
matrix:
include:
- arch: x64
msvc_arch: x64
- arch: arm64
msvc_arch: x64_arm64
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup MSVC Developer Environment
uses: ilammy/msvc-dev-cmd@v1
with:
arch: ${{ matrix.msvc_arch }}
- name: Install Unicorn Headers
shell: pwsh
run: |
New-Item -ItemType Directory -Force -Path "C:\include\unicorn" | Out-Null
Copy-Item C:\unicorn-include\unicorn\* C:\include\unicorn\ -Recurse -Force
echo "INCLUDE=$env:INCLUDE;C:\include" >> $env:GITHUB_ENV
- name: Setup Swift on Windows
uses: compnerd/gha-setup-swift@v0.2.3
with:
branch: swift-6.0-release
tag: 6.0-RELEASE
- name: Restore Cache (exact)
id: spm-cache-exact
uses: actions/cache/restore@v4
with:
path: |
~\AppData\Local\org.swift.swiftpm
~/.cache/org.swift.swiftpm
.build
key: spm-release-windows-${{ matrix.arch }}-${{ github.ref_name }}-${{ github.sha }}
- name: Restore Cache (fallback)
if: steps.spm-cache-exact.outputs.cache-hit != 'true'
id: spm-cache-fallback
uses: actions/cache/restore@v4
with:
path: |
~\AppData\Local\org.swift.swiftpm
~/.cache/org.swift.swiftpm
.build
key: spm-release-windows-${{ matrix.arch }}-${{ github.ref_name }}-
restore-keys: |
spm-release-windows-${{ matrix.arch }}-
- name: Pre-populate Binary Artifacts
shell: pwsh
run: |
$dirs = @(
"$env:LOCALAPPDATA\org.swift.swiftpm\artifacts",
"$env:USERPROFILE\.cache\org.swift.swiftpm\artifacts"
)
foreach ($dir in $dirs) {
New-Item -ItemType Directory -Force -Path $dir | Out-Null
$openSSL = "$dir\https___github_com_krzyzanowskim_OpenSSL_releases_download_3_6_2000_OpenSSL_xcframework_zip"
if (-not (Test-Path $openSSL)) {
Invoke-WebRequest -Uri "https://github.com/krzyzanowskim/OpenSSL/releases/download/3.6.2000/OpenSSL.xcframework.zip" -OutFile $openSSL
}
$unicorn = "$dir\https___github_com_mahee96_unicorn_releases_download_2_1_4_multiarch_Unicorn_xcframework_zip"
if (-not (Test-Path $unicorn)) {
Invoke-WebRequest -Uri "https://github.com/mahee96/unicorn/releases/download/2.1.4-multiarch/Unicorn.xcframework.zip" -OutFile $unicorn
}
}
- name: Build Windows Executable
shell: pwsh
run: |
if ("${{ matrix.arch }}" -eq "x64") {
swift build -c release -Xcc -IC:\unicorn-include -Xcxx -IC:\unicorn-include --product sidesign
mkdir dist
Copy-Item .build\release\sidesign.exe dist\
} else {
swift build -c release --triple aarch64-unknown-windows-msvc -Xcc -IC:\unicorn-include -Xcxx -IC:\unicorn-include --product sidesign
mkdir dist
Copy-Item .build\aarch64-unknown-windows-msvc\release\sidesign.exe dist\
}
Compress-Archive -Path dist\sidesign.exe -DestinationPath sidesign-windows-${{ matrix.arch }}.zip
$hash = (Get-FileHash sidesign-windows-${{ matrix.arch }}.zip -Algorithm SHA256).Hash
"$hash sidesign-windows-${{ matrix.arch }}.zip" | Out-File -Encoding ASCII sidesign-windows-${{ matrix.arch }}.zip.sha256
- name: Save Cache
if: steps.spm-cache-exact.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
path: |
~\AppData\Local\org.swift.swiftpm
~/.cache/org.swift.swiftpm
.build
key: spm-release-windows-${{ matrix.arch }}-${{ github.ref_name }}-${{ github.sha }}
- uses: actions/upload-artifact@v4
with:
name: windows-assets-${{ matrix.arch }}
path: sidesign-windows-${{ matrix.arch }}.zip*
build-android:
name: Build Android (${{ matrix.arch }})
if: false
runs-on: ubuntu-latest
strategy:
matrix:
include:
- arch: aarch64
triple: aarch64-unknown-linux-android24
- arch: x86_64
triple: x86_64-unknown-linux-android24
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup Swift
uses: swift-actions/setup-swift@v2
with:
swift-version: "6.0"
- name: Setup Android NDK
uses: nttld/setup-ndk@v1
with:
ndk-version: r26d
- name: Restore Cache (exact)
id: spm-cache-exact
uses: actions/cache/restore@v4
with:
path: |
~/.cache/org.swift.swiftpm
.build
key: spm-release-android-${{ matrix.arch }}-${{ github.ref_name }}-${{ github.sha }}
- name: Restore Cache (fallback)
if: steps.spm-cache-exact.outputs.cache-hit != 'true'
id: spm-cache-fallback
uses: actions/cache/restore@v4
with:
path: |
~/.cache/org.swift.swiftpm
.build
key: spm-release-android-${{ matrix.arch }}-${{ github.ref_name }}-
restore-keys: |
spm-release-android-${{ matrix.arch }}-
- name: Install Swift Android SDK
run: |
curl -fsSL "https://github.com/finagolfin/swift-android-sdk/releases/download/6.0/swift-6.0-RELEASE-android-24-0.1.artifactbundle.tar.gz" -o android-sdk.tar.gz
swift sdk install android-sdk.tar.gz
- name: Install System Dependencies & Unicorn Headers
run: |
sudo mkdir -p /usr/include/unicorn /usr/local/include/unicorn
sudo cp -r /tmp/unicorn-include/unicorn/* /usr/include/unicorn/
sudo cp -r /tmp/unicorn-include/unicorn/* /usr/local/include/unicorn/
if [ -n "$ANDROID_NDK_ROOT" ]; then
for inc in $(find $ANDROID_NDK_ROOT/toolchains/llvm/prebuilt -type d -name "include" 2>/dev/null); do
sudo mkdir -p "$inc/unicorn"
sudo cp -r /tmp/unicorn-include/unicorn/* "$inc/unicorn/"
done
fi
- name: Pre-populate Binary Artifacts
run: |
ARTIFACTS_DIR="$HOME/.cache/org.swift.swiftpm/artifacts"
mkdir -p "$ARTIFACTS_DIR"
OPENSSL_FILE="$ARTIFACTS_DIR/https___github_com_krzyzanowskim_OpenSSL_releases_download_3_6_2000_OpenSSL_xcframework_zip"
if [ ! -f "$OPENSSL_FILE" ]; then
curl -fsSL "https://github.com/krzyzanowskim/OpenSSL/releases/download/3.6.2000/OpenSSL.xcframework.zip" -o "$OPENSSL_FILE"
fi
UNICORN_FILE="$ARTIFACTS_DIR/https___github_com_mahee96_unicorn_releases_download_2_1_4_multiarch_Unicorn_xcframework_zip"
if [ ! -f "$UNICORN_FILE" ]; then
curl -fsSL "https://github.com/mahee96/unicorn/releases/download/2.1.4-multiarch/Unicorn.xcframework.zip" -o "$UNICORN_FILE"
fi
- name: Build Android Binary
run: |
swift build -c release --swift-sdk ${{ matrix.triple }} -Xcc -I/tmp/unicorn-include -Xcxx -I/tmp/unicorn-include --product sidesign
mkdir -p dist
cp .build/${{ matrix.triple }}/release/sidesign dist/
cd dist && tar -czvf ../sidesign-android-${{ matrix.arch }}.tar.gz sidesign && cd ..
shasum -a 256 sidesign-android-${{ matrix.arch }}.tar.gz > sidesign-android-${{ matrix.arch }}.tar.gz.sha256
- name: Save Cache
if: steps.spm-cache-exact.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
path: |
~/.cache/org.swift.swiftpm
.build
key: spm-release-android-${{ matrix.arch }}-${{ github.ref_name }}-${{ github.sha }}
- uses: actions/upload-artifact@v4
with:
name: android-assets-${{ matrix.arch }}
path: sidesign-android-${{ matrix.arch }}.tar.gz*
publish-release:
name: Publish Release Assets
# needs: [build-macos, build-linux, build-windows, build-android]
needs: [build-linux]
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch'
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: release-assets
merge-multiple: true
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
files: release-assets/*
draft: false
prerelease: false
generate_release_notes: true