Open elcritch opened 1 year ago
I started trying to solve this for Atlas, and should be helpful here too:
task buildRelease, "Build release":
when defined(macosx):
let x86Args = "\"-target x86_64-apple-macos11 -arch x86_64 -DARCH=x86_64\""
exec "nim c -d:release --passC:" & x86args & " --passL:" & x86args & " -o:./atlas_x86_64 src/atlas.nim"
let armArgs = "\"-target arm64-apple-macos11 -arch arm64 -DARCH=arm64\""
exec "nim c -d:release --passC:" & armArgs & " --passL:" & armArgs & " -o:./atlas_arm64 src/atlas.nim"
exec "lipo -create -output atlas atlas_x86_64 atlas_arm64"
rmFile("atlas_x86_64")
rmFile("atlas_arm64")
else:
let os = getEnv("OS")
let arch = getEnv("ARCH")
if os != "" and arch != "":
if os == "windows":
exec "nim c -d:release -d:mingw -o:./atlas src/atlas.nim"
else:
exec "nim c -d:release --cpu:" & arch & " --os:" & os & " -o:./atlas src/atlas.nim"
else:
exec "nim c -d:release -o:./atlas src/atlas.nim"
Then changed the binaries.yml
to:
name: tagging release
on:
push:
tags:
- '*'
workflow_dispatch:
jobs:
build:
strategy:
fail-fast: false
matrix:
target:
- os: linux
arch: amd64
triple: x86_64-linux-gnu
name: linux_x86_64
- os: linux
arch: aarch64
triple: aarch64-linux-gnu
name: linux_arm64
- os: linux
arch: arm
triple: arm-linux-gnueabihf
name: linux_arm
- os: macosx
arch: universal
triple: x86_64-apple-darwin14
name: apple_universal
- os: windows
arch: amd64
triple: x86_64-w64-mingw32
name: windows_x86_64
include:
- target:
os: linux
builder: ubuntu-latest
- target:
os: macosx
builder: macos-latest
defaults:
run:
shell: bash
name: '${{ matrix.target.triple }}'
runs-on: ${{ matrix.builder }}
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: jiro4989/setup-nim-action@v1.4.3
with:
nim-version: "stable"
- name: setup build
if: ${{ matrix.builder }} == "ubuntu-latest"
run: |
sudo apt install gcc make gcc-aarch64-linux-gnu binutils-aarch64-linux-gnu \
gcc-arm-linux-gnueabihf binutils-arm-linux-gnueabihf \
mingw-w64
- name: build
run: |
OS=${{ matrix.target.os }} ARCH=${{ matrix.target.arch }} nim buildRelease
- name: Compress the Nim Language Server binaries
run: |
tar -c -z -v -f atlas-${{ matrix.target.name }}.tar.gz `ls atlas{,.exe} 2>/dev/null || true`
- name: Upload the Nim Language Server Binaries
uses: actions/upload-artifact@v3
with:
name: atlas-${{ matrix.target.name }}.tar.gz
path: atlas-${{ matrix.target.name }}.tar.gz
create-github-release:
name: Create Github Release
needs: [build]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Download artefacts
uses: actions/download-artifact@v2
- uses: ncipollo/release-action@v1
with:
name: Latest Binaries
artifacts: "*/*"
allowUpdates: true
makeLatest: true
- name: Delete artefacts
uses: geekyeggo/delete-artifact@v1
with:
failOnError: false
name: "atlas-*"
Downloading https://github.com/nim-lang/nimble/releases/download/latest/nimble-linux_aarch64.tar.gz I got: