Lintteri Pythonille #144
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: Automated tests | |
on: pull_request | |
jobs: | |
auto-formatting: | |
runs-on: ubuntu-latest | |
timeout-minutes: 5 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: 3.12.1 | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install 'black==24.10.0' | |
pip install 'djlint==1.36.3' | |
- name: Check formatting | |
run: | | |
black -t py312 --check . | |
black -t py312 --check web/**/*.py.example | |
djlint --check . | |
lint: | |
runs-on: ubuntu-latest | |
timeout-minutes: 5 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: 3.12.1 | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install 'djlint==1.36.3' | |
pip install 'ruff==0.8.2' | |
- name: Check formatting | |
run: | | |
djlint --profile=django --lint --ignore "H006,H013,H030,H031,D018,T003" . | |
ruff check | |
unit-tests-sqlite: | |
runs-on: ubuntu-latest | |
timeout-minutes: 15 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: 3.12.1 | |
- name: Install dependencies | |
run: python -m pip install -r requirements.txt | |
- name: run django test | |
working-directory: ./web | |
run: python './manage.py' test --failfast | |
robot-tests: | |
runs-on: ubuntu-latest | |
timeout-minutes: 15 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: build SUT | |
run: docker build -t kipa . | |
- name: Set up Python 3.12.1 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.12.1 | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install robotframework | |
pip install robotframework-seleniumlibrary | |
- name: start SUT | |
run: docker run -d -p 3000:80 kipa | |
- name: wait SUT to start | |
run: while ! curl -s -f 'http://localhost:3000/kipa' ; do sleep 2; docker ps; done | |
shell: bash | |
- name: run robot | |
run: | | |
robot \ | |
--outputdir ./test-report \ | |
--variable BROWSER:headlessfirefox \ | |
--variable KIPA_URL:'http://localhost:3000/kipa' \ | |
--exitonfailure \ | |
web/robot/perustoiminnot.robot | |
- name: report | |
uses: actions/upload-artifact@v4 | |
if: always() | |
with: | |
name: robot-test-report | |
path: ./test-report |