mirror of
https://github.com/ae-utbm/sith.git
synced 2024-11-30 04:54:23 +00:00
83 lines
2.0 KiB
YAML
83 lines
2.0 KiB
YAML
name: Sith3 CI
|
|
|
|
on:
|
|
pull_request:
|
|
branches: [ master ]
|
|
push:
|
|
branches: [ master ]
|
|
|
|
jobs:
|
|
unittests:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 30
|
|
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
|
|
# 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
|
|
|
|
- name: Set up python
|
|
if: steps.git-diff.outputs.diff
|
|
uses: actions/setup-python@v4
|
|
with:
|
|
python-version: '3.8'
|
|
|
|
- name: Install dependencies
|
|
if: steps.git-diff.outputs.diff
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install gettext libxapian-dev libgraphviz-dev
|
|
|
|
- name: Install poetry
|
|
if: steps.git-diff.outputs.diff
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
python -m pip install poetry
|
|
|
|
- name: Checking pyproject.toml syntax
|
|
if: steps.git-diff.outputs.diff
|
|
run: poetry check
|
|
|
|
- name: Install project
|
|
if: steps.git-diff.outputs.diff
|
|
run: poetry install -E testing
|
|
|
|
- name: Setup xapian index
|
|
if: steps.git-diff.outputs.diff
|
|
run: |
|
|
mkdir -p /dev/shm/search_indexes
|
|
ln -s /dev/shm/search_indexes sith/search_indexes
|
|
|
|
- name: Setup project
|
|
if: steps.git-diff.outputs.diff
|
|
run: poetry run ./manage.py compilemessages
|
|
|
|
- name: Launch tests and generate coverage report
|
|
if: steps.git-diff.outputs.diff
|
|
run: |
|
|
poetry run coverage run ./manage.py test
|
|
poetry run coverage report
|
|
|
|
lint:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- 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
|
|
run: black --check . |