-
Notifications
You must be signed in to change notification settings - Fork 533
108 lines (106 loc) · 4.97 KB
/
pr.yaml
File metadata and controls
108 lines (106 loc) · 4.97 KB
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# This is a simple entry point to execute the basic and most important Python
# tests for Checkmk. We run tools like ruff, black 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: ${{ matrix.os }}
env:
PYTHONWARNINGS: ignore:DeprecationWarning
# Avoid falling back to our internal bazel remote cache on github actions
BAZEL_CACHE_URL: ""
# Needed by "make .venv" to compute PYTHON_REQUIREMENTS_TEST
EDITION: community
timeout-minutes: 90
strategy:
matrix:
os: [ubuntu-latest-m]
steps:
- name: Remove unnecessary build tools
run: |
echo "Remove unnecessary directories:"
# to avoid running out of disk space we remove
# tools we don't need for this project
declare -i used_disk_before=$(df --block-size=$((1024*1024)) --output="used" / | tail -n 1)
declare -a tool_dirs=(
"/opt/ghc" # Haskell
"/usr/lib/google-cloud-sdk" # Google SDK
"/usr/lib/jvm" # Java
"/usr/local/.ghcup" # Haskell
"/usr/local/lib/android" # Android SDK
"/usr/local/share/chromium" # Chrome Browser
"/usr/local/share/powershell" # PowerShell
"/usr/share/dotnet" # .NET
"/usr/share/swift" # Swift
)
for tool_dir in ${tool_dirs[@]}; do
if [ -d "${tool_dir}" ]; then
echo "- ${tool_dir}"
sudo rm -rf "${tool_dir}"
fi
done
declare -i used_disk_after=$(df --block-size=$((1024*1024)) --output="used" / | tail -n 1)
echo "Saved disk space: $(((used_disk_before-used_disk_after)/1024))G"
- name: "Print OS information"
run: |
echo ${{ matrix.os }}
cat /etc/os-release
- 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 "UV_CACHE_DIR=$HOME/.cache/uv" >> $GITHUB_ENV
- name: Checkout Repository
uses: actions/checkout@v3
- name: Cache uv
uses: actions/cache@v3
with:
key: uv-${{ matrix.os }}-${{ hashFiles('community-requirements.txt') }}
path: ${{ env.UV_CACHE_DIR }}
- name: Cache bazelisk
uses: actions/cache@v3
with:
key: ${{ hashFiles('.bazelversion', '.bazeliskrc') }}
path: |
~/.cache/bazelisk
- name: Cache bazel
uses: actions/cache@v3
with:
key: ${{ matrix.os }}-bazel-${{ hashFiles('.bazelversion', '.bazelrc', 'WORKSPACE', 'MODULE.bazel') }}
path: |
~/.cache/bazel
restore-keys: |
${{ matrix.os }}-bazel-
- 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.
# libglib2.0-dev: required by packages/glib and therfore transitive by python unit tests
# gettext: Needed for some "unit tests" (test_i18n.py)
sudo add-apt-repository -y ppa:ubuntu-toolchain-r/ppa
sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install ksh libpango1.0-dev librrd-dev libldap2-dev libsasl2-dev libkrb5-dev libglib2.0-dev gettext "^g\+\+-14$"
make .venv
# Keep next targets in sync with `test-github-actions.groovy`.
- name: Formatting
if: ${{ !cancelled() }}
run: bazel run //:format.check
- name: Lint repo
if: ${{ !cancelled() }}
run: bazel lint --fixes=false ...
- name: Check typing
if: ${{ !cancelled() }}
run: bazel build --config=mypy ...
- name: Run unit tests
if: ${{ !cancelled() }}
run: make -C tests test-unit