CMake Build #112
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: CMake Build | |
on: | |
pull_request: | |
types: [opened, synchronize] | |
branches: main-ge | |
schedule: | |
# Run workflow night at 5 AM UTC (10PM PST) | |
- cron: '0 5 * * *' | |
workflow_dispatch: | |
# see binary-caching-github-actions-cache | |
env: | |
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite" | |
jobs: | |
build: | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout AIEBU | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
# See binary caching with github actions | |
- name: Export GitHub Actions cache environment variables | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || ''); | |
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || ''); | |
- name: Install Dependencies (Linux) and configure CMake | |
if: runner.os == 'Linux' | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y pkg-config libelf-dev libboost-dev pylint elfutils | |
python -m pip install --upgrade pip | |
pip install pyyaml jinja2 Markdown pylint colorama gitPython wrapt | |
cmake -B ${{github.workspace}}/build/Release \ | |
-DCMAKE_BUILD_TYPE=Release -DAIEBU_PYTHON=ON | |
- name: Save Python Path for ise with CMake | |
if: runner.os == 'Windows' | |
run: | | |
$python_path = (Get-Command python3).path | |
echo "PYTHON_EXECUTABLE=$python_path" | |
echo "PYTHON_EXECUTABLE=$python_path" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
- name: Install Dependencies (Windows) and configure CMake | |
if: runner.os == 'Windows' | |
run: | | |
vcpkg integrate install | |
vcpkg install boost-format boost-uuid boost-interprocess boost-algorithm boost-property-tree boost-headers --triplet=x64-windows | |
# install python dependencies | |
python -m pip install --upgrade pip | |
python -m pip install pyyaml jinja2 Markdown pylint colorama gitPython wrapt | |
# configure cmake specifying path to python | |
cmake -B ${{github.workspace}}/build/Release ` | |
-DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake ` | |
-DCMAKE_BUILD_TYPE=Release ` | |
-DPython3_EXECUTABLE=${{ env.PYTHON_EXECUTABLE }} ` | |
-DAIEBU_PYTHON=ON | |
- name: Build | |
run: | | |
cmake --build ${{github.workspace}}/build/Release --config Release --target install | |
- name: Test (Linux) | |
if: runner.os == 'Linux' | |
run: | | |
cmake --build ${{github.workspace}}/build/Release --config Release --target test | |
- name: Test (Windows) | |
if: runner.os == 'Windows' | |
run: | | |
cmake --build ${{github.workspace}}/build/Release --config Release --target run_tests | |
- name: Package (Linux) | |
if: runner.os == 'Linux' | |
run: | | |
cpack -G TGZ -B ${{github.workspace}}/build/Release -C Release --config build/Release/CPackConfig.cmake | |
- name: Package (Windows) | |
if: runner.os == 'Windows' | |
run: | | |
cpack -G ZIP -B ${{github.workspace}}/build/Release -C Release --config build/Release/CPackConfig.cmake | |
- name: Upload (Linux) | |
if: runner.os == 'Linux' && (github.event_name == 'workflow_dispatch' || github.event_name == 'schedule') | |
uses: actions/upload-artifact@v4 | |
with: | |
name: aiebu_release_linux | |
path: ${{github.workspace}}/build/Release/AIEBU-*-Linux.tar.gz | |
- name: Upload (Windows) | |
if: runner.os == 'Windows' && (github.event_name == 'workflow_dispatch' || github.event_name == 'schedule') | |
uses: actions/upload-artifact@v4 | |
with: | |
name: aiebu_release_windows | |
path: ${{github.workspace}}/build/Release/AIEBU-*-win64.zip | |
retention-days: 7 |