2022-08-26 14:39:49 +00:00
|
|
|
name: Sith3 CI
|
2022-08-25 19:14:04 +00:00
|
|
|
|
2022-08-26 11:20:57 +00:00
|
|
|
on:
|
|
|
|
pull_request:
|
2022-10-27 23:41:53 +00:00
|
|
|
branches: [ master, taiste ]
|
2022-08-26 15:11:20 +00:00
|
|
|
push:
|
2022-10-27 23:41:53 +00:00
|
|
|
branches: [ master, taiste ]
|
2022-08-26 12:39:10 +00:00
|
|
|
|
2022-08-25 19:14:04 +00:00
|
|
|
jobs:
|
2022-08-25 20:23:13 +00:00
|
|
|
unittests:
|
2022-08-25 19:14:04 +00:00
|
|
|
runs-on: ubuntu-latest
|
2022-08-26 12:39:10 +00:00
|
|
|
timeout-minutes: 30
|
2022-08-25 19:14:04 +00:00
|
|
|
|
|
|
|
steps:
|
2022-08-26 12:39:10 +00:00
|
|
|
- uses: actions/checkout@v3
|
|
|
|
|
2022-08-26 15:04:09 +00:00
|
|
|
# Skip unit testing if no diff on .py files
|
|
|
|
- name: Check file diff
|
|
|
|
uses: technote-space/get-diff-action@v6
|
|
|
|
id: git-diff
|
|
|
|
with:
|
2022-08-26 21:31:33 +00:00
|
|
|
PATTERNS: |
|
|
|
|
**/*.py
|
2022-08-26 15:04:09 +00:00
|
|
|
|
2022-08-26 12:39:10 +00:00
|
|
|
- name: Set up python
|
2022-08-26 15:04:09 +00:00
|
|
|
if: steps.git-diff.outputs.diff
|
2022-08-26 12:39:10 +00:00
|
|
|
uses: actions/setup-python@v4
|
|
|
|
with:
|
|
|
|
python-version: '3.8'
|
|
|
|
|
|
|
|
- name: Install dependencies
|
2022-08-26 15:04:09 +00:00
|
|
|
if: steps.git-diff.outputs.diff
|
2022-08-26 12:39:10 +00:00
|
|
|
run: |
|
|
|
|
sudo apt-get update
|
|
|
|
sudo apt-get install gettext libxapian-dev libgraphviz-dev
|
|
|
|
|
|
|
|
- name: Install poetry
|
2022-08-26 15:04:09 +00:00
|
|
|
if: steps.git-diff.outputs.diff
|
2022-08-26 12:39:10 +00:00
|
|
|
run: |
|
|
|
|
python -m pip install --upgrade pip
|
|
|
|
python -m pip install poetry
|
|
|
|
|
|
|
|
- name: Checking pyproject.toml syntax
|
2022-08-26 15:04:09 +00:00
|
|
|
if: steps.git-diff.outputs.diff
|
2022-08-26 12:39:10 +00:00
|
|
|
run: poetry check
|
|
|
|
|
|
|
|
- name: Install project
|
2022-08-26 15:04:09 +00:00
|
|
|
if: steps.git-diff.outputs.diff
|
2022-08-26 12:39:10 +00:00
|
|
|
run: poetry install -E testing
|
|
|
|
|
|
|
|
- name: Setup xapian index
|
2022-08-26 15:04:09 +00:00
|
|
|
if: steps.git-diff.outputs.diff
|
2022-08-26 12:39:10 +00:00
|
|
|
run: |
|
|
|
|
mkdir -p /dev/shm/search_indexes
|
|
|
|
ln -s /dev/shm/search_indexes sith/search_indexes
|
|
|
|
|
|
|
|
- name: Setup project
|
2022-08-26 15:04:09 +00:00
|
|
|
if: steps.git-diff.outputs.diff
|
2022-08-26 12:39:10 +00:00
|
|
|
run: poetry run ./manage.py compilemessages
|
|
|
|
|
|
|
|
- name: Launch tests and generate coverage report
|
2022-08-26 15:04:09 +00:00
|
|
|
if: steps.git-diff.outputs.diff
|
2022-08-26 12:39:10 +00:00
|
|
|
run: |
|
|
|
|
poetry run coverage run ./manage.py test
|
|
|
|
poetry run coverage report
|
2022-08-25 19:14:04 +00:00
|
|
|
|
|
|
|
lint:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
steps:
|
2022-08-26 12:39:10 +00:00
|
|
|
- uses: actions/checkout@v3
|
|
|
|
- name: Set up python
|
|
|
|
uses: actions/setup-python@v4
|
|
|
|
with:
|
|
|
|
python-version: '3.8'
|
|
|
|
|
|
|
|
- name: Install black
|
|
|
|
run: |
|
|
|
|
python -m pip install --upgrade pip
|
2023-04-22 13:32:31 +00:00
|
|
|
python -m pip install black==23.3.0
|
2022-08-26 12:39:10 +00:00
|
|
|
|
|
|
|
- name: Check linting
|
2022-08-26 14:12:17 +00:00
|
|
|
run: black --check .
|