Skip to content

Commit

Permalink
Create CI
Browse files Browse the repository at this point in the history
  • Loading branch information
balintkissdev committed Apr 5, 2021
1 parent 0811e19 commit 8b6b83d
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 2 deletions.
58 changes: 58 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Raycaster CI

on: [push, pull_request]

jobs:
executable-build:
runs-on: ${{ matrix.config.os }}
strategy:
matrix:
config:
- { name: "Ubuntu Latest GCC", os: ubuntu-latest, cxx: g++, cc: gcc }
- {
name: "Windows Latest MSVC",
os: windows-latest,
cxx: cl.exe,
cc: cl.exe,
}

steps:
- uses: ilammy/msvc-dev-cmd@v1

- name: Set compiler environment
uses: lukka/set-shell-env@v1
with:
CXX: ${{ matrix.config.cxx }}
CC: ${{ matrix.config.cc }}

- name: Set compiler environment for Windows
if: matrix.config.os == 'windows-latest'
uses: lukka/set-shell-env@v1
with:
VS160COMNTOOLS: C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\Tools

- name: Checkout
uses: actions/[email protected]

- uses: lukka/get-cmake@latest

- name: Build project
uses: lukka/run-cmake@v3
with:
cmakeAppendedArgs: "-DCMAKE_BUILD_TYPE=Release"
buildDirectory: "${{ github.workspace }}/build/"

- name: Generate package
run: |
cd build
cpack -C "Release"
- name: Publish release
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v1
with:
files: |
build/*.tar.gz
build/*.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7 changes: 5 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ endif()

if(WIN32)
if (MINGW)
target_link_options(${PROJECT_NAME} -static-libgcc -static-libstdc++)
target_link_options(${PROJECT_NAME} PRIVATE -static-libgcc -static-libstdc++)
endif()
endif()

Expand Down Expand Up @@ -81,12 +81,15 @@ else()
endif()

set(CPACK_PACKAGE_NAME "Raycaster")
set(CPACK_PACKAGE_DESCRIPTION "C++ raycasting pseudo-3D engine")
set(CPACK_PACKAGE_VERSION_MAJOR ${PROJECT_VERSION_MAJOR})
set(CPACK_PACKAGE_VERSION_MINOR ${PROJECT_VERSION_MINOR})
set(CPACK_PACKAGE_VERSION_PATCH ${PROJECT_VERSION_PATCH})
set(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/LICENSE")
set(CPACK_RESOURCE_FILE_README "${PROJECT_SOURCE_DIR}/README.md")

install(FILES "${CPACK_RESOURCE_FILE_LICENSE}" "${CPACK_RESOURCE_FILE_README}" DESTINATION ".")
install(TARGETS ${PROJECT_NAME} RUNTIME CONFIGURATIONS Release DESTINATION ".")
install(FILES "${PROJECT_SOURCE_DIR}/README.md" DESTINATION ".")
install(DIRECTORY "${PROJECT_SOURCE_DIR}/resources/" DESTINATION "resources")
if(WIN32)
set(CPACK_GENERATOR ZIP)
Expand Down

0 comments on commit 8b6b83d

Please sign in to comment.