Skip to content

Commit e8c4c8c

Browse files
author
Andrei Neagu
committed
unit tests
1 parent d7e6fd3 commit e8c4c8c

File tree

2 files changed

+89
-0
lines changed

2 files changed

+89
-0
lines changed

.github/workflows/ci-testing-deploy.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -602,6 +602,51 @@ jobs:
602602
with:
603603
flags: unittests #optional
604604

605+
unit-test-notifications:
606+
needs: changes
607+
if: ${{ needs.changes.outputs.notifications == 'true' || github.event_name == 'push' }}
608+
timeout-minutes: 18 # if this timeout gets too small, then split the tests
609+
name: "[unit] notifications"
610+
runs-on: ${{ matrix.os }}
611+
strategy:
612+
matrix:
613+
python: ["3.11"]
614+
os: [ubuntu-24.04]
615+
fail-fast: false
616+
steps:
617+
- uses: actions/checkout@v4
618+
- name: setup docker buildx
619+
id: buildx
620+
uses: docker/setup-buildx-action@v3
621+
with:
622+
driver: docker-container
623+
- name: setup python environment
624+
uses: actions/setup-python@v5
625+
with:
626+
python-version: ${{ matrix.python }}
627+
- name: install rclone
628+
run: sudo ./ci/github/helpers/install_rclone.bash
629+
- name: install uv
630+
uses: astral-sh/setup-uv@v5
631+
with:
632+
version: "0.5.x"
633+
enable-cache: false
634+
cache-dependency-glob: "**/notifications/requirements/ci.txt"
635+
- name: show system version
636+
run: ./ci/helpers/show_system_versions.bash
637+
- name: install
638+
run: ./ci/github/unit-testing/notifications.bash install
639+
- name: typecheck
640+
run: ./ci/github/unit-testing/notifications.bash typecheck
641+
- name: test
642+
if: ${{ !cancelled() }}
643+
run: ./ci/github/unit-testing/notifications.bash test
644+
- uses: codecov/codecov-action@v5
645+
if: ${{ !cancelled() }}
646+
env:
647+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
648+
with:
649+
flags: unittests #optional
605650

606651
unit-test-api:
607652
needs: changes
@@ -1839,6 +1884,7 @@ jobs:
18391884
unit-test-common-library,
18401885
unit-test-notifications-library,
18411886
unit-test-payments,
1887+
unit-test-notifications,
18421888
unit-test-dynamic-scheduler,
18431889
unit-test-postgres-database,
18441890
unit-test-python-linting,
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#!/bin/bash
2+
# http://redsymbol.net/articles/unofficial-bash-strict-mode/
3+
set -o errexit # abort on nonzero exitstatus
4+
set -o nounset # abort on unbound variable
5+
set -o pipefail # don't hide errors within pipes
6+
IFS=$'\n\t'
7+
8+
install() {
9+
make devenv
10+
# shellcheck source=/dev/null
11+
source .venv/bin/activate
12+
pushd services/notifications
13+
make install-ci
14+
popd
15+
uv pip list
16+
}
17+
18+
test() {
19+
# shellcheck source=/dev/null
20+
source .venv/bin/activate
21+
pushd services/notifications
22+
make test-ci-unit
23+
popd
24+
}
25+
26+
typecheck() {
27+
# shellcheck source=/dev/null
28+
source .venv/bin/activate
29+
uv pip install mypy
30+
pushd services/notifications
31+
make mypy
32+
popd
33+
}
34+
35+
# Check if the function exists (bash specific)
36+
if declare -f "$1" >/dev/null; then
37+
# call arguments verbatim
38+
"$@"
39+
else
40+
# Show a helpful error
41+
echo "'$1' is not a known function name" >&2
42+
exit 1
43+
fi

0 commit comments

Comments
 (0)