Compare commits

..

3 Commits

Author SHA1 Message Date
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 71 additions and 53 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:
@@ -27,24 +23,47 @@ jobs:
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 .
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 +72,54 @@ 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
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"
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
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"
tar -czf "$TAR_NAME" "$FOLDER_NAME"
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
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 }}
prerelease: ${{ runner.os == 'Windows' && steps.prerelease_check_win.outputs.prerelease || steps.prerelease_check_unix.outputs.prerelease }}
artifacts: ${{ env.TAR_NAME }}

View File

@@ -31,18 +31,11 @@ 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 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")
raise Exception("Flex not found in system PATH. Please install flex on your system.")
tc.variables["FLEX_EXECUTABLE"] = flex_path
tc.generate()
def build(self):