Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
130 changes: 130 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
name: Build and Release

on:
schedule:
- cron: '0 0 * * *'
workflow_dispatch:

jobs:
build:
strategy:
matrix:
include:
- os: ubuntu-latest
artifact_name: lute-linux-x86_64
options: --c-compiler=clang --cxx-compiler=clang++
- os: ubuntu-24.04-arm
artifact_name: lute-linux-aarch64
options: --c-compiler=clang --cxx-compiler=clang++
- os: macos-latest
artifact_name: lute-macos-aarch64
- os: windows-latest
artifact_name: lute-windows-x86_64
fail-fast: false

runs-on: ${{ matrix.os }}

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'

- name: Install dependencies (Linux)
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y ninja-build clang

- name: Install dependencies (macOS)
if: runner.os == 'macOS'
run: |
brew update
brew install cmake ninja

- name: Install dependencies (Windows)
if: runner.os == 'Windows'
run: |
choco install ninja

- if: runner.os == 'Windows'
uses: ilammy/msvc-dev-cmd@v1

- name: Configure
run: python ./tools/luthier.py configure lute --config release ${{ matrix.options }}

- name: Build
run: python ./tools/luthier.py build lute --config release ${{ matrix.options }}

- name: Get Artifact Path
id: artifact_path
shell: bash
run: |
exe_path=$(python ./tools/luthier.py build lute --config release --which)
echo "Executable path: $exe_path" # Debug print
echo "exe_path=$exe_path" >> "$GITHUB_OUTPUT"

- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
path: ${{ steps.artifact_path.outputs.exe_path }}
name: ${{ matrix.artifact_name }}

release:
needs: build
runs-on: ubuntu-latest

permissions:
contents: write

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
sparse-checkout: get_version.cmake

- name: Download Artifact
uses: actions/download-artifact@v4
with:
path: artifacts

- run: |
mkdir release
for dir in ./artifacts/*; do
base_name=$(basename "$dir")
zip -rj release/"${base_name}.zip" "$dir"/*
done

- name: Get project version
id: get_version
run: |
VERSION=$(cmake -P get_version.cmake 2>&1)
echo "version=$VERSION" >> "$GITHUB_OUTPUT"

- name: Create Nightly Tag
id: tag_step
if: github.event_name == 'schedule'
run: |
DATE=$(date +%Y%m%d)
TAG="-nightly.$DATE"
echo "tag=$TAG" >> $GITHUB_OUTPUT

- name: Create Release Tag
id: tag_release
run: |
VERSION=${{ steps.get_version.outputs.version }}
NIGHTLY_TAG=${{ steps.tag_step.outputs.tag }}
RELEASE_TAG="$VERSION$NIGHTLY_TAG"
echo "tag=$RELEASE_TAG" >> $GITHUB_OUTPUT

- name: Create Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.tag_release.outputs.tag }}
name: ${{ steps.tag_release.outputs.tag }}
draft: false
prerelease: ${{ github.event_name == 'schedule' }}
files: release/*.zip
4 changes: 3 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ set(CMAKE_POLICY_DEFAULT_CMP0077 NEW)

set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

project(Lute LANGUAGES CXX C)
include(get_version.cmake)

project(Lute LANGUAGES CXX C VERSION ${LUTE_VERSION})

add_library(Lute.Runtime STATIC)
add_library(Lute.Fs STATIC)
Expand Down
4 changes: 4 additions & 0 deletions get_version.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
cmake_minimum_required(VERSION 3.13)

set(LUTE_VERSION 0.1.0)
message("${LUTE_VERSION}")
25 changes: 23 additions & 2 deletions tools/luthier.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,16 @@ class ReportableError(Exception):
help='print out the path to the compiled binary and exit'
)

argParser.add_argument(
'--cxx-compiler', dest='cxx_compiler', action='store',
help='C++ compiler to use',
)

argParser.add_argument(
'--c-compiler', dest='c_compiler', action='store',
help='C compiler to use',
)

if isWindows:
vsVersionGroup = argParser.add_mutually_exclusive_group()

Expand Down Expand Up @@ -150,7 +160,10 @@ def getProjectPath(args):

config = getConfig(args).lower()

return os.path.join(buildDir, getCompiler(args), config)
if isLinux:
return os.path.join(buildDir, config)
else:
return os.path.join(buildDir, getCompiler(args), config)

def projectPathExists(args):
projectPath = getProjectPath(args)
Expand All @@ -176,7 +189,6 @@ def getExePath(args):
return os.path.join(
buildDir,
config.lower(),
container,
exeName
)

Expand Down Expand Up @@ -206,6 +218,9 @@ def build(args):
targetName = args.target
projectPath = getProjectPath(args)

if isWindows:
targetName = targetName + '.exe'

if args.clean:
call(['ninja', '-C', projectPath, 'clean'])

Expand Down Expand Up @@ -239,6 +254,12 @@ def getConfigureArguments(args):
'-DCMAKE_EXPORT_COMPILE_COMMANDS=1',
]

if args.cxx_compiler:
configArgs.append('-DCMAKE_CXX_COMPILER=' + args.cxx_compiler)

if args.c_compiler:
configArgs.append('-DCMAKE_C_COMPILER=' + args.c_compiler)

return configArgs

def configure(args):
Expand Down