Replace Travis with GitHub Actions (#216)

* Replace Travis config with GitHub Actions config

* Use Coveralls GitHub Action

* Correct Coveralls flag name

* Try AndreMiras/coveralls-python-action@develop

* Prevent double-run on push to PRs

Closes #216.
This commit is contained in:
Christopher Charbonneau Wells 2021-05-19 21:12:03 -07:00 committed by GitHub
parent 25fb295d7b
commit c8e1fee3e4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 62 additions and 36 deletions

View File

@ -13,6 +13,7 @@ source =
parallel = true
concurrency = multiprocessing
data_file = data/.coverage
relative_files = True
[html]
directory = htmlcov

60
.github/workflows/ci.yml vendored Normal file
View File

@ -0,0 +1,60 @@
name: CI
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
test:
runs-on: ubuntu-latest
env:
DJANGO_SETTINGS_MODULE: babybuddy.settings.ci
strategy:
max-parallel: 4
matrix:
python-version: [ 3.6, 3.7, 3.8 ]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- uses: actions/setup-node@v2
with:
node-version: '10'
- run: npm install -g gulp-cli
- run: npm install
- name: Install pipenv
run: |
python -m pip install --upgrade pipenv wheel
- name: Cache Python dependencies
id: cache-pipenv
uses: actions/cache@v2
with:
path: ~/.local/share/virtualenvs
key: ${{ runner.os }}-python-${{ matrix.python-version }}-pipenv-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-python-${{ matrix.python-version }}-pipenv-
- name: Install dependencies
if: steps.cache-pipenv.outputs.cache-hit != 'true'
run: |
pipenv install --deploy --dev
- run: gulp lint
- run: gulp coverage
- name: Submit results to Coveralls
uses: AndreMiras/coveralls-python-action@develop
with:
github-token: ${{ secrets.github_token }}
flag-name: test-python-${{ matrix.python-version }}
parallel: true
coveralls_finish:
needs: test
runs-on: ubuntu-latest
steps:
- name: Coveralls Finished
uses: AndreMiras/coveralls-python-action@develop
with:
github-token: ${{ secrets.github_token }}
parallel-finished: true

View File

@ -1,34 +0,0 @@
os: linux
language: generic
dist: bionic
jobs:
include:
- name: "Python 3.6"
before_install:
- pyenv global `pyenv versions | tr -d "[:blank:]" | grep -Po "3\.6\.[\d]+" | tail -1`
- name: "Python 3.7"
before_install:
- pyenv global `pyenv versions | tr -d "[:blank:]" | grep -Po "3\.7\.[\d]+" | tail -1`
- name: "Python 3.8"
before_install:
- pyenv global `pyenv versions | tr -d "[:blank:]" | grep -Po "3\.8\.[\d]+" | tail -1`
cache:
directories:
- $HOME/.cache/pip
- node_modules
env:
- DJANGO_SETTINGS_MODULE="babybuddy.settings.travis"
install:
- nvm use 10
- npm install -g gulp-cli
- npm install
- pip install pipenv
- pipenv --python `pyenv which python` install --dev
before_script:
- gulp lint
script:
- gulp coverage
after_success:
- pipenv run coveralls
notifications:
email: false

View File

@ -1,6 +1,5 @@
# Contributing
[![Build Status](https://travis-ci.org/babybuddy/babybuddy.svg?branch=master)](https://travis-ci.com/babybuddy/babybuddy)
[![Coverage Status](https://coveralls.io/repos/github/babybuddy/babybuddy/badge.svg?branch=master)](https://coveralls.io/github/babybuddy/babybuddy?branch=master)
- [Contributions](#contributions)

View File

@ -1,6 +1,6 @@
from .base import *
SECRET_KEY = 'TRAVISCIWHYNOT'
SECRET_KEY = 'CISECRETKEYIGUESS'
# Static files (CSS, JavaScript, Images)