Compare commits

...

12 Commits

Author SHA1 Message Date
William Bell
922b129250 fix release.yml 2025-08-15 20:18:17 +01:00
William Bell
c2df9c0e83 fix release.yml 2025-08-15 20:15:18 +01:00
William Bell
923503493e fix release.yml 2025-08-15 20:04:55 +01:00
William Bell
686cb08f11 fix conan file 2025-08-15 19:56:54 +01:00
William Bell
1cfb4acda6 fix CMakeLists.txt 2025-08-15 19:52:33 +01:00
William Bell
436f30330b fix copying license 2025-08-15 19:45:12 +01:00
William Bell
5381967ed6 fix conanfile 2025-08-15 19:40:41 +01:00
William Bell
6f84a4a485 fix conan file 2025-08-15 19:37:38 +01:00
William Bell
4b4b1fa777 fix release.yml 2025-08-15 19:22:26 +01:00
William Bell
2b6e785638 fix conan file 2025-08-15 19:19:15 +01:00
William Bell
51e82e5b2e fix release.yml 2025-08-15 19:15:28 +01:00
William Bell
2c56810cc4 change release.yml 2025-08-15 19:13:49 +01:00
3 changed files with 103 additions and 57 deletions

View File

@@ -1,7 +1,3 @@
# SPDX-FileCopyrightText: 2025 William Bell
#
# SPDX-License-Identifier: GPL-3.0-or-later
name: Build and Release
on:
@@ -17,34 +13,75 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
# Linux
- name: Install build tools (Linux)
if: runner.os == 'Linux'
run: sudo apt-get update && sudo apt-get install -y flex bison
# macOS
- name: Install build tools (macOS)
if: runner.os == 'macOS'
run: brew install flex bison
- name: Checkout code
uses: actions/checkout@v3
with:
submodules: recursive
# Windows
- name: Install build tools (Windows)
if: runner.os == 'Windows'
run: |
choco install winflexbison mingw -y
cmake -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++
shell: pwsh
- name: Setup Python (needed for Conan)
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Install Conan
- name: Install Conan (Linux/macOS)
if: runner.os != 'Windows'
run: |
python -m pip install --upgrade pip
pip install conan
shell: ${{ matrix.os == 'windows-latest' && 'pwsh' || 'bash' }}
shell: bash
- name: Configure Conan
- name: Install Conan (Windows)
if: runner.os == 'Windows'
run: |
python -m pip install --upgrade pip
pip install conan
shell: pwsh
- name: Configure Conan (Linux/macOS)
if: runner.os != 'Windows'
run: conan profile detect
shell: ${{ matrix.os == 'windows-latest' && 'pwsh' || 'bash' }}
shell: bash
- name: Install dependencies and build with Conan
- name: Configure Conan (Windows)
if: runner.os == 'Windows'
run: conan profile detect
shell: pwsh
- name: Install dependencies and build (Linux/macOS)
if: runner.os != 'Windows'
run: |
conan install . --build=missing
conan build .
shell: ${{ matrix.os == 'windows-latest' && 'pwsh' || 'bash' }}
shell: bash
- name: Determine if prerelease
id: prerelease_check
- name: Install dependencies and build (Windows)
if: runner.os == 'Windows'
run: |
conan install . --build=missing
conan build . --config Release
shell: pwsh
- name: Determine if prerelease (Linux/macOS)
if: runner.os != 'Windows'
id: prerelease_check_unix
run: |
TAG=${GITHUB_REF##refs/tags/}
if [[ "$TAG" == prerelease-* ]]; then
@@ -53,48 +90,56 @@ jobs:
echo "false" > prerelease.txt
fi
echo "prerelease=$(cat prerelease.txt)" >> $GITHUB_OUTPUT
shell: ${{ matrix.os == 'windows-latest' && 'pwsh' || 'bash' }}
shell: bash
- name: Archive build folder
- name: Determine if prerelease (Windows)
if: runner.os == 'Windows'
id: prerelease_check_win
run: |
$TAG = $env:GITHUB_REF -replace 'refs/tags/', ''
if ($TAG -like 'prerelease-*') {
echo "true" > prerelease.txt
} else {
echo "false" > prerelease.txt
}
echo "prerelease=$(Get-Content prerelease.txt)" >> $env:GITHUB_OUTPUT
shell: pwsh
- name: Archive build folder (Linux/macOS)
if: runner.os != 'Windows'
run: |
TAG=${GITHUB_REF##refs/tags/}
if [[ "$RUNNER_OS" == "Linux" ]]; then
OS=linux
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
ARCH=$(uname -m)
FOLDER_NAME="chloride-$TAG-$OS-$ARCH"
TAR_NAME="$FOLDER_NAME.tar.gz"
mv build/bin "$FOLDER_NAME"
cp LICENSE "$FOLDER_NAME"
cp LICENSE.txt "$FOLDER_NAME"
tar -czf "$TAR_NAME" "$FOLDER_NAME"
elif [[ "$RUNNER_OS" == "macOS" ]]; then
OS=macos
ARCH=$(uname -m)
FOLDER_NAME="chloride-$TAG-$OS-$ARCH"
TAR_NAME="$FOLDER_NAME.tar.gz"
mv build/bin "$FOLDER_NAME"
cp LICENSE "$FOLDER_NAME"
tar -czf "$TAR_NAME" "$FOLDER_NAME"
else
# Windows
echo "TAR_NAME=$TAR_NAME" >> $GITHUB_ENV
shell: bash
- name: Archive build folder (Windows)
if: runner.os == 'Windows'
run: |
$TAG = $env:GITHUB_REF -replace 'refs/tags/', ''
$ARCH = if ([Environment]::Is64BitOperatingSystem) { 'x64' } else { 'x86' }
$FOLDER_NAME = "chloride-$TAG-windows-$ARCH"
$TAR_NAME = "$FOLDER_NAME.zip"
Rename-Item build\bin $FOLDER_NAME
Copy-Item LICENSE $FOLDER_NAME
Copy-Item LICENSE.txt $FOLDER_NAME
Compress-Archive -Path $FOLDER_NAME -DestinationPath $TAR_NAME
fi
echo "TAR_NAME=$TAR_NAME" >> $GITHUB_ENV
shell: ${{ matrix.os == 'windows-latest' && 'pwsh' || 'bash' }}
echo "TAR_NAME=$TAR_NAME" >> $env:GITHUB_ENV
shell: pwsh
- name: Create GitHub Release
id: create_release
uses: ncipollo/release-action@v1
with:
tag: ${{ github.ref_name }}
name: Release ${{ github.ref_name }}
body: |
Automated release based on tag ${{ github.ref_name }}
body: Automated release based on tag ${{ github.ref_name }}
draft: false
prerelease: ${{ steps.prerelease_check.outputs.prerelease }}
updateOnlyUnreleased: true
replacesArtifacts: true
prerelease: ${{ runner.os == 'Windows' && steps.prerelease_check_win.outputs.prerelease || steps.prerelease_check_unix.outputs.prerelease }}
artifacts: ${{ env.TAR_NAME }}

View File

@@ -52,7 +52,9 @@ find_package(BDWgc REQUIRED)
find_package(gmp REQUIRED)
target_compile_options(argon PRIVATE -O3 -Wall -Wextra -Wno-unused-function -s)
target_link_options(argon PRIVATE -static)
if(NOT APPLE)
target_link_options(argon PRIVATE -static)
endif()
target_link_libraries(argon PRIVATE
BDWgc::BDWgc

View File

@@ -5,6 +5,7 @@
from conan import ConanFile
from conan.tools.cmake import CMake, CMakeToolchain, CMakeDeps, cmake_layout
from shutil import which
import os
class ArgonConan(ConanFile):
name = "argon"
@@ -31,18 +32,16 @@ class ArgonConan(ConanFile):
def generate(self):
tc = CMakeToolchain(self)
# Try to find flex in system PATH first
flex_path = which("flex")
# If not found, fallback to flex from Conan build requirements
if os.name == "nt": # Windows
flex_path = which("win_flex") or which("win_flex.exe")
if not flex_path:
flex_dep = self.dependencies.build.get("flex", None)
if not flex_dep:
raise Exception("Flex not found in system PATH and not declared as build requirement")
flex_path = join(flex_dep.package_folder, "bin", "flex")
tc.variables["FLEX_EXECUTABLE"] = flex_path
raise Exception("win_flex not found in PATH. Install winflexbison via choco.")
else:
flex_path = which("flex")
if not flex_path:
raise Exception("Flex not found in system PATH. Please install flex on Linux/macOS.")
tc.variables["FLEX_EXECUTABLE"] = flex_path.replace("\\", "\\\\")
tc.generate()
def build(self):