tacticalrmm/.github/workflows/ci-tests.yml

83 lines
2.1 KiB
YAML
Raw Normal View History

2022-04-04 21:54:46 +00:00
name: Tests CI
on:
push:
branches:
- "*"
pull_request:
branches:
- "*"
jobs:
test:
runs-on: ubuntu-latest
name: Tests
strategy:
matrix:
2022-12-21 03:53:44 +00:00
python-version: ["3.10.8", "3.11.1"]
2022-04-04 21:54:46 +00:00
steps:
- uses: actions/checkout@v3
2022-04-04 21:54:46 +00:00
- uses: harmon758/postgresql-action@v1
with:
2022-07-31 21:31:58 +00:00
postgresql version: "14"
postgresql db: "pipeline"
postgresql user: "pipeline"
postgresql password: "pipeline123456"
- name: Setup Python ${{ matrix.python-version }}
2022-10-18 05:02:35 +00:00
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
2022-10-18 05:02:35 +00:00
check-latest: true
- 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"
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