Skip to content

fix: github actions #54

fix: github actions

fix: github actions #54

Workflow file for this run

name: Run CI tests
on:
- push
- pull_request
jobs:
python_test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Set up Python 3.8
uses: actions/setup-python@v1
with:
python-version: 3.8
- name: apt-get update
run: sudo apt-get update
- name: Install system dependencies
run: sudo apt-get install gcc python3-dev libpq-dev apache2-dev
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -r requirements-test.txt
- name: Check typing
run: |
mypy --install-types --no-strict-optional --non-interactive zezere
- name: Code style checking
run: |
black --check --target-version py36 zezere tests *.py
- name: Check security
run: bandit -r ./ -ll
- name: Run tests
env:
SECRET_KEY: citest
AUTH_METHOD: local
run: |
python -m coverage run --branch --append --source=zezere manage.py test
- name: Test migrations
env:
SECRET_KEY: citest
AUTH_METHOD: local
run: |
python -m coverage run --branch --append --source=zezere manage.py migrate
- name: Report on test coverage
run: |
coverage report
- name: Ensure test coverage
run: |
coverage xml
diff-cover coverage.xml --fail-under=100 --compare-branch origin/main
- name: Ensure code quality change
run: |
diff-quality --violations=flake8 --fail-under=100
integration_test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Load ip6 iptables
run: |
sudo modprobe ip6_tables
- name: apt-get update
run: sudo apt-get update
- name: Install system dependencies
run: |
sudo apt-get install libdevmapper-dev libbtrfs-dev
- name: Build a server container
run: |
sudo docker build -t zezere:testimg .
- name: Run a server
run: |
docker run --name zezere -e AUTH_METHOD=local -e SECRET_KEY=citest -e ALLOWED_HOSTS=bootserv --detach --rm -p 8080:8080 -t zezere:testimg
docker logs -f zezere &
- name: Build the integration test container
run: |
docker build -t integration -f tests/data/Dockerfile.integration .
- name: Start the libvirt container
run: |
docker run --privileged --detach --rm --device /dev/kvm --name integration integration
docker logs -f integration &
- name: Run the integration test
run: |
docker exec -w /src -e SECRET_KEY=citest -e AUTH_METHOD=local -e BOOTSERV_IP=172.17.0.1 -e ZEZERE_RUN_INTEGRATION_TEST=yes integration python3 manage.py test tests.test_integration