diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml deleted file mode 100644 index 7f82fed..0000000 --- a/.github/workflows/macos.yml +++ /dev/null @@ -1,38 +0,0 @@ -name: MacOS - -on: - push: - branches: - - master - - main - pull_request: - branches: - - master - - main - -env: - CTEST_OUTPUT_ON_FAILURE: 1 - CPM_SOURCE_CACHE: ${{ github.workspace }}/cpm_modules - -jobs: - build: - runs-on: macos-latest - - steps: - - uses: actions/checkout@v2 - - - uses: actions/cache@v2 - with: - path: "**/cpm_modules" - key: ${{ github.workflow }}-cpm-modules-${{ hashFiles('**/CMakeLists.txt', '**/*.cmake') }} - - - name: configure - run: cmake -Stest -Bbuild -DCMAKE_BUILD_TYPE=Debug - - - name: build - run: cmake --build build -j4 - - - name: test - run: | - cd build - ctest --build-config Debug diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..8332354 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,55 @@ +name: Release + +on: + push: + tags: + - '*' + branches: + - master + - main + pull_request: + branches: + - master + - main + +env: + CPM_SOURCE_CACHE: ${{ github.workspace }}/cpm_modules + +jobs: + build: + runs-on: ${{ matrix.os }} + + strategy: + matrix: + os: [ ubuntu-latest, windows-latest, macos-latest ] + + steps: + - uses: actions/checkout@v2 + + - uses: actions/cache@v2 + with: + path: "**/cpm_modules" + key: ${{ matrix.os }}-${{ github.workflow }}-cpm-modules-${{ hashFiles('**/CMakeLists.txt', '**/*.cmake') }} + + - name: configure + run: cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release + + - name: build + run: cmake --build build -j4 --config Release + + - name: Get current date + id: date + run: echo "::set-output name=date::$(date +'%Y-%m-%d')" + + - name: zip + uses: thedoctor0/zip-release@main + with: + type: zip + filename: ${{ matrix.os }}.zip + directory: build/out/ + + - uses: ncipollo/release-action@v1 + with: + allowUpdates: true + artifacts: build/out/${{ matrix.os }}.zip + tag: nightly-${{ steps.date.outputs.date }} diff --git a/.github/workflows/standalone.yml b/.github/workflows/standalone.yml index 5d64e87..8022612 100644 --- a/.github/workflows/standalone.yml +++ b/.github/workflows/standalone.yml @@ -15,7 +15,11 @@ env: jobs: build: - runs-on: ubuntu-latest + runs-on: ${{ matrix.os }} + + strategy: + matrix: + os: [ ubuntu-latest, windows-latest, macos-latest ] steps: - uses: actions/checkout@v2 @@ -23,7 +27,7 @@ jobs: - uses: actions/cache@v2 with: path: "**/cpm_modules" - key: ${{ github.workflow }}-cpm-modules-${{ hashFiles('**/CMakeLists.txt', '**/*.cmake') }} + key: ${{ matrix.os }}-${{ github.workflow }}-cpm-modules-${{ hashFiles('**/CMakeLists.txt', '**/*.cmake') }} - name: configure run: cmake -Sstandalone -Bbuild -DCMAKE_BUILD_TYPE=Debug @@ -31,5 +35,10 @@ jobs: - name: build run: cmake --build build -j4 - - name: run + - name: run on unix-like + if: startsWith(matrix.os, 'macOS') || startsWith(matrix.os,'ubuntu') run: ./build/Greeter + + - name: run on windows + if: startsWith(matrix.os, 'windows') + run: ./build/Debug/Greeter.exe diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/test.yml similarity index 69% rename from .github/workflows/ubuntu.yml rename to .github/workflows/test.yml index 16e82af..a327845 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/test.yml @@ -1,4 +1,4 @@ -name: Ubuntu +name: Test on: push: @@ -17,7 +17,11 @@ env: jobs: build: - runs-on: ubuntu-latest + runs-on: ${{ matrix.os }} + + strategy: + matrix: + os: [ ubuntu-latest, windows-latest, macos-latest ] steps: - uses: actions/checkout@v2 @@ -25,7 +29,7 @@ jobs: - uses: actions/cache@v2 with: path: "**/cpm_modules" - key: ${{ github.workflow }}-cpm-modules-${{ hashFiles('**/CMakeLists.txt', '**/*.cmake') }} + key: ${{ matrix.os }}-${{ github.workflow }}-cpm-modules-${{ hashFiles('**/CMakeLists.txt', '**/*.cmake') }} - name: configure run: cmake -Stest -Bbuild -DENABLE_TEST_COVERAGE=1 -DCMAKE_BUILD_TYPE=Debug @@ -38,5 +42,6 @@ jobs: cd build ctest --build-config Debug - - name: collect code coverage + - name: collect code coverage on ubuntu + if: startsWith(matrix.os,'ubuntu') run: bash <(curl -s https://codecov.io/bash) || echo "Codecov did not collect coverage reports" diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml deleted file mode 100644 index 2d8ec46..0000000 --- a/.github/workflows/windows.yml +++ /dev/null @@ -1,38 +0,0 @@ -name: Windows - -on: - push: - branches: - - master - - main - pull_request: - branches: - - master - - main - -env: - CTEST_OUTPUT_ON_FAILURE: 1 - CPM_SOURCE_CACHE: ${{ github.workspace }}/cpm_modules - -jobs: - build: - runs-on: windows-latest - - steps: - - uses: actions/checkout@v2 - - - uses: actions/cache@v2 - with: - path: "**/cpm_modules" - key: ${{ github.workflow }}-cpm-modules-${{ hashFiles('**/CMakeLists.txt', '**/*.cmake') }} - - - name: configure - run: cmake -Stest -Bbuild - - - name: build - run: cmake --build build --config Debug -j4 - - - name: test - run: | - cd build - ctest --build-config Debug diff --git a/.gitignore b/.gitignore index d54a4f4..3897705 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,14 @@ /build* /.vscode /cpm_modules -.DS_Store \ No newline at end of file + +# apple +.DS_Store + +# clion +.idea/ +cmake-*/ + +# visual studio +out/ +.vs/ \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index c206ed6..ec06553 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -18,6 +18,11 @@ if(PROJECT_SOURCE_DIR STREQUAL PROJECT_BINARY_DIR) ) endif() +# ---- Set output directories ---- +set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/out) +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/out) +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/out) + # ---- Add dependencies via CPM ---- # see https://github.com/TheLartians/CPM.cmake for more info