mirror of
https://github.com/ae-utbm/sith3.git
synced 2024-06-13 18:21:55 +00:00
Improve CI
This commit is contained in:
parent
af4c9cbdd4
commit
72c490f4e3
8
.github/actions/compile_messages/action.yml
vendored
Normal file
8
.github/actions/compile_messages/action.yml
vendored
Normal file
|
@ -0,0 +1,8 @@
|
|||
name: "Compile messages"
|
||||
description: "Compile the gettext translation messages"
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: Setup project
|
||||
run: poetry run ./manage.py compilemessages
|
||||
shell: bash
|
53
.github/actions/setup_project/action.yml
vendored
Normal file
53
.github/actions/setup_project/action.yml
vendored
Normal file
|
@ -0,0 +1,53 @@
|
|||
name: "Setup project"
|
||||
description: "Setup Python and Poetry"
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: Install apt packages
|
||||
uses: awalsh128/cache-apt-pkgs-action@latest
|
||||
with:
|
||||
packages: gettext libxapian-dev libgraphviz-dev
|
||||
version: 1.0 # increment to reset cache
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
sudo apt update
|
||||
sudo apt install gettext libxapian-dev libgraphviz-dev
|
||||
shell: bash
|
||||
|
||||
- name: Set up python
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: "3.10"
|
||||
|
||||
- name: Load cached Poetry installation
|
||||
id: cached-poetry
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: ~/.local
|
||||
key: poetry-0 # increment to reset cache
|
||||
|
||||
- name: Install Poetry
|
||||
if: steps.cached-poetry.outputs.cache-hit != 'true'
|
||||
shell: bash
|
||||
run: curl -sSL https://install.python-poetry.org | python3 -
|
||||
|
||||
- name: Check pyproject.toml syntax
|
||||
shell: bash
|
||||
run: poetry check
|
||||
|
||||
- name: Load cached dependencies
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: ~/.cache/pypoetry
|
||||
key: ${{ runner.os }}-poetry-${{ hashFiles('**/poetry.lock') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-poetry-
|
||||
|
||||
- name: Install dependencies
|
||||
run: poetry install -E testing -E docs
|
||||
shell: bash
|
||||
|
||||
- name: Compile gettext messages
|
||||
run: poetry run ./manage.py compilemessages
|
||||
shell: bash
|
10
.github/actions/setup_xapian/action.yml
vendored
Normal file
10
.github/actions/setup_xapian/action.yml
vendored
Normal file
|
@ -0,0 +1,10 @@
|
|||
name: "Setup xapian"
|
||||
description: "Setup the xapian indexes"
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: Setup xapian index
|
||||
run: |
|
||||
mkdir -p /dev/shm/search_indexes
|
||||
ln -s /dev/shm/search_indexes sith/search_indexes
|
||||
shell: bash
|
43
.github/workflows/ci.yml
vendored
Normal file
43
.github/workflows/ci.yml
vendored
Normal file
|
@ -0,0 +1,43 @@
|
|||
name: Sith 3 CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- taiste
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
- taiste
|
||||
|
||||
jobs:
|
||||
black:
|
||||
name: Black format
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v3
|
||||
- name: Setup Project
|
||||
uses: ./.github/actions/setup_project
|
||||
- run: poetry run black --check .
|
||||
|
||||
tests:
|
||||
name: Run tests and generate coverage report
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v3
|
||||
- uses: ./.github/actions/setup_project
|
||||
- uses: ./.github/actions/setup_xapian
|
||||
- uses: ./.github/actions/compile_messages
|
||||
- name: Run tests
|
||||
run: poetry run coverage run ./manage.py test
|
||||
- name: Generate coverage report
|
||||
run: |
|
||||
poetry run coverage report
|
||||
poetry run coverage html
|
||||
- name: Archive code coverage results
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: coverage-report
|
||||
path: coverage_report
|
83
.github/workflows/unittests.yml
vendored
83
.github/workflows/unittests.yml
vendored
|
@ -1,83 +0,0 @@
|
|||
name: Sith3 CI
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches: [ master, taiste ]
|
||||
push:
|
||||
branches: [ master, taiste ]
|
||||
|
||||
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==23.3.0
|
||||
|
||||
- name: Check linting
|
||||
run: black --check .
|
Loading…
Reference in New Issue
Block a user