Skip to content

Commit

Permalink
[test] Introduce Github action for CodeChecker tests
Browse files Browse the repository at this point in the history
  • Loading branch information
csordasmarton committed Nov 30, 2020
1 parent 111a982 commit d2f6c60
Show file tree
Hide file tree
Showing 4 changed files with 172 additions and 0 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/install-deps.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash

wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add -
sudo add-apt-repository 'deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-11 main' -y

sudo apt-get update -q

sudo apt-get install \
g++-6 \
gcc-multilib \
libc6-dev-i386 \
libpq-dev \
libldap2-dev \
libsasl2-dev \
libssl-dev \
clang-11 \
clang-tidy-11

sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-11 9999
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-11 9999
sudo update-alternatives --install /usr/bin/clang-tidy clang-tidy /usr/bin/clang-tidy-11 9999
145 changes: 145 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
name: codechecker-tests

# Triggers the workflow on push or pull request events.
on: [push, pull_request]

jobs:
lint:
name: Linters (pylint, pycodestyle)

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: '3.6'
- name: Install dependencies
run: |
pip install $(grep -iE "pylint|pycodestyle" analyzer/requirements_py/dev/requirements.txt)
- name: Run tests
run: make pylint pycodestyle

analyzer:
name: Analyzer
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: '3.6'

- name: Install dependencies
run: sh .github/workflows/install-deps.sh

- name: Build the package
run: |
make pip_dev_deps
BUILD_UI_DIST=NO make package
- name: Run analyzer tests
run: |
make -C analyzer \
test_unit \
test_functional \
test_tu_collector \
test_merge_clang_extdef_mappings \
test_statistics_collector \
test_build_logger
web:
name: Web
runs-on: ubuntu-latest

services:
postgres:
image: postgres
env:
POSTGRES_PASSWORD: postgres
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
strategy:
matrix:
database: [sqlite, psql_pg8000, psql_psycopg2]

steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: '3.6'

- name: Install dependencies
run: sh .github/workflows/install-deps.sh

- name: Init .pgpass
run: |
echo '*:*:*:*:postgres' > $HOME/.pgpass
chmod 0600 $HOME/.pgpass
- name: Run tests
env:
PGPASSWORD: postgres
run: |
export PGPASSFILE=$HOME/.pgpass
make pip_dev_deps
BUILD_UI_DIST=NO make package
make -C tools/plist_to_html test
make -C tools/report-converter package test
make -C tools/codechecker_report_hash test
make -C web test_matrix_${{ matrix.database }}
gui:
name: GUI
runs-on: ubuntu-latest

strategy:
matrix:
# FIXME: in Chrome the UI test cases run non-deterministically and
# sometimes fail. For this reason we will not run GUI test cases
# in Chrome.
browser: [firefox]

steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: '3.6'
- uses: actions/setup-node@v1
with:
node-version: '12.x'

# - name: Update chrome
# run: |
# sudo apt-get update -q
# sudo apt-get install google-chrome-stable

- name: Install dependencies
run: sh .github/workflows/install-deps.sh

- name: Build the package
run: |
make pip_dev_deps
make package
- name: Run tests
working-directory: web/server/vue-cli
env:
# CHROME_HEADLESS: 1
MOZ_HEADLESS: 1
DISPLAY: ":99.0"
run: |
export PATH="${{ github.workspace }}/build/CodeChecker/bin:$PATH"
npm run test:lint
npm run test:unit
npm run test:e2e.${{ matrix.browser }}
2 changes: 2 additions & 0 deletions web/server/vue-cli/nightwatch.conf.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const host = process.env.HOST || "localhost";
const port = process.env.PORT || 8001;
const chromeHeadless = process.env.CHROME_HEADLESS;

module.exports = {
src_folders: [ "e2e/specs" ],
Expand Down Expand Up @@ -38,6 +39,7 @@ module.exports = {
desiredCapabilities: {
browserName: "chrome",
chromeOptions : {
args: [ ...[ chromeHeadless ? "--headless" : undefined ] ],
w3c: false
}
}
Expand Down
4 changes: 4 additions & 0 deletions web/tests/libtest/codechecker.py
Original file line number Diff line number Diff line change
Expand Up @@ -690,6 +690,10 @@ def add_test_package_product(server_data, test_folder, check_env=None,

add_command.append('--postgresql')
pg_config['dbname'] = server_data['viewer_product']

if os.environ.get('PGPASSWORD'):
pg_config['dbpassword'] = os.environ['PGPASSWORD']

add_command += _pg_db_config_to_cmdline_params(pg_config)
else:
# SQLite databases are put under the workspace of the appropriate test.
Expand Down

0 comments on commit d2f6c60

Please sign in to comment.