116 lines
3.1 KiB
YAML
116 lines
3.1 KiB
YAML
name: Vocalinux CI
|
|
|
|
on:
|
|
push:
|
|
branches: [ main, master ]
|
|
paths-ignore:
|
|
- '**.md'
|
|
- 'docs/**'
|
|
pull_request:
|
|
branches: [ main, master ]
|
|
paths-ignore:
|
|
- '**.md'
|
|
- 'docs/**'
|
|
|
|
jobs:
|
|
lint:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v4
|
|
with:
|
|
python-version: '3.10'
|
|
cache: 'pip'
|
|
cache-dependency-path: 'setup.py'
|
|
|
|
- name: Install development dependencies
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
python -m pip install flake8 black isort
|
|
|
|
- name: Lint with flake8
|
|
run: |
|
|
# stop the build if there are Python syntax errors or undefined names
|
|
flake8 src/ tests/ --count --select=E9,F63,F7,F82 --show-source --statistics
|
|
# exit-zero treats all errors as warnings
|
|
flake8 src/ tests/ --count --exit-zero --max-complexity=10 --max-line-length=100 --statistics
|
|
|
|
- name: Check formatting with black
|
|
run: |
|
|
black --check src/ tests/
|
|
|
|
- name: Check import sorting with isort
|
|
run: |
|
|
isort --check-only --profile black src/ tests/
|
|
|
|
test:
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
python-version: [3.8]
|
|
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
|
|
- name: Set up Python ${{ matrix.python-version }}
|
|
uses: actions/setup-python@v4
|
|
with:
|
|
python-version: ${{ matrix.python-version }}
|
|
cache: 'pip'
|
|
cache-dependency-path: 'setup.py'
|
|
|
|
- name: Install system dependencies
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y \
|
|
xdotool \
|
|
python3-gi \
|
|
gir1.2-appindicator3-0.1 \
|
|
libcairo2-dev \
|
|
pkg-config \
|
|
python3-dev \
|
|
libgirepository1.0-dev \
|
|
gobject-introspection \
|
|
libcairo-gobject2 \
|
|
gir1.2-gtk-3.0 \
|
|
portaudio19-dev
|
|
|
|
- name: Cache apt packages
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: /var/cache/apt/archives
|
|
key: ${{ runner.os }}-apt-${{ hashFiles('**/apt-packages.txt') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-apt-
|
|
|
|
- name: Set up virtual environment
|
|
run: |
|
|
python -m venv venv
|
|
source venv/bin/activate
|
|
python -m pip install --upgrade pip
|
|
# Install the package in development mode with dev dependencies
|
|
python -m pip install -e ".[dev]"
|
|
python -m pip install pytest pytest-cov
|
|
echo "VIRTUAL_ENV=$VIRTUAL_ENV" >> $GITHUB_ENV
|
|
echo "PATH=$VIRTUAL_ENV/bin:$PATH" >> $GITHUB_ENV
|
|
|
|
- name: Run pytest suite with coverage
|
|
run: |
|
|
source venv/bin/activate
|
|
# Make sure Python can find the 'src' module
|
|
PYTHONPATH=$PWD pytest --junitxml=junit.xml --cov=src tests/
|
|
|
|
- name: Upload test results to Codecov
|
|
if: ${{ !cancelled() }}
|
|
uses: codecov/test-results-action@v1
|
|
with:
|
|
token: ${{ secrets.CODECOV_TOKEN }}
|
|
|
|
- name: Upload coverage reports to Codecov
|
|
uses: codecov/codecov-action@v5
|
|
with:
|
|
token: ${{ secrets.CODECOV_TOKEN }}
|