Add GitHub Actions workflow #8
Workflow file for this run
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 | |
on: | |
push: | |
pull_request: | |
workflow_dispatch: | |
jobs: | |
build: | |
name: ${{ matrix.platform.display_name }} ${{ matrix.preset_build_type.display_name }} | |
runs-on: ${{ matrix.platform.os }} | |
defaults: | |
run: | |
shell: bash | |
strategy: | |
fail-fast: false | |
matrix: | |
platform: | |
- { display_name: 'Linux Native Libraries', os: ubuntu-latest, preset_os: linux } | |
- { display_name: 'Windows Native Libraries', os: windows-latest, preset_os: windows } | |
preset_build_type: | |
- { display_name: 'Debug', name: debug } | |
- { display_name: 'Release', name: release } | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set reusable strings | |
run: | | |
preset_name="${{ matrix.platform.preset_os }}-${{ matrix.preset_build_type.name }}" | |
workspace_dir="${{ github.workspace }}" | |
source_dir=${workspace_dir//\\//}/mp/src | |
build_dir=${workspace_dir//\\//}/mp/src/build/$preset_name | |
install_dir=$build_dir/install | |
echo "source_dir=$source_dir" >> "$GITHUB_ENV" | |
echo "build_dir=$build_dir" >> "$GITHUB_ENV" | |
echo "install_dir=$install_dir" >> "$GITHUB_ENV" | |
echo "preset_name=$preset_name" >> "$GITHUB_ENV" | |
- name: Install packages | |
if: ${{ matrix.platform.os == 'ubuntu-latest' }} | |
run: | | |
sudo apt update | |
sudo apt install gcc-multilib g++-multilib ninja-build -y | |
- name: Install packages | |
if: ${{ matrix.platform.os == 'windows-latest' }} | |
run: choco install -y ninja | |
- uses: ilammy/msvc-dev-cmd@v1 | |
if: ${{ matrix.platform.os == 'windows-latest' }} | |
with: | |
arch: x86 | |
- name: Print PATH | |
if: ${{ matrix.platform.os == 'windows-latest' }} | |
run: | | |
echo "PATH: $PATH" | |
# Libraries | |
- name: CMake configure libraries build | |
working-directory: ${{ env.source_dir }} | |
run: > | |
cmake | |
--preset ${{ env.preset_name }} | |
-DCMAKE_INSTALL_PREFIX=${{ env.install_dir }} | |
-DNEO_CI_BUILD=ON | |
-DNEO_USE_CCACHE=OFF | |
-DNEO_COPY_LIBRARIES=OFF | |
-DNEO_USE_SEPARATE_BUILD_INFO=ON | |
-DNEO_INSTALL_LIBRARIES=ON | |
-DNEO_INSTALL_RESOURCES=OFF | |
- name: CMake libraries build | |
working-directory: ${{ env.source_dir }} | |
run: cmake --build --preset ${{ env.preset_name }} --parallel --verbose | |
- name: Install libraries | |
run: cmake --install ${{ env.build_dir }} | |
# Dedicated library | |
- name: CMake reconfigure dedicated library build | |
working-directory: ${{ env.source_dir }} | |
run: > | |
cmake | |
--preset ${{ env.preset_name }} | |
-DNEO_DEDICATED=ON | |
- name: CMake dedicated library build | |
working-directory: ${{ env.source_dir }} | |
run: cmake --build --preset ${{ env.preset_name }} --parallel --verbose | |
- name: Install dedicated library | |
run: cmake --install ${{ env.build_dir }} | |
# Artifacts | |
- name: Get artifact names | |
working-directory: ${{ env.install_dir }} | |
run: | | |
echo "libraries=$(find . -regex '\.\/neo-\w*-\w*-libraries-\w*-\w*' -printf '%f')" >> "$GITHUB_ENV" | |
echo "libraries_debuginfo=$(find . -regex '\.\/neo-\w*-\w*-libraries-debuginfo-\w*-\w*' -printf '%f')" >> "$GITHUB_ENV" | |
echo "dedicated=$(find . -regex '\.\/neo-\w*-\w*-dedicated-\w*-\w*' -printf '%f')" >> "$GITHUB_ENV" | |
echo "dedicated_debuginfo=$(find . -regex '\.\/neo-\w*-\w*-dedicated-debuginfo-\w*-\w*' -printf '%f')" >> "$GITHUB_ENV" | |
- name: Upload libraries | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.libraries }} | |
path: ${{ env.install_dir }}/${{ env.libraries }} | |
- name: Upload libraries debug information | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.libraries_debuginfo }} | |
path: ${{ env.install_dir }}/${{ env.libraries_debuginfo }} | |
- name: Upload dedicated library | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.dedicated }} | |
path: ${{ env.install_dir }}/${{ env.dedicated }} | |
- name: Upload dedicated library debug information | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.dedicated_debuginfo }} | |
path: ${{ env.install_dir }}/${{ env.dedicated_debuginfo }} | |
pack-resources: | |
name: Windows Native Resources | |
runs-on: windows-latest | |
defaults: | |
run: | |
shell: bash | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set reusable strings | |
run: | | |
workspace_dir="${{ github.workspace }}" | |
source_dir=${workspace_dir//\\//}/mp/src | |
build_dir=${workspace_dir//\\//}/mp/src/build/windows-release | |
install_dir=$build_dir/install | |
echo "source_dir=$source_dir" >> "$GITHUB_ENV" | |
echo "build_dir=$build_dir" >> "$GITHUB_ENV" | |
echo "install_dir=$install_dir" >> "$GITHUB_ENV" | |
- name: Install packages | |
run: choco install -y ninja | |
- uses: ilammy/msvc-dev-cmd@v1 | |
with: | |
arch: x86 | |
# Resources | |
- name: CMake configure resources build | |
working-directory: ${{ env.source_dir }} | |
run: > | |
cmake | |
--preset windows-release | |
-DCMAKE_INSTALL_PREFIX=${{ env.install_dir }} | |
-DNEO_USE_CCACHE=OFF | |
-DNEO_COPY_LIBRARIES=OFF | |
-DNEO_INSTALL_LIBRARIES=OFF | |
-DNEO_INSTALL_RESOURCES=ON | |
- name: Install resources | |
run: cmake --install ${{ env.build_dir }} | |
- name: Get artifact name | |
working-directory: ${{ env.install_dir }} | |
run: echo "resources=$(echo neo-*-*-resources)" >> "$GITHUB_ENV" | |
- name: Upload resources | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.resources }} | |
path: ${{ env.install_dir }}/${{ env.resources }} |