Try to build for Mac OS and Windows #19
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on: | ||
push: | ||
pull_request: | ||
name: CI | ||
jobs: | ||
flatpak: | ||
name: "Flatpak" | ||
runs-on: ubuntu-24.04 | ||
container: | ||
image: bilelmoussaoui/flatpak-github-actions:gnome-47 | ||
options: --privileged | ||
strategy: | ||
matrix: | ||
arch: [x86_64, aarch64] | ||
fail-fast: false | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- name: Install deps | ||
if: ${{ matrix.arch != 'x86_64' }} | ||
run: | | ||
dnf -y install docker | ||
- name: Set up QEMU | ||
if: ${{ matrix.arch != 'x86_64' }} | ||
id: qemu | ||
uses: docker/setup-qemu-action@v2 | ||
with: | ||
platforms: arm64 | ||
- uses: flatpak/flatpak-github-actions/flatpak-builder@v6 | ||
with: | ||
bundle: aardvark.flatpak | ||
manifest-path: org.p2panda.aardvark.json | ||
cache-key: flatpak-builder-${{ github.sha }} | ||
arch: ${{ matrix.arch }} | ||
macos: | ||
name: "macOS" | ||
runs-on: macos-latest | ||
strategy: | ||
matrix: | ||
include: | ||
- target: x86_64-apple-darwin | ||
arch: x86_64 | ||
- target: aarch64-apple-darwin | ||
arch: arm64 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: moonrepo/setup-rust@v1 | ||
with: | ||
targets: ${{ matrix.target }} | ||
with: | ||
Check failure on line 53 in .github/workflows/build.yml GitHub Actions / CIInvalid workflow file
|
||
target: ${{ matrix.target }} | ||
- name: Build | ||
run: | | ||
cargo build --release --target ${{ matrix.target }} | ||
- name: Create App Bundle | ||
run: | | ||
mkdir -p Aardvark.app/Contents/MacOS | ||
cp target/${{ matrix.target }}/release/aardvark Aardvark.app/Contents/MacOS/ | ||
# Create Info.plist - you'll need to customize this | ||
cat > Aardvark.app/Contents/Info.plist << EOF | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>CFBundleExecutable</key> | ||
<string>aardvark</string> | ||
<key>CFBundleIdentifier</key> | ||
<string>org.p2panda.aardvark</string> | ||
<key>CFBundleName</key> | ||
<string>Aardvark</string> | ||
<key>CFBundlePackageType</key> | ||
<string>APPL</string> | ||
<key>CFBundleShortVersionString</key> | ||
<string>1.0</string> | ||
</dict> | ||
</plist> | ||
EOF | ||
- name: Create DMG | ||
run: | | ||
hdiutil create -volname "Aardvark" -srcfolder Aardvark.app -ov -format UDZO aardvark-${{ matrix.arch }}.dmg | ||
- name: Upload Artifact | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: aardvark-macos-${{ matrix.arch }} | ||
path: aardvark-${{ matrix.arch }}.dmg | ||
windows: | ||
name: "Windows" | ||
runs-on: windows-latest | ||
strategy: | ||
matrix: | ||
arch: [x64, arm64] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: moonrepo/setup-rust@v1 | ||
with: | ||
targets: ${{ matrix.arch == 'x64' && 'x86_64-pc-windows-msvc' || 'aarch64-pc-windows-msvc' }} | ||
with: | ||
target: ${{ matrix.arch == 'x64' && 'x86_64-pc-windows-msvc' || 'aarch64-pc-windows-msvc' }} | ||
- name: Build | ||
run: | | ||
cargo build --release --target ${{ matrix.arch == 'x64' && 'x86_64-pc-windows-msvc' || 'aarch64-pc-windows-msvc' }} | ||
- name: Package | ||
run: | | ||
mkdir aardvark-${{ matrix.arch }} | ||
copy target/${{ matrix.arch == 'x64' && 'x86_64-pc-windows-msvc' || 'aarch64-pc-windows-msvc' }}/release/aardvark.exe aardvark-${{ matrix.arch }}/ | ||
# Add any additional DLLs or resources here | ||
- name: Create ZIP | ||
run: | | ||
Compress-Archive -Path aardvark-${{ matrix.arch }} -DestinationPath aardvark-windows-${{ matrix.arch }}.zip | ||
- name: Upload Artifact | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: aardvark-windows-${{ matrix.arch }} | ||
path: aardvark-windows-${{ matrix.arch }}.zip |