ci: add run server test #348
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: [master] | |
pull_request: | |
concurrency: | |
group: ci-${{ github.head_ref }} | |
cancel-in-progress: true | |
env: | |
PYTHONUNBUFFERED: 1 | |
FORCE_COLOR: 1 # colored output by pytest etc. | |
CLICOLOR_FORCE: 1 # colored output by ruff | |
permissions: | |
contents: read | |
jobs: | |
# TODO: disable docs build until decision is made | |
# docs: | |
# runs-on: ubuntu-22.04 | |
# steps: | |
# - uses: actions/checkout@v4 | |
# - name: Set up Python 3.11 | |
# uses: actions/setup-python@v4 | |
# with: | |
# python-version: '3.11' | |
# - name: Cache python dependencies | |
# uses: actions/cache@v3 | |
# with: | |
# path: ~/.cache/pip | |
# key: pip-docs-${{ hashFiles('pyproject.toml') }} | |
# restore-keys: | | |
# pip-docs- | |
# - name: Install python dependencies | |
# run: | | |
# python -m pip install .[docs] | |
# python -m pip show fuji | |
# - name: Build documentation | |
# env: | |
# READTHEDOCS: 'True' | |
# run: | | |
# # TODO: add W flag back after fixing warnings | |
# SPHINXOPTS='-n' make -C docs html | |
lint: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Cache python dependencies | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cache/pip | |
~/.cache/pre-commit | |
key: lint-${{ hashFiles('.pre-commit-config.yaml', 'pyproject.toml') }} | |
restore-keys: | | |
lint- | |
- name: Set up Python 3.11 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.11' | |
- run: | | |
python -m pip install --upgrade pip setuptools wheel | |
python -m pip install hatch | |
- run: hatch run lint | |
tests: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python 3.11 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.11' | |
cache: pip | |
- name: Install python dependencies | |
run: | | |
python -m pip install --upgrade pip setuptools wheel | |
python -m pip install --upgrade hatch | |
- name: Run test suite with coverage | |
run: hatch run cov-ci | |
- name: Generate badges | |
if: always() | |
run: hatch run badges | |
- name: Upload test results | |
if: always() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: test-results | |
retention-days: 1 | |
path: pytest-junit.xml | |
- name: Upload coverage results | |
if: always() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: coverage-results | |
retention-days: 1 | |
path: pytest-cobertura.xml | |
- name: Touch repodois.yaml to generate recent timestamp (avoids download) | |
run: touch fuji_server/data/repodois.yaml | |
- name: Run server for 3 seconds and stop (test if server starts up) | |
run: | | |
hatch run python -m fuji_server -c fuji_server/config/server.ini & sleep 3 | |
pkill python | |
event_file: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: event-file | |
retention-days: 1 | |
path: ${{ github.event_path }} |