Skip to content

Github Actions CI/CD tests for project #394

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jun 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 60 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: CI Tests

on:
push:
branches:
- master
tags:
- "*"
pull_request:
branches:
- "*"

jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
mongodb-version: [3.6, 4.0, 4.2]

include:
- name: "linting"
python: "3.8"
os: ubuntu-latest
tox_env: "lint"
mongodb-version: 4.2

- name: "ubuntu-py36"
python: "3.6"
os: ubuntu-latest
tox_env: "py36"
- name: "ubuntu-py37"
python: "3.7"
os: ubuntu-latest
tox_env: "py37"
- name: "ubuntu-py38"
python: "3.8"
os: ubuntu-latest
tox_env: "py38"
- name: "ubuntu-pypy3"
python: "pypy3"
os: ubuntu-latest
tox_env: "pypy3"

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox virtualenv
- name: Start MongoDB
uses: supercharge/[email protected]
with:
mongodb-version: ${{ matrix.mongodb-version }}
- name: Test build
run: "tox -e ${{ matrix.tox_env }}"
45 changes: 22 additions & 23 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,30 @@
# Use a container-based environment
sudo: false
dist: xenial
os: linux

language: python

python:
- '3.6'
- '3.7'
- '3.8'
- pypy3

jobs:
include:
- language: python
python: 3.6
name: "linting"
script:
- tox -e lint

env:
- MONGOENGINE=latest_pip
- MONGOENGINE=dev
env: TOXENV=lint
- language: python
python: 3.6
name: "Test on python 3.6"
env: TOXENV=py36
- language: python
python: 3.7
name: "Test on python 3.7"
env: TOXENV=py37
- language: python
python: 3.8
name: "Test on python 3.8"
env: TOXENV=py38
- language: python
python: pypy3
name: "Test on python pypy3"
env: TOXENV=pypy3

services:
- mongodb
Expand All @@ -31,11 +36,8 @@ install:
- travis_retry pip install tox>=3.14
- travis_retry pip install virtualenv

# Cache dependencies installed via pip
cache: pip

script:
- tox -e $(echo py$TRAVIS_PYTHON_VERSION-me_$MONGOENGINE | tr -d . | sed -e 's/pypypy/pypy/') -- --with-coverage
- tox

after_success:
- coveralls --verbose
Expand All @@ -60,11 +62,8 @@ deploy:
distributions: "sdist bdist_wheel"

# only deploy on tagged commits (aka GitHub releases) and only for the
# parent repo's builds running Python 2.7 along with dev MongoEngine (we run
# Travis against many different Python and MongoEngine versions and we don't
# want the deploy to occur multiple times).
# parent repo's builds running Python 3.6
on:
tags: true
condition: "$MONGOENGINE = dev"
python: 3.5
python: 3.6
repo: MongoEngine/flask-mongoengine
4 changes: 1 addition & 3 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
[tox]
envlist = {py36,py37,py38,pypy3}-{me_latest_pip,me_dev},lint
envlist = {py36,py37,py38,pypy3},lint

[testenv]
commands =
python -m pytest
deps =
me_latest_pip: mongoengine>=0.19.0
me_dev: https://github.com/MongoEngine/mongoengine/tarball/master
PyMongo>3.9.0
pytest
pytest-cov
Expand Down