mirror of
https://github.com/thatmattlove/hyperglass.git
synced 2026-01-26 20:28:07 +00:00
100 lines
3 KiB
YAML
100 lines
3 KiB
YAML
name: Backend Testing
|
|
on:
|
|
push:
|
|
paths:
|
|
- hyperglass/**
|
|
- .github/**
|
|
pull_request:
|
|
|
|
jobs:
|
|
backend:
|
|
name: Backend Tests
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
node-version: [20, 22]
|
|
pnpm-version: [9, 10]
|
|
redis-version: [latest]
|
|
python-version: ["3.11", "3.12"]
|
|
os: [ubuntu-latest]
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
services:
|
|
redis:
|
|
image: redis
|
|
options: >-
|
|
--health-cmd "redis-cli ping"
|
|
--health-interval 10s
|
|
--health-timeout 5s
|
|
--health-retries 5
|
|
ports:
|
|
- 6379:6379
|
|
httpbin:
|
|
image: kennethreitz/httpbin
|
|
ports:
|
|
- 8080:80
|
|
|
|
steps:
|
|
- name: Git Checkout
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Install OS dependencies
|
|
run: |
|
|
sudo apt-get install libcairo2-dev clang curl -y
|
|
|
|
- name: Install Python
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: ${{ matrix.python-version }}
|
|
|
|
- name: Install the latest version of rye
|
|
uses: eifinger/setup-rye@v4
|
|
with:
|
|
enable-cache: true
|
|
|
|
- name: Install PNPM
|
|
uses: pnpm/action-setup@v3
|
|
with:
|
|
version: ${{ matrix.pnpm-version }}
|
|
run_install: false
|
|
|
|
- name: Install Node
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: ${{ matrix.node-version }}
|
|
|
|
- name: Prepare
|
|
run: |
|
|
mkdir -p "$HOME/hyperglass"
|
|
echo "HYPERGLASS_APP_PATH=$HOME/hyperglass" >> $GITHUB_ENV
|
|
echo "HYPERGLASS_HOST=127.0.0.1" >> $GITHUB_ENV
|
|
echo "HYPERGLASS_PORT=8001" >> $GITHUB_ENV
|
|
echo "PYTHON3_PATH=$(which python)" >> $GITHUB_ENV
|
|
|
|
- name: Install
|
|
run: |
|
|
rye toolchain register $Python3_ROOT_DIR/bin/python
|
|
rye pin ${{ matrix.python-version }}
|
|
rye sync
|
|
|
|
- name: Activate virtual environment
|
|
run: |
|
|
. .venv/bin/activate
|
|
echo PATH=$PATH >> $GITHUB_ENV
|
|
|
|
- name: Lint (Rye)
|
|
run: rye lint
|
|
|
|
- name: Format (Rye)
|
|
run: rye format -- --check
|
|
|
|
- name: Tests (PyTest)
|
|
run: pytest hyperglass --ignore hyperglass/plugins/external
|
|
env:
|
|
HYPERGLASS_HTTPBIN_HOST: localhost
|
|
HYPERGLASS_HTTPBIN_PROTOCOL: http
|
|
HYPERGLASS_HTTPBIN_PORT: 8080
|
|
HYPERGLASS_REDIS_HOST: localhost
|
|
|
|
- name: Run hyperglass
|
|
run: ".tests/ga-backend-app.sh"
|