Skip to content

Commit

Permalink
Adds coverity
Browse files Browse the repository at this point in the history
  • Loading branch information
StrongestNumber9 committed Mar 18, 2024
1 parent 7f713a7 commit 13b1f04
Showing 1 changed file with 91 additions and 0 deletions.
91 changes: 91 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
name: CI

on:
push:
secrets:
COVERITY_TOKEN:
required: true
COVERITY_EMAIL:
required: true

jobs:
verify:
name: Verify Code
runs-on: ubuntu-latest

env:
COVERITY: coverity_tool

services:
mariadb:
image: mariadb:10.5
ports:
- 3306:3306
options: --health-cmd="mysqladmin ping" --health-interval=5s --health-timeout=2s --health-retries=3
env:
MYSQL_USER: testuser
MYSQL_PASSWORD: testpass
MYSQL_ROOT_PASSWORD: root

steps:
- uses: actions/checkout@v4
- name: Initialize MariaDB
env:
MARIADB_PORT: ${{ job.services.mariadb.ports[3306] }}
run: |
echo "Creating databases"
mysql -u root -h127.0.0.1 -p'root' -P${MARIADB_PORT} <<< "CREATE DATABASE cfe_18 CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;"
mysql -u root -h127.0.0.1 -p'root' -P${MARIADB_PORT} <<< "CREATE DATABASE cfe_03 CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;"
mysql -u root -h127.0.0.1 -p'root' -P${MARIADB_PORT} <<< "CREATE DATABASE cfe_01 CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;"
mysql -u root -h127.0.0.1 -p'root' -P${MARIADB_PORT} <<< "CREATE DATABASE cfe_07 CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;"
mysql -u root -h127.0.0.1 -p'root' -P${MARIADB_PORT} <<< "CREATE DATABASE cfe_00 CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;"
mysql -u root -h127.0.0.1 -p'root' -P${MARIADB_PORT} <<< "CREATE DATABASE flow CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;"
mysql -u root -h127.0.0.1 -p'root' -P${MARIADB_PORT} <<< "CREATE DATABASE location CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;"
mysql -u root -h127.0.0.1 -p'root' -P${MARIADB_PORT} <<< "grant all privileges on cfe_18.* to testuser@'%' identified by 'testpass';"
mysql -u root -h127.0.0.1 -p'root' -P${MARIADB_PORT} <<< "grant all privileges on cfe_03.* to testuser@'%' identified by 'testpass';"
mysql -u root -h127.0.0.1 -p'root' -P${MARIADB_PORT} <<< "grant all privileges on cfe_01.* to testuser@'%' identified by 'testpass';"
mysql -u root -h127.0.0.1 -p'root' -P${MARIADB_PORT} <<< "grant all privileges on cfe_07.* to testuser@'%' identified by 'testpass';"
mysql -u root -h127.0.0.1 -p'root' -P${MARIADB_PORT} <<< "grant all privileges on cfe_00.* to testuser@'%' identified by 'testpass';"
mysql -u root -h127.0.0.1 -p'root' -P${MARIADB_PORT} <<< "grant all privileges on flow.* to testuser@'%' identified by 'testpass';"
mysql -u root -h127.0.0.1 -p'root' -P${MARIADB_PORT} <<< "grant all privileges on location.* to testuser@'%' identified by 'testpass';"
echo "Flushing privileges"
mysql -u root -h127.0.0.1 -p'root' -P${MARIADB_PORT} <<< "flush privileges;"
- name: Set up JDK 8
uses: actions/setup-java@v3
with:
java-version: '8'
distribution: 'temurin'
server-id: github
settings-path: ${{ github.workspace }}

- name: Cache Local Maven Repository
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}

- name: Compile Test and Verify
run: mvn --batch-mode clean verify

- name: Cache Coverity
id: cache_coverity
uses: actions/cache@v2
with:
path: ${{ env.COVERITY }}
key: coverity

- name: Download Coverity
if: steps.cache_coverity.outputs.cache-hit != 'true'
run: |
wget --quiet https://scan.coverity.com/download/linux64 --post-data "token=${{ secrets.COVERITY_TOKEN }}&project=cfe_18" -O ${{ env.COVERITY }}.tgz
mkdir -p ${{ env.COVERITY }}
tar zxvf ${{ env.COVERITY }}.tgz -C ${{ env.COVERITY }} --strip-components 1
- name: Compile Coverity
run: |
${{ env.COVERITY }}/bin/cov-build --dir cov-int mvn -DskipTests=true --batch-mode clean compile
tar czvf cfe_18.tgz cov-int
- name: Upload to Coverity
run: curl --silent --form token=${{ secrets.COVERITY_TOKEN }} --form email=${{ secrets.COVERITY_EMAIL }} --form file=@cfe_18.tgz --form version="${GITHUB_REF##*/}" --form description="automated upload" https://scan.coverity.com/builds?project=cfe_18

0 comments on commit 13b1f04

Please sign in to comment.