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:
|
|
|
|
branches: [ master ]
|
2022-08-26 15:11:20 +00:00
|
|
|
push:
|
|
|
|
branches: [ master ]
|
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:
|
|
|
|
PATTERNS: +**/*.+(py)
|
|
|
|
|
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
|
|
|
|
python -m pip install black==22.6.0
|
|
|
|
|
|
|
|
- name: Check linting
|
2022-08-26 14:12:17 +00:00
|
|
|
run: black --check .
|