Move CI to Github Actions (#318)

* Actualize cmake.yml.

* Added install_ci.sh in order to reuse it in workflows

* Edited cmake.yml

* +sudo

* Added coverity scan
This commit is contained in:
Ilya Tzoop 2021-05-20 10:41:55 +05:00 committed by GitHub
parent 27187eac1d
commit b931fcee7a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 86 additions and 28 deletions

View File

@ -2,38 +2,41 @@ name: CMake
on: [push]
env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release
jobs:
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
build_and_release:
strategy:
fail-fast: false
matrix:
# os: [ubuntu-latest, ubuntu-18.04]
os : [ubuntu-18.04]
compiler: [gcc, clang]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- 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 ${{runner.workspace}}/build
- name: Configure dependencies
- run: sudo apt-get -yq install libpq-dev postgresql-server-dev-13
- name: Install dependencies
run: sudo bash scripts/install_ci.sh
- name: Build
working-directory: ${{runner.workspace}}/build
shell: bash
# Execute the build. You can specify a specific target with "--target <NAME>"
run: make local_build BUILD_TEST_DIR=$GITHUB_WORKSPACE
- name: Format
continue-on-error: true
run: ./run-clang-format/run-clang-format.py -r --clang-format-executable clang-format-9 modules sources stress test third_party
- name: Test
working-directory: ${{runner.workspace}}/build
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
env:
CC: ${{ matrix.compiler }}
CC_FOR_BUILD: ${{ matrix.compiler }}
run: make run_test
- name: Prepare for release
run: tar -zcf odyssey.linux-amd64.$(git rev-parse --short HEAD).tar.gz sources
- name: Release
uses: fnkr/github-action-ghr@v1
if: startsWith(github.ref, 'refs/tags/') && matrix.os == 'ubuntu-18.04' && matrix.compiler == 'gcc' # We need to release only once
env:
GHR_PATH: odyssey.linux-amd64.$(git rev-parse --short HEAD).tar.gz
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

47
.github/workflows/coverity.yml vendored Normal file
View File

@ -0,0 +1,47 @@
name: coverity
on:
push:
branches: [ coverity_scan ]
jobs:
scan:
runs-on: ubuntu-18.04
env:
TOKEN: ${{ secrets.COVERITY_SCAN_TOKEN }}
steps:
- uses: actions/checkout@v2
- name: Cache Coverity build tool
uses: actions/cache@v2
with:
path: |
coverity_tool.tar.gz
key: ${{ runner.os }}
- name: Download Coverity build tool
run: |
wget -c -N https://scan.coverity.com/download/linux64 --post-data "token=$TOKEN&project=yandex%2Fodyssey" -O coverity_tool.tar.gz
mkdir coverity_tool
tar xzf coverity_tool.tar.gz --strip 1 -C coverity_tool
- name: Install dependencies
run: sudo bash scripts/install_ci.sh
- name: Pre-build
run: cmake -DCMAKE_BUILD_TYPE=Release
- name: Build with Coverity build tool
run: |
export PATH=`pwd`/coverity_tool/bin:$PATH
cov-build --dir cov-int make -j2
- name: Submit build result to Coverity Scan
run: |
tar czvf odyssey.tar.gz cov-int
curl --form token=$TOKEN \
--form email=amborodin@acm.org \
--form file=@odyssey.tar.gz \
--form version="Commit $GITHUB_SHA" \
--form description="Build submitted via CI" \
https://scan.coverity.com/builds?project=yandex%2Fodyssey

8
scripts/install_ci.sh Normal file
View File

@ -0,0 +1,8 @@
#!/usr/bin/env bash
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo apt-get update
sudo apt-get -y --no-install-recommends install postgresql-13 postgresql-server-dev-13 clang-format-9 libpam0g-dev libldap-dev
sudo pkill -9 postgres || true
echo -n | openssl s_client -connect https://scan.coverity.com:443 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' | sudo tee -a /etc/ssl/certs/ca-