Skip to content

Commit ca4481b

Browse files
committed
Includes postgres-database unit-testing in CI
1 parent 8e80c48 commit ca4481b

File tree

3 files changed

+86
-1
lines changed

3 files changed

+86
-1
lines changed

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

+48
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,7 @@ jobs:
249249
with:
250250
name: unit_sidecar_coverage
251251
path: codeclimate.unit_sidecar_coverage.json
252+
252253
unit-test-frontend:
253254
name: Unit-testing frontend
254255
runs-on: ${{ matrix.os }}
@@ -320,6 +321,53 @@ jobs:
320321
- name: test
321322
run: ./ci/github/unit-testing/python-linting.bash test
322323

324+
unit-test-postgres-database:
325+
name: Unit-testing postgres-database
326+
runs-on: ${{ matrix.os }}
327+
strategy:
328+
matrix:
329+
python: [3.6]
330+
os: [ubuntu-20.04]
331+
fail-fast: false
332+
steps:
333+
- uses: actions/checkout@v2
334+
- name: setup docker
335+
run: |
336+
sudo ./ci/github/helpers/setup_docker_compose.bash
337+
./ci/github/helpers/setup_docker_experimental.bash
338+
./ci/github/helpers/setup_docker_buildx.bash
339+
echo ::set-env name=DOCKER_BUILDX::1
340+
- name: setup python environment
341+
uses: actions/[email protected]
342+
with:
343+
python-version: ${{ matrix.python }}
344+
- name: show system version
345+
run: ./ci/helpers/show_system_versions.bash
346+
- uses: actions/cache@v1
347+
name: getting cached data
348+
with:
349+
path: ~/.cache/pip
350+
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
351+
restore-keys: |
352+
${{ runner.os }}-pip-
353+
- name: install
354+
run: ./ci/github/unit-testing/postgres-database.bash install
355+
- name: test
356+
run: ./ci/github/unit-testing/postgres-database.bash test
357+
- uses: codecov/codecov-action@v1
358+
with:
359+
flags: unittests #optional
360+
- name: prepare codeclimate coverage file
361+
run: |
362+
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
363+
chmod +x ./cc-test-reporter
364+
./cc-test-reporter format-coverage -t coverage.py -o codeclimate.unit_postgresdb_coverage.json coverage.xml
365+
- name: upload codeclimate coverage
366+
uses: actions/upload-artifact@v2
367+
with:
368+
name: unit_postgresdb_coverage
369+
path: codeclimate.unit_postgresdb_coverage.json
370+
323371
unit-test-service-library:
324372
name: Unit-testing service-library
325373
runs-on: ${{ matrix.os }}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/bin/bash
2+
# http://redsymbol.net/articles/unofficial-bash-strict-mode/
3+
set -euo pipefail
4+
IFS=$'\n\t'
5+
6+
install() {
7+
bash ci/helpers/ensure_python_pip.bash
8+
pushd packages/postgres-database; pip3 install -r requirements/ci.txt; popd;
9+
pip list -v
10+
}
11+
12+
test() {
13+
pytest \
14+
--color=yes \
15+
--durations=10 \
16+
--cov=servicelib \
17+
--cov-append \
18+
--cov-report=term-missing \
19+
--cov-report=xml \
20+
--cov-config=.coveragerc \
21+
--verbose \
22+
packages/postgres-database/tests
23+
}
24+
25+
# Check if the function exists (bash specific)
26+
if declare -f "$1" > /dev/null
27+
then
28+
# call arguments verbatim
29+
"$@"
30+
else
31+
# Show a helpful error
32+
echo "'$1' is not a known function name" >&2
33+
exit 1
34+
fi

packages/postgres-database/requirements/ci.txt

+4-1
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,8 @@
99
# installs base + tests requirements
1010
-r _test.txt
1111

12+
# installs this repo's packages
13+
-e ../../packages/pytest-simcore/
14+
1215
# current module
13-
.
16+
.[migration]

0 commit comments

Comments
 (0)