Files
voculinux/.github/workflows/unified-pipeline.yml
T
jatinkrmalik b869c13ff5 Fix CI: Simplify deploy-website condition [web]
Deploy website whenever web-build succeeds on main branch.
The web-build job already has the conditional logic for when to build.
2026-01-19 17:43:38 -08:00

185 lines
5.3 KiB
YAML

name: Vocalinux CI
on:
push:
branches: [ main, master ]
pull_request:
branches: [ main, master ]
workflow_dispatch:
permissions:
contents: write
pages: write
id-token: write
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
python-lint:
name: 🔍 Lint Python
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
cache: 'pip'
- name: Install linting tools
run: |
python -m pip install --upgrade pip
pip install flake8 black isort
- name: Lint with flake8 (critical errors)
run: |
flake8 src/ tests/ --count --select=E9,F63,F7,F82 --show-source --statistics
- name: Check formatting with black
run: |
black --check --diff src/ tests/
- name: Check import sorting with isort
run: |
isort --check-only --diff --profile black src/ tests/
python-test:
name: 🧪 Test Python ${{ matrix.python-version }}
runs-on: ubuntu-latest
needs: python-lint
strategy:
fail-fast: false
matrix:
python-version: ['3.8', '3.10', '3.11']
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
xdotool \
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: Install GObject introspection dependencies
run: |
sudo apt-get update
# For Ubuntu 24.04+ (or the latest GitHub Actions runner image)
sudo apt-get install -y gir1.2-glib-2.0 libgirepository-2.0-dev pkg-config
# Alternatively, for older Ubuntu versions (like 22.04), you might need:
# sudo apt-get install -y libgirepository1.0-dev pkg-config
- name: Set up virtual environment
run: |
python -m venv venv
source venv/bin/activate
python -m pip install --upgrade pip setuptools wheel
# Install PyGObject from pip (with build deps installed above)
pip install PyGObject
pip install -e ".[dev]"
echo "VIRTUAL_ENV=$VIRTUAL_ENV" >> $GITHUB_ENV
echo "PATH=$VIRTUAL_ENV/bin:$PATH" >> $GITHUB_ENV
- name: Run tests with coverage
run: |
source venv/bin/activate
# Set GI_TYPELIB_PATH so pip-installed PyGObject can find system typelibs (AppIndicator3, etc.)
export GI_TYPELIB_PATH=/usr/lib/x86_64-linux-gnu/girepository-1.0:/usr/lib/girepository-1.0
PYTHONPATH=$PWD pytest --junitxml=junit-${{ matrix.python-version }}.xml --cov=src --cov-report=xml tests/
- name: Upload test results
if: always()
uses: actions/upload-artifact@v4
with:
name: test-results-${{ matrix.python-version }}
path: junit-${{ matrix.python-version }}.xml
- name: Upload coverage to Codecov
if: matrix.python-version == '3.10'
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage.xml
fail_ci_if_error: false
web-build:
name: 🌐 Build Website
runs-on: ubuntu-latest
if: |
contains(github.event.head_commit.message, '[web]') ||
github.event_name == 'workflow_dispatch' ||
(github.event_name == 'push' && contains(join(github.event.commits.*.modified, ','), 'web/'))
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: './web/package-lock.json'
- name: Install dependencies
working-directory: ./web
run: npm ci || npm install
- name: Lint
working-directory: ./web
run: npm run lint || true
- name: Type check
working-directory: ./web
run: npm run test:types || true
- name: Build
working-directory: ./web
run: npm run build
deploy-website:
name: 🚀 Deploy Website
runs-on: ubuntu-latest
needs: [python-test, web-build]
if: github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: './web/package-lock.json'
- name: Install and build
working-directory: ./web
run: |
npm ci || npm install
npm run deploy
- name: Deploy to gh-pages
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./web/out
publish_branch: gh-pages
cname: vocalinux.com
force_orphan: true