Build and Release #7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Release | |
on: | |
workflow_dispatch: | |
inputs: | |
versionTag: | |
description: 'Version tag in release name' | |
required: false | |
type: string | |
default: 'v0.0.' | |
jobs: | |
build: | |
name: Build on ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
#os: [windows-latest, ubuntu-latest] | |
os: [ubuntu-latest] | |
include: | |
# - os: windows-latest | |
# suffix: win64 | |
- os: ubuntu-latest | |
suffix: linux64 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.10' | |
- name: Install CMake | |
uses: lukka/get-cmake@latest | |
- name: Install LLVM/Clang | |
uses: KyleMayes/install-llvm-action@v2 | |
with: | |
version: '17' | |
env: 1 | |
- name: Symlink libclang.so (Linux) | |
if: contains(matrix.os, 'ubuntu') | |
run: sudo ln -s libclang-11.so.1 /lib/x86_64-linux-gnu/libclang.so | |
working-directory: ${{ env.LLVM_PATH }}/lib | |
- name: Configure CMake (Windows) | |
if: runner.os == 'Windows' | |
run: cmake -B build -DREFLECT_BUILD_EXAMPLE=OFF -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ | |
- name: Configure CMake (Linux) | |
if: runner.os != 'Windows' | |
run: CC=clang CXX=clang++ cmake -B build -DREFLECT_BUILD_EXAMPLE=OFF -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCXX_STANDARD=20 | |
- name: Build | |
run: cmake --build build | |
- name: Archive and upload artifacts | |
run: | | |
mkdir artifacts | |
find build/bin -type f -exec cp {} artifacts/{}_$(echo ${{ matrix.suffix }}) \; | |
shell: bash | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.ref }} | |
release_name: Release ${{ inputs.versionTag }} | |
draft: false | |
prerelease: false | |
- name: Upload Release Asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./artifacts/ | |
asset_name: ${{ matrix.os }}-artifacts.zip | |
asset_content_type: application/zip |