Added Github actions workflow

This commit is contained in:
Manuel Cortez 2024-04-29 16:50:14 -06:00
parent c96431863f
commit 99d7434eea
No known key found for this signature in database
GPG Key ID: 9E0735CA15EFE790
2 changed files with 61 additions and 60 deletions

61
.github/workflows/test.yml vendored Normal file
View File

@ -0,0 +1,61 @@
name: Test
on:
push:
branches:
- '*'
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12']
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
pip install --upgrade pytest coverage mypy
pip install --upgrade -r requirements.txt
- name: Run mypy
run: mypy updater
- name: Run tests with coverage
run: |
coverage run --source . --omit conf.py -m pytest --junitxml=report.xml
coverage report
coverage xml
- name: Upload test reports
uses: actions/upload-artifact@v4
with:
name: test-reports-${{ matrix.python-version }}
path: |
report.xml
coverage.xml
build-docs:
runs-on: ubuntu-latest
container: python:latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install dependencies
run: |
pip install --upgrade sphinx
pip install --upgrade -r requirements.txt
- name: Build docs
run: |
make html
mv -f _build/html public
- name: Upload docs
uses: actions/upload-artifact@v4
with:
name: built-docs
path: public
retention-days: 1

View File

@ -1,60 +0,0 @@
stages:
- test
- doc
test:mipy:
stage: test
tags:
- linux
image: python:3.7
interruptible: true
script:
- 'pip install --upgrade mypy pytest'
- 'pip install --upgrade -r requirements.txt'
- 'mypy updater'
only:
- branches@manuelcortez/updater
- release
- tags
- schedules
test:pytest:
stage: test
tags:
- linux
image: python:3.8
interruptible: true
script:
- 'pip install --upgrade pytest coverage'
- 'pip install --upgrade -r requirements.txt'
- 'coverage run --source . --omit conf.py -m pytest --junitxml=report.xml'
- 'coverage report'
- 'coverage xml'
only:
- branches@manuelcortez/updater
- release
- tags
- schedules
artifacts:
when: always
reports:
junit: report.xml
cobertura: coverage.xml
pages:
image: python:latest
tags:
- docker
interruptible: true
only:
- main
stage: doc
script:
- 'pip install --upgrade sphinx'
- 'pip install --upgrade -r requirements.txt'
- 'make html'
- 'mv -f _build/html public'
artifacts:
expire_in: 1 day
paths:
- public