Skip to content

Commit

Permalink
Add github workflow that provides build when release
Browse files Browse the repository at this point in the history
  • Loading branch information
Notiooo committed Feb 19, 2024
1 parent 7d8025a commit 7995a03
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 4 deletions.
60 changes: 60 additions & 0 deletions .github/workflows/build_on_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: C++ Build and Package

on:
release:
types: [published]
workflow_dispatch:

jobs:
build:
runs-on: windows-latest
env:
TAG_NAME: ${{ github.ref_name }}

steps:
- uses: actions/checkout@v3

- name: Build (Release)
run: |
cmake -S ${{github.workspace}}/MakeFarm -B ${{github.workspace}}/build-release -DCMAKE_BUILD_TYPE=Release
cmake --build ${{github.workspace}}/build-release --config Release --target MakeFarmApp
- name: Package (Release)
run: |
Compress-Archive -Path "${{github.workspace}}/build-release/src/Release/*" -DestinationPath "${{github.workspace}}/build-release/src/makefarm_release_windows_build_${{ env.TAG_NAME }}.zip"
- name: Build (Debug)
run: |
cmake -S ${{github.workspace}}/MakeFarm -B ${{github.workspace}}/build-debug -DCMAKE_BUILD_TYPE=Debug
cmake --build ${{github.workspace}}/build-debug --config Debug --target MakeFarmApp
- name: Package (Debug)
run: |
$sourcePath = "${{github.workspace}}/build-debug/src/Debug"
$excludeExtensions = @('.pdb', '.ilk', '.cmake')
$excludeFiles = @('MakeFarmSrc.lib')
$excludeFolders = @('custom_includes', 'CMakeFiles')
Get-ChildItem -Path $sourcePath -Recurse | Where-Object { $excludeExtensions -contains $_.Extension } | Remove-Item -Force
foreach ($file in $excludeFiles)
{
Get-ChildItem -Path $sourcePath -Recurse | Where-Object { $_.Name -eq $file } | Remove-Item -Force
}
foreach ($folder in $excludeFolders)
{
$pathToRemove = Join-Path -Path $sourcePath -ChildPath $folder
if (Test-Path $pathToRemove)
{
Remove-Item -Path $pathToRemove -Recurse -Force
}
}
Compress-Archive -Path "${{github.workspace}}/build-debug/src/Debug/*" -DestinationPath "${{github.workspace}}/build-debug/src/makefarm_debug_windows_build_${{ env.TAG_NAME }}.zip"
- name: List files before upload release assets
run: Get-ChildItem

- name: Upload Release Assets
uses: AButler/[email protected]
with:
files: "./build-release/src/makefarm_release_windows_build_*.zip;./build-debug/src/makefarm_debug_windows_build_*.zip"
repo-token: ${{ secrets.GITHUB_TOKEN }}
4 changes: 0 additions & 4 deletions MakeFarm/src/Renderer3D/Renderer3D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,9 @@ void Renderer3D::draw(const VertexArray& va, const IndexBuffer& ib, const sf::Sh
ib.bind();
GLCall(glDrawElements(toOpenGL(drawMode), ib.size(), GL_UNSIGNED_INT, nullptr));

#ifdef _DEBUG
sf::Shader::bind(nullptr);
va.unbind();
ib.unbind();
#endif
}

void Renderer3D::draw(const VertexArray& va, const sf::Shader& shader, int number,
Expand All @@ -54,10 +52,8 @@ void Renderer3D::draw(const VertexArray& va, const sf::Shader& shader, int numbe
va.bind();
GLCall(glDrawArrays(toOpenGL(drawMode), 0, number));

#ifdef _DEBUG
sf::Shader::bind(nullptr);
va.unbind();
#endif
}

unsigned Renderer3D::toOpenGL(const Renderer3D::DrawMode& drawMode) const
Expand Down
2 changes: 2 additions & 0 deletions MakeFarm/src/Utils/Mouse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ void Mouse::handleFirstPersonBehaviour(const sf::Event& event, sf::RenderWindow&
{
Mouse::lockMouseAtCenter(gameWindow);
}
#else
Mouse::lockMouseAtCenter(gameWindow);
#endif
}
}
Expand Down

0 comments on commit 7995a03

Please sign in to comment.