2022-04-04 21:54:46 +00:00
|
|
|
name: Tests CI
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- "*"
|
|
|
|
pull_request:
|
|
|
|
branches:
|
|
|
|
- "*"
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
test:
|
2022-04-29 05:23:50 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
name: Tests
|
|
|
|
strategy:
|
|
|
|
matrix:
|
2024-02-29 02:09:33 +00:00
|
|
|
python-version: ["3.11.8"]
|
2022-04-04 21:54:46 +00:00
|
|
|
|
|
|
|
steps:
|
2023-12-01 20:07:04 +00:00
|
|
|
- uses: actions/checkout@v4
|
2022-04-04 21:54:46 +00:00
|
|
|
|
2022-04-29 05:23:50 +00:00
|
|
|
- uses: harmon758/postgresql-action@v1
|
|
|
|
with:
|
2023-07-09 07:03:48 +00:00
|
|
|
postgresql version: "15"
|
2022-07-31 21:31:58 +00:00
|
|
|
postgresql db: "pipeline"
|
|
|
|
postgresql user: "pipeline"
|
|
|
|
postgresql password: "pipeline123456"
|
|
|
|
|
2022-04-29 05:23:50 +00:00
|
|
|
- name: Setup Python ${{ matrix.python-version }}
|
2022-10-18 05:02:35 +00:00
|
|
|
uses: actions/setup-python@v4
|
2022-04-29 05:23:50 +00:00
|
|
|
with:
|
|
|
|
python-version: ${{ matrix.python-version }}
|
2022-10-18 05:02:35 +00:00
|
|
|
check-latest: true
|
2022-04-29 05:23:50 +00:00
|
|
|
|
|
|
|
- name: Install redis
|
|
|
|
run: |
|
|
|
|
sudo apt update
|
|
|
|
sudo apt install -y redis
|
|
|
|
redis-server --version
|
|
|
|
|
|
|
|
- name: Install requirements
|
|
|
|
working-directory: api/tacticalrmm
|
2022-04-04 21:54:46 +00:00
|
|
|
run: |
|
|
|
|
python --version
|
|
|
|
SETTINGS_FILE="tacticalrmm/settings.py"
|
|
|
|
SETUPTOOLS_VER=$(grep "^SETUPTOOLS_VER" "$SETTINGS_FILE" | awk -F'[= "]' '{print $5}')
|
|
|
|
WHEEL_VER=$(grep "^WHEEL_VER" "$SETTINGS_FILE" | awk -F'[= "]' '{print $5}')
|
|
|
|
pip install --upgrade pip
|
|
|
|
pip install setuptools==${SETUPTOOLS_VER} wheel==${WHEEL_VER}
|
|
|
|
pip install -r requirements.txt -r requirements-test.txt
|
|
|
|
|
2022-06-22 22:10:03 +00:00
|
|
|
- name: Codestyle black
|
2022-07-31 21:31:58 +00:00
|
|
|
working-directory: api
|
2022-04-04 21:54:46 +00:00
|
|
|
run: |
|
2022-06-22 22:10:03 +00:00
|
|
|
black --exclude migrations/ --check tacticalrmm
|
2022-04-04 21:54:46 +00:00
|
|
|
if [ $? -ne 0 ]; then
|
|
|
|
exit 1
|
|
|
|
fi
|
2022-12-21 03:53:44 +00:00
|
|
|
|
2022-11-13 07:44:23 +00:00
|
|
|
- name: Lint with flake8
|
|
|
|
working-directory: api/tacticalrmm
|
|
|
|
run: |
|
|
|
|
flake8 --config .flake8 .
|
|
|
|
if [ $? -ne 0 ]; then
|
|
|
|
exit 1
|
|
|
|
fi
|
2022-07-31 21:31:58 +00:00
|
|
|
|
2022-06-22 22:10:03 +00:00
|
|
|
- name: Run django tests
|
|
|
|
env:
|
|
|
|
GHACTIONS: "yes"
|
2022-04-29 05:23:50 +00:00
|
|
|
working-directory: api/tacticalrmm
|
2022-04-04 21:54:46 +00:00
|
|
|
run: |
|
2022-06-22 22:10:03 +00:00
|
|
|
pytest
|
2022-04-04 21:54:46 +00:00
|
|
|
if [ $? -ne 0 ]; then
|
|
|
|
exit 1
|
|
|
|
fi
|
2022-04-09 00:26:22 +00:00
|
|
|
|
2022-06-22 22:10:03 +00:00
|
|
|
- uses: codecov/codecov-action@v3
|
2022-04-23 03:44:45 +00:00
|
|
|
with:
|
|
|
|
directory: ./api/tacticalrmm
|
2022-06-22 22:41:47 +00:00
|
|
|
files: ./api/tacticalrmm/coverage.xml
|
2022-04-23 03:44:45 +00:00
|
|
|
verbose: true
|