Update CMakeLists.txt #3
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 Project | ||
env: | ||
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} | ||
PROJECT: changeme | ||
AUTHOR: hugsy | ||
REPO: ${{ env.AUTHOR }}/${{ env.PROJECT }} | ||
Check failure on line 7 in .github/workflows/build.yml GitHub Actions / Build ProjectInvalid workflow file
|
||
VERBOSE: "1" | ||
CMAKE_FLAGS: "-DDEBUG=ON -DBUILD_TOOLKIT=ON" | ||
on: [push, pull_request] | ||
jobs: | ||
build: | ||
name: "${{ matrix.os }}/${{ matrix.platform }}/${{ matrix.configuration }}" | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: ['windows-latest', 'ubuntu-latest'] | ||
platform: ['x64'] | ||
configuration: ['RelWithDebInfo'] | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
submodules: true | ||
- name: Sets Windows specific environment variables | ||
shell: powershell | ||
run: | | ||
echo "NB_CPU=$env:NUMBER_OF_PROCESSORS" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | ||
if: matrix.os == 'windows-latest' | ||
- name: Sets Linux specific environment variables | ||
run: | | ||
echo "NB_CPU=$(grep -c ^processor /proc/cpuinfo)" >> $GITHUB_ENV | ||
if: matrix.os == 'ubuntu-latest' | ||
- name: Inject slug/short variables | ||
uses: rlespinasse/github-slug-action@v3.x | ||
- name: Initialize CodeQL | ||
uses: github/codeql-action/init@v1 | ||
with: | ||
languages: cpp | ||
if: matrix.os == 'ubuntu-latest' | ||
- name: Add msbuild to PATH | ||
uses: microsoft/setup-msbuild@v1.1 | ||
with: | ||
msbuild-architecture: ${{ matrix.platform }} | ||
if: matrix.os == 'windows-latest' | ||
- name: Prepare Windows environment | ||
if: matrix.os == 'windows-latest' | ||
shell: pwsh | ||
run: | | ||
$true | ||
- name: Prepare Linux environment | ||
if: matrix.os == 'ubuntu-latest' | ||
shell: bash | ||
run: | | ||
true | ||
- name: Build pwn++ library | ||
run: | | ||
mkdir ./build | ||
cd ./build | ||
cmake .. ${{ env.CMAKE_FLAGS }} | ||
cmake --build . --verbose --parallel ${{ env.NB_CPU }} --config ${{ matrix.configuration }} --target tests | ||
cd .. | ||
- name: Run tests | ||
run: | | ||
cd build/tests | ||
ctest --parallel=${{ env.NB_CPU }} --extra-verbose --cfg=${{ matrix.configuration }} | ||
cd ../.. | ||
- name: Perform CodeQL Analysis | ||
if: matrix.os == 'ubuntu-latest' | ||
uses: github/codeql-action/analyze@v1 | ||
- name: Prepare artifact | ||
run: | | ||
mkdir artifact | ||
cd build | ||
cmake --install . --config ${{ matrix.configuration }} --prefix ../artifact --verbose | ||
cd .. | ||
- name: Publish artifact | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: ${{ env.PROJECT }}_${{ env.GITHUB_REF_SLUG }}_${{ matrix.os }}_${{ matrix.platform }}_${{ env.GITHUB_SHA_SHORT }} | ||
path: artifact/ | ||
- name: Notify on success | ||
if: ${{ success() }} | ||
env: | ||
COMMIT_URL: "https://github.com/${{ env.REPO }}/commit/${{ env.GITHUB_SHA_SHORT }}" | ||
RUN_URL: "https://github.com/${{ env.REPO }}/actions/runs/${{ github.run_id }}" | ||
uses: sarisia/actions-status-discord@v1 | ||
with: | ||
nodetail: true | ||
title: SUCCESS building `${{ env.REPO }}` for `${{ matrix.os }}-${{ matrix.platform }}`/${{ matrix.configuration }} | ||
description: | | ||
[Job #${{ github.run_number }}] The CI build `${{ env.GITHUB_SHA_SHORT }}` initiated by ${{ env.GITHUB_ACTOR }} on ${{ env.GITHUB_REPOSITORY }} succeeded: | ||
● Commit ${{ env.COMMIT_URL }} | ||
● Branch `${{ env.GITHUB_REF_SLUG }}` | ||
● Platform ${{ matrix.os }}-${{ matrix.platform }} | ||
● Configuration ${{ matrix.configuration }} | ||
● Run details: ${{ env.RUN_URL }} | ||
color: 0x00ff00 | ||
username: ${{ github.actor }} via GithubBot | ||
avatar_url: ${{ github.actor.avatar_url }} | ||
- name: Notify on test failure | ||
if: ${{ failure() }} | ||
env: | ||
COMMIT_URL: "https://github.com/${{ env.REPO }}/commit/${{ env.GITHUB_SHA_SHORT }}" | ||
RUN_URL: "https://github.com/${{ env.REPO }}/actions/runs/${{ github.run_id }}" | ||
uses: sarisia/actions-status-discord@v1 | ||
with: | ||
nodetail: true | ||
title: FAILED building `${{ env.REPO }}` for `${{ matrix.os }}-${{ matrix.platform }}`/${{ matrix.configuration }} | ||
description: | | ||
[Job #${{ github.run_number }}] The CI build `${{ env.GITHUB_SHA_SHORT }}` initiated by ${{ env.GITHUB_ACTOR }} on ${{ env.GITHUB_REPOSITORY }} failed: | ||
● Commit ${{ env.COMMIT_URL }} | ||
● Branch `${{ env.GITHUB_REF_SLUG }}` | ||
● Platform ${{ matrix.os }}-${{ matrix.platform }} | ||
● Configuration ${{ matrix.configuration }} | ||
● Run details: ${{ env.RUN_URL }} | ||
color: 0xff0000 | ||
username: ${{ github.actor }} via GithubBot | ||
avatar_url: ${{ github.actor.avatar_url }} |