forked from Checkmk/checkmk
-
Notifications
You must be signed in to change notification settings - Fork 0
75 lines (73 loc) · 2.75 KB
/
pr.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# This is a simple entry point to execute the basic and most important Python
# tests for Checkmk. We run tools like pylint, yapf and our pytest based unit
# tests here. Some tests, like integration tests or tests of very specific
# components are not executed.
#
# We focus on the tests that are needed by external developers, e.g. to support
# check plugin development.
---
name: PR-CI
on: [push, pull_request]
jobs:
testing:
runs-on: ubuntu-20.04
env:
PIPENV_IGNORE_VIRTUALENVS: 1
USE_EXTERNAL_PIPENV_MIRROR: true
PYTHONWARNINGS: ignore:DeprecationWarning
strategy:
matrix:
include:
- name: Bandit tests
target: test-bandit
- name: Python formatting
target: test-format-python
- name: Pylint tests
target: test-pylint
- name: Python unit tests
target: test-unit
- name: mypy tests
target: test-mypy-raw
steps:
- name: Set Environment Variables
run: |
# Using existing environment variables within another variables is not working in the jobs.*.env section
# more infos see: https://brandur.org/fragments/github-actions-env-vars-in-env-vars
echo "PIP_CACHE_DIR=$HOME/.cache/pip" >> $GITHUB_ENV
echo "PIPENV_CACHE_DIR=$HOME/.cache/pipenv" >> $GITHUB_ENV
- name: Checkout Repository
uses: actions/checkout@v2
- name: Parse Python version from defines.make
run: |
echo "PYTHON_VERSION=$(make --no-print-directory --file=defines.make print-PYTHON_VERSION)" >> $GITHUB_ENV
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Cache pip
uses: actions/cache@v2
with:
key: pip-${{ runner.os }}-${{ hashFiles('Pipfile.lock') }}
path: ${{ env.PIP_CACHE_DIR }}
- name: Cache pipenv
uses: actions/cache@v2
with:
key: pipenv-${{ runner.os }}-${{ hashFiles('Pipfile.lock') }}
path: ${{ env.PIPENV_CACHE_DIR }}
- name: Setup Environment
run: |
# ksh: Needed for some "unit test" (test_mk_errpt_aix).
# librrd-dev: Needed for building rrdtool python bindings.
# libldap2-dev: Needed for building python-ldap.
# libsasl2-dev: Needed for building python-ldap.
# libkrb5-dev: Needed for building pykerberos.
# gettext: Needed for some "unit tests" (test_i18n.py)
sudo apt-get update
sudo apt-get install ksh librrd-dev libldap2-dev libsasl2-dev libkrb5-dev gettext
buildscripts/infrastructure/build-nodes/scripts/install-pipenv.sh
make .venv
- name: Run ${{ matrix.name }}
env:
TEST_TARGETS: ${{ matrix.target }}
run: |
make -C tests $TEST_TARGETS