Add github actions

This commit is contained in:
Artur Barseghyan 2021-06-22 23:31:41 +02:00
parent f0862c272c
commit d52c76f628
5 changed files with 103 additions and 61 deletions

View file

@ -1,60 +0,0 @@
# Python CircleCI 2.0 configuration file
#
# Check https://circleci.com/docs/2.0/language-python/ for more details
#
version: 2
jobs:
build:
docker:
# specify the version you desire here
# use `-browsers` prefix for selenium tests, e.g. `3.6.1-browsers`
- image: circleci/python:3.6.1-browsers
# Specify service dependencies here if necessary
# CircleCI maintains a library of pre-built images
# documented at https://circleci.com/docs/2.0/circleci-images/
- image: circleci/postgres:9.4
environment:
POSTGRES_USER: postgres
POSTGRES_DB: fobi_tests
working_directory: ~/repo
steps:
- checkout
# Download and cache dependencies
- restore_cache:
keys:
- v1-dependencies-{{ checksum "examples/requirements/django_3_0.txt" }}
# fallback to using the latest cache if no exact match is found
- v1-dependencies-
- run:
name: install dependencies
command: |
python3 -m venv venv
. venv/bin/activate
pip install --upgrade pip
python setup.py install
pip install -r examples/requirements/django_3_0.txt
- save_cache:
paths:
- ./venv
key: v1-dependencies-{{ checksum "examples/requirements/django_3_0.txt" }}
# run tests!
# this example uses Django's built-in test-runner
# other common Python testing frameworks include pytest and nose
# https://pytest.org
# https://nose.readthedocs.io
- run:
name: run tests
command: |
. venv/bin/activate
python runtests.py
- store_artifacts:
path: test-reports
destination: test-reports

View file

@ -8,6 +8,8 @@ omit =
example/simple/settings/*
example/simple/wsgi.py
relative_files = True
[report]
exclude_lines =
pragma: no cover

View file

@ -1 +1 @@
service_name: travis-ci
service_name: github-actions

2
.env Normal file
View file

@ -0,0 +1,2 @@
GITHUB_TOKEN
COVERALLS_REPO_TOKEN

98
.github/workflows/test.yml vendored Normal file
View file

@ -0,0 +1,98 @@
name: test
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
strategy:
max-parallel: 4
matrix:
include:
- python-version: 3.6
requirements: django_2_2
tox_env: py36-django22
- python-version: 3.7
requirements: django_2_2
tox_env: py37-django22
- python-version: 3.8
requirements: django_2_2
tox_env: py38-django22
- python-version: 3.9
requirements: django_2_2
tox_env: py39-django22
- python-version: 3.6
requirements: django_3_0
tox_env: py36-django30
- python-version: 3.7
requirements: django_3_0
tox_env: py37-django30
- python-version: 3.8
requirements: django_3_0
tox_env: py38-django30
- python-version: 3.9
requirements: django_3_0
tox_env: py39-django30
- python-version: 3.6
requirements: django_3_1
tox_env: py36-django31
- python-version: 3.7
requirements: django_3_1
tox_env: py37-django31
- python-version: 3.8
requirements: django_3_1
tox_env: py38-django31
- python-version: 3.9
requirements: django_3_1
tox_env: py39-django31
- python-version: 3.6
requirements: django_3_2
tox_env: py36-django32
- python-version: 3.7
requirements: django_3_2
tox_env: py37-django32
- python-version: 3.8
requirements: django_3_2
tox_env: py38-django32
- python-version: 3.9
requirements: django_3_2
tox_env: py39-django32
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install pip-tools
pip-compile examples/requirements/${{ matrix.requirements }}.in
pip install -r examples/requirements/${{ matrix.requirements }}.txt
pip-compile examples/requirements/test.in
pip install -r examples/requirements/test.txt
- name: Run Tests
run: tox -e ${{ matrix.tox_env }}
- name: Coveralls
uses: AndreMiras/coveralls-python-action@develop
with:
parallel: true
flag-name: Run Tests
coveralls_finish:
needs: test
runs-on: ubuntu-latest
steps:
- name: Coveralls Finished
env:
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
GITHUB_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
uses: AndreMiras/coveralls-python-action@develop
with:
parallel-finished: true
debug: True