ci: Add Coverity Scan workflow, cleanup CMake workflow

This commit is contained in:
Vsevolod Kremianskii 2021-02-26 20:29:16 +07:00
parent dcf588e720
commit a440cbea53
2 changed files with 57 additions and 18 deletions

View file

@ -1,49 +1,37 @@
name: CMake name: CMake
on: [push] on:
push:
branches:
- master
env: env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release BUILD_TYPE: Release
jobs: jobs:
build: build:
# The CMake configure and build commands are platform agnostic and should work equally
# well on Windows or Mac. You can convert this to a matrix build if you need
# cross-platform coverage.
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: Install Dependencies - name: Install dependencies
run: sudo apt install libboost-all-dev libsdl2-dev libglew-dev libopenal-dev libmad0-dev libavcodec-dev libavformat-dev libavutil-dev libswresample-dev libswscale-dev run: sudo apt install libboost-all-dev libsdl2-dev libglew-dev libopenal-dev libmad0-dev libavcodec-dev libavformat-dev libavutil-dev libswresample-dev libswscale-dev
- name: Create Build Environment - name: Create Build Environment
# Some projects don't allow in-source building, so create a separate build directory
# We'll use this as our working directory for all subsequent commands
run: cmake -E make_directory ${{github.workspace}}/build run: cmake -E make_directory ${{github.workspace}}/build
- name: Configure CMake - name: Configure CMake
# Use a bash shell so we can use the same syntax for environment variable
# access regardless of the host operating system
shell: bash
working-directory: ${{github.workspace}}/build working-directory: ${{github.workspace}}/build
# Note the current convention is to use the -S and -B options here to specify source shell: bash
# and build directories, but this is only available with CMake 3.13 and higher.
# The CMake binaries on the Github Actions machines are (as of this writing) 3.12
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DBUILD_TESTS=ON run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DBUILD_TESTS=ON
- name: Build - name: Build
working-directory: ${{github.workspace}}/build working-directory: ${{github.workspace}}/build
shell: bash shell: bash
# Execute the build. You can specify a specific target with "--target <NAME>"
run: cmake --build . --config $BUILD_TYPE run: cmake --build . --config $BUILD_TYPE
- name: Test - name: Test
working-directory: ${{github.workspace}}/build working-directory: ${{github.workspace}}/build
shell: bash shell: bash
# Execute tests defined by the CMake configuration.
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: ctest -C $BUILD_TYPE run: ctest -C $BUILD_TYPE

51
.github/workflows/coverity-scan.yml vendored Normal file
View file

@ -0,0 +1,51 @@
name: Coverity Scan
on:
push:
branches:
- coverity_scan
env:
BUILD_TYPE: Release
TOKEN: ${{ secrets.COVERITY_SCAN_TOKEN }}
jobs:
latest:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install dependencies
run: sudo apt install libboost-all-dev libsdl2-dev libglew-dev libopenal-dev libmad0-dev libavcodec-dev libavformat-dev libavutil-dev libswresample-dev libswscale-dev
- name: Create Build Environment
run: cmake -E make_directory ${{github.workspace}}/build
- name: Download Coverity Build Tool
working-directory: ${{github.workspace}}/build
run: |
wget -q https://scan.coverity.com/download/cxx/linux64 --post-data "token=$TOKEN&project=seedhartha%2Freone" -O cov-analysis-linux64.tar.gz
mkdir cov-analysis-linux64
tar xzf cov-analysis-linux64.tar.gz --strip 1 -C cov-analysis-linux64
- name: Configure CMake
working-directory: ${{github.workspace}}/build
shell: bash
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE
- name: Build with cov-build
working-directory: ${{github.workspace}}/build
run: |
export PATH=`pwd`/cov-analysis-linux64/bin:$PATH
cov-build --dir cov-int cmake --build . --config $BUILD_TYPE
- name: Submit the result to Coverity Scan
run: |
tar czvf reone.tgz cov-int
curl \
--form token=$TOKEN \
--form email=vkremianskii@gmail.com \
--form file=@reone.tgz \
--form version="coverity_scan" \
--form description="Game engine, capable of running KotOR and TSL" \
https://scan.coverity.com/builds?project=seedhartha%2Freone