Compare commits

..

5 Commits

Author SHA1 Message Date
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
2 changed files with 93 additions and 55 deletions

View File

@@ -1,7 +1,3 @@
# SPDX-FileCopyrightText: 2025 William Bell
#
# SPDX-License-Identifier: GPL-3.0-or-later
name: Build and Release name: Build and Release
on: on:
@@ -17,6 +13,21 @@ jobs:
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: 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
# Windows
- name: Install build tools (Windows)
if: runner.os == 'Windows'
run: choco install winflexbison -y
shell: pwsh
- name: Checkout code - name: Checkout code
uses: actions/checkout@v3 uses: actions/checkout@v3
with: with:
@@ -27,24 +38,47 @@ jobs:
with: with:
python-version: '3.x' python-version: '3.x'
- name: Install Conan - name: Install Conan (Linux/macOS)
if: runner.os != 'Windows'
run: | run: |
python -m pip install --upgrade pip python -m pip install --upgrade pip
pip install conan 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 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: | run: |
conan install . --build=missing conan install . --build=missing
conan build . conan build .
shell: ${{ matrix.os == 'windows-latest' && 'pwsh' || 'bash' }} shell: bash
- name: Determine if prerelease - name: Install dependencies and build (Windows)
id: prerelease_check if: runner.os == 'Windows'
run: |
conan install . --build=missing
conan build .
shell: pwsh
- name: Determine if prerelease (Linux/macOS)
if: runner.os != 'Windows'
id: prerelease_check_unix
run: | run: |
TAG=${GITHUB_REF##refs/tags/} TAG=${GITHUB_REF##refs/tags/}
if [[ "$TAG" == prerelease-* ]]; then if [[ "$TAG" == prerelease-* ]]; then
@@ -53,48 +87,54 @@ jobs:
echo "false" > prerelease.txt echo "false" > prerelease.txt
fi fi
echo "prerelease=$(cat prerelease.txt)" >> $GITHUB_OUTPUT 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: | run: |
TAG=${GITHUB_REF##refs/tags/} TAG=${GITHUB_REF##refs/tags/}
if [[ "$RUNNER_OS" == "Linux" ]]; then OS=$(uname -s | tr '[:upper:]' '[:lower:]')
OS=linux ARCH=$(uname -m)
ARCH=$(uname -m) FOLDER_NAME="chloride-$TAG-$OS-$ARCH"
FOLDER_NAME="chloride-$TAG-$OS-$ARCH" TAR_NAME="$FOLDER_NAME.tar.gz"
TAR_NAME="$FOLDER_NAME.tar.gz" mv build/bin "$FOLDER_NAME"
mv build/bin "$FOLDER_NAME" cp LICENSE "$FOLDER_NAME"
cp LICENSE "$FOLDER_NAME" tar -czf "$TAR_NAME" "$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
$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
Compress-Archive -Path $FOLDER_NAME -DestinationPath $TAR_NAME
fi
echo "TAR_NAME=$TAR_NAME" >> $GITHUB_ENV echo "TAR_NAME=$TAR_NAME" >> $GITHUB_ENV
shell: ${{ matrix.os == 'windows-latest' && 'pwsh' || 'bash' }} 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
Compress-Archive -Path $FOLDER_NAME -DestinationPath $TAR_NAME
echo "TAR_NAME=$TAR_NAME" >> $env:GITHUB_ENV
shell: pwsh
- name: Create GitHub Release - name: Create GitHub Release
id: create_release
uses: ncipollo/release-action@v1 uses: ncipollo/release-action@v1
with: with:
tag: ${{ github.ref_name }} tag: ${{ github.ref_name }}
name: Release ${{ github.ref_name }} name: Release ${{ github.ref_name }}
body: | body: Automated release based on tag ${{ github.ref_name }}
Automated release based on tag ${{ github.ref_name }}
draft: false draft: false
prerelease: ${{ steps.prerelease_check.outputs.prerelease }} prerelease: ${{ runner.os == 'Windows' && steps.prerelease_check_win.outputs.prerelease || steps.prerelease_check_unix.outputs.prerelease }}
artifacts: ${{ env.TAR_NAME }} artifacts: ${{ env.TAR_NAME }}

View File

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