Compare commits

...

2 Commits

Author SHA1 Message Date
William Bell
fb8b6a89ae build for more architectures 2025-08-16 03:41:32 +01:00
William Bell
6ddf9953e7 change windows builds to tar.gz 2025-08-16 03:23:01 +01:00

View File

@@ -12,13 +12,21 @@ on:
jobs: jobs:
build-linux: build-linux:
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy:
matrix:
arch: [x86_64, arm64]
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
with: with:
submodules: recursive submodules: recursive
- name: Install build tools - name: Install build tools
run: sudo apt-get update && sudo apt-get install -y flex bison run: |
sudo apt-get update
sudo apt-get install -y flex bison make cmake build-essential
if [ "${{ matrix.arch }}" = "arm64" ]; then
sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
fi
- name: Setup Python - name: Setup Python
uses: actions/setup-python@v4 uses: actions/setup-python@v4
@@ -33,17 +41,28 @@ jobs:
- name: Build - name: Build
run: | run: |
conan install . --build=missing BUILD_DIR="build_${{ matrix.arch }}"
conan build . mkdir -p "$BUILD_DIR"
cd "$BUILD_DIR"
if [ "${{ matrix.arch }}" = "arm64" ]; then
export CC=aarch64-linux-gnu-gcc
export CXX=aarch64-linux-gnu-g++
fi
conan install .. --build=missing
conan build ..
cd ..
- name: Package - name: Package
run: | run: |
TAG=${GITHUB_REF##refs/tags/} TAG=${GITHUB_REF##refs/tags/}
OS=$(uname -s | tr '[:upper:]' '[:lower:]') OS="linux"
ARCH=$(uname -m) ARCH="${{ matrix.arch }}"
FOLDER="chloride-$TAG-$OS-$ARCH" FOLDER="chloride-$TAG-$OS-$ARCH"
TAR="$FOLDER.tar.gz" TAR="$FOLDER.tar.gz"
mv build/bin "$FOLDER" mv build_${ARCH}/bin "$FOLDER"
cp LICENSE.txt "$FOLDER" cp LICENSE.txt "$FOLDER"
tar -czf "$TAR" "$FOLDER" tar -czf "$TAR" "$FOLDER"
echo "TAR_NAME=$TAR" >> $GITHUB_ENV echo "TAR_NAME=$TAR" >> $GITHUB_ENV
@@ -51,11 +70,14 @@ jobs:
- name: Upload artifact - name: Upload artifact
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: linux-artifact name: linux-${{ matrix.arch }}-artifact
path: ${{ env.TAR_NAME }} path: ${{ env.TAR_NAME }}
build-macos: build-macos:
runs-on: macos-latest runs-on: macos-latest
strategy:
matrix:
arch: [x86_64, arm64] # build both architectures
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
with: with:
@@ -77,17 +99,29 @@ jobs:
- name: Build - name: Build
run: | run: |
conan install . --build=missing # Create a build directory per arch
conan build . BUILD_DIR="build_${{ matrix.arch }}"
mkdir -p "$BUILD_DIR"
cd "$BUILD_DIR"
# Use the matrix architecture for the build
export CFLAGS="-arch ${{ matrix.arch }}"
export CXXFLAGS="-arch ${{ matrix.arch }}"
export LDFLAGS="-arch ${{ matrix.arch }}"
conan install .. --build=missing
conan build ..
cd ..
- name: Package - name: Package
run: | run: |
TAG=${GITHUB_REF##refs/tags/} TAG=${GITHUB_REF##refs/tags/}
OS=$(uname -s | tr '[:upper:]' '[:lower:]') OS="macos"
ARCH=$(uname -m) ARCH="${{ matrix.arch }}"
FOLDER="chloride-$TAG-$OS-$ARCH" FOLDER="chloride-$TAG-$OS-$ARCH"
TAR="$FOLDER.tar.gz" TAR="$FOLDER.tar.gz"
mv build/bin "$FOLDER" mv build_${ARCH}/bin "$FOLDER"
cp LICENSE.txt "$FOLDER" cp LICENSE.txt "$FOLDER"
tar -czf "$TAR" "$FOLDER" tar -czf "$TAR" "$FOLDER"
echo "TAR_NAME=$TAR" >> $GITHUB_ENV echo "TAR_NAME=$TAR" >> $GITHUB_ENV
@@ -95,11 +129,14 @@ jobs:
- name: Upload artifact - name: Upload artifact
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: macos-artifact name: macos-${{ matrix.arch }}-artifact
path: ${{ env.TAR_NAME }} path: ${{ env.TAR_NAME }}
build-windows: build-windows:
runs-on: windows-latest runs-on: windows-latest
strategy:
matrix:
arch: [x86_64, arm64]
defaults: defaults:
run: run:
shell: msys2 {0} shell: msys2 {0}
@@ -109,7 +146,8 @@ jobs:
with: with:
submodules: recursive submodules: recursive
- uses: msys2/setup-msys2@v2 - name: Setup MSYS2
uses: msys2/setup-msys2@v2
with: with:
msystem: MINGW64 msystem: MINGW64
update: true update: true
@@ -130,25 +168,37 @@ jobs:
- name: Build Project - name: Build Project
run: | run: |
conan install . --profile mingw-profile.txt --build=missing BUILD_DIR="build_${{ matrix.arch }}"
conan build . --profile mingw-profile.txt mkdir -p "$BUILD_DIR"
cd "$BUILD_DIR"
if [ "${{ matrix.arch }}" = "arm64" ]; then
# Use the ARM64 cross-compiler
export CC=aarch64-w64-mingw32-gcc
export CXX=aarch64-w64-mingw32-g++
fi
conan install .. --profile mingw-profile.txt --build=missing
conan build .. --profile mingw-profile.txt
cd ..
- name: Package - name: Package
run: | run: |
$TAG = $env:GITHUB_REF -replace 'refs/tags/', '' TAG=${GITHUB_REF##refs/tags/}
$ARCH = if ([Environment]::Is64BitOperatingSystem) { 'x64' } else { 'x86' } OS="windows"
$FOLDER = "chloride-$TAG-windows-$ARCH" ARCH="${{ matrix.arch }}"
$ZIP = "$FOLDER.zip" FOLDER="chloride-$TAG-$OS-$ARCH"
Rename-Item build/bin $FOLDER ZIP="$FOLDER.zip"
Copy-Item LICENSE.txt $FOLDER mv build_${ARCH}/bin "$FOLDER"
Compress-Archive -Path $FOLDER -DestinationPath $ZIP cp LICENSE.txt "$FOLDER"
echo "TAR_NAME=$ZIP" >> $env:GITHUB_ENV powershell Compress-Archive -Path "$FOLDER" -DestinationPath "$ZIP"
shell: pwsh echo "TAR_NAME=$ZIP" >> $GITHUB_ENV
- name: Upload artifact - name: Upload artifact
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: windows-artifact name: windows-${{ matrix.arch }}-artifact
path: ${{ env.TAR_NAME }} path: ${{ env.TAR_NAME }}
release: release: