Update build.yml #3
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: | |
branches: | |
- master | |
tags: | |
- v* | |
pull_request: | |
types: [ opened, synchronize, reopened ] | |
jobs: | |
build_windows: | |
name: Build (Windows) | |
runs-on: [ windows-latest ] | |
steps: | |
- name: Get latest CMake and ninja | |
uses: lukka/get-cmake@latest | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Setup VS environment | |
uses: ilammy/msvc-dev-cmd@v1 | |
with: | |
arch: x64 | |
- name: Generate projects | |
run: | | |
mkdir _build | |
cd _build | |
cmake -G Ninja ` | |
-DCMAKE_BUILD_TYPE=RelWithDebInfo ` | |
-DCMAKE_CXX_COMPILER=cl ` | |
-DCMAKE_C_COMPILER=cl ` | |
.. | |
- name: Build | |
run: | | |
cmake --build _build -j2 | |
- name: Copy ResourceTool artifacts | |
run: | | |
cd _build | |
mkdir _resourcetool | |
Copy-Item ResourceTool.exe -Destination _resourcetool/ | |
robocopy ./ ./_resourcetool ResourceLib*.dll ResourceLib*.pdb; if ($lastexitcode -lt 8) { $global:LASTEXITCODE = $null } | |
Copy-Item ../LICENSE -Destination _resourcetool/ | |
- name: Copy CodeGen artifacts | |
run: | | |
cd _build | |
mkdir _codegen | |
Copy-Item CodeGen.exe -Destination _codegen/ | |
Copy-Item CodeGen.pdb -Destination _codegen/ | |
Copy-Item CodeGenLib.dll -Destination _codegen/ | |
Copy-Item CodeGenLib.pdb -Destination _codegen/ | |
Copy-Item PropertyBundler.exe -Destination _codegen/ | |
Copy-Item PropertyBundler.pdb -Destination _codegen/ | |
Copy-Item ../LICENSE -Destination _codegen/ | |
- name: Copy ResourceLib artifacts | |
run: | | |
cd _build | |
mkdir _resourcelib | |
mkdir _resourcelib/Include | |
robocopy ./ ./_resourcelib ResourceLib*.dll ResourceLib*.pdb ResourceLib*.lib; if ($lastexitcode -lt 8) { $global:LASTEXITCODE = $null } | |
Copy-Item ../Libraries/ResourceLib/Include/* -Destination _resourcelib/Include/ | |
Copy-Item ../Libraries/ResourceLib/ResourceLib.cs -Destination _resourcelib/ | |
Copy-Item ../LICENSE -Destination _resourcelib/ | |
- name: Copy NavTool artifacts | |
run: | | |
cd _build | |
mkdir _navtool | |
Copy-Item NavTool.exe -Destination _navtool/ | |
Copy-Item NavTool.pdb -Destination _navtool/ | |
Copy-Item NavWeakness.dll -Destination _navtool/ | |
Copy-Item NavWeakness.lib -Destination _navtool/ | |
Copy-Item NavWeakness.pdb -Destination _navtool/ | |
Copy-Item ../LICENSE -Destination _navtool/ | |
- name: Archive ResourceTool | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ResourceTool-win-x64 | |
path: | | |
_build/_resourcetool/* | |
- name: Archive CodeGen | |
uses: actions/upload-artifact@v4 | |
with: | |
name: CodeGen-win-x64 | |
path: | | |
_build/_codegen/* | |
- name: Archive ResourceLib | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ResourceLib-win-x64 | |
path: | | |
_build/_resourcelib/* | |
- name: Archive NavWeakness | |
uses: actions/upload-artifact@v2 | |
with: | |
name: NavWeakness-win-x64 | |
path: | | |
_build/_navweakness/* | |
- name: Archive NavTool | |
uses: actions/upload-artifact@v2 | |
with: | |
name: NavTool-win-x64 | |
path: | | |
_build/_navtool/* | |
build_linux: | |
name: Build (Linux) | |
runs-on: [ ubuntu-22.04 ] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Set up Clang | |
uses: egor-tensin/setup-clang@v1 | |
with: | |
version: 17 | |
platform: x64 | |
- name: Generate projects | |
run: | | |
mkdir _build | |
cd _build | |
cmake -G "Unix Makefiles" \ | |
-DCMAKE_BUILD_TYPE=Release \ | |
-DCMAKE_CXX_COMPILER=clang++-17 \ | |
-DCMAKE_C_COMPILER=clang-17 \ | |
.. | |
- name: Build | |
run: | | |
cmake --build _build -j2 | |
- name: Copy resource lib artifacts | |
run: | | |
cd _build | |
mkdir _resourcelib | |
cp -r ../Libraries/ResourceLib/Include _resourcelib/ | |
cp ../Libraries/ResourceLib/ResourceLib.cs _resourcelib/ | |
cp ResourceLib*.so _resourcelib/ | |
cp ../LICENSE _resourcelib/ | |
- name: Copy resource tool artifacts | |
run: | | |
cd _build | |
mkdir _resourcetool | |
cp ResourceTool _resourcetool/ | |
cp ResourceLib*.so _resourcetool/ | |
cp ../LICENSE _resourcetool/ | |
- name: Archive resource tool | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ResourceTool-linux-x64 | |
path: | | |
_build/_resourcetool/* | |
- name: Archive resource lib | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ResourceLib-linux-x64 | |
path: | | |
_build/_resourcelib/* | |
create_release: | |
name: Create release | |
needs: [build_windows, build_linux] | |
runs-on: ubuntu-latest | |
outputs: | |
upload_url: ${{ steps.create.outputs.upload_url }} | |
steps: | |
- name: Create release | |
id: create | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.ref }} | |
release_name: ${{ github.ref }} | |
draft: false | |
prerelease: startsWith(github.ref, 'refs/tags/v0.') | |
upload_release: | |
name: Upload release artifacts | |
needs: create_release | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
artifact: [ ResourceTool-win-x64, ResourceTool-linux-x64, CodeGen-win-x64, ResourceLib-win-x64, ResourceLib-linux-x64 ] | |
steps: | |
- name: Download artifact | |
uses: actions/download-artifact@v2 | |
with: | |
name: ${{ matrix.artifact }} | |
path: ${{ matrix.artifact }} | |
- name: Archive artifact files | |
run: | | |
cd ${{ matrix.artifact }} | |
zip -r ${{ matrix.artifact }}.zip * | |
- name: Upload release assets | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ needs.create_release.outputs.upload_url }} | |
asset_path: ${{ matrix.artifact }}/${{ matrix.artifact }}.zip | |
asset_name: ${{ matrix.artifact }}.zip | |
asset_content_type: application/zip |