CI #472
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
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions | |
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions | |
name: CI | |
on: | |
push: | |
branches: [ master, develop ] | |
pull_request: | |
branches: [ master, develop ] | |
schedule: | |
- cron: '0 8 * * *' | |
jobs: | |
test: | |
# Skip CI if [ci skip] in the commit message | |
if: "! contains(toJSON(github.event.commits.*.message), '[ci skip]')" | |
strategy: | |
fail-fast: true | |
matrix: | |
os: [ "ubuntu-20.04" ] | |
# python-version: [ "3.6.2", "3.7", "3.8", "3.9" ] | |
python-version: [ "3.8" ] | |
runs-on: ${{ matrix.os }} | |
timeout-minutes: 40 | |
steps: | |
#---------------------------------------------- | |
# check-out repo and set-up python | |
#---------------------------------------------- | |
- name: Check out repository | |
uses: actions/checkout@v2 | |
- name: Set up python ${{ matrix.python-version }} | |
id: setup-python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ matrix.python-version }} | |
#---------------------------------------------- | |
# ----- install & configure poetry ----- | |
#---------------------------------------------- | |
- name: Install Poetry | |
uses: snok/install-poetry@v1 | |
with: | |
version: 1.3.2 | |
virtualenvs-create: true | |
virtualenvs-in-project: true | |
#---------------------------------------------- | |
# load cached venv if cache exists | |
#---------------------------------------------- | |
- name: Load cached venv | |
id: cached-poetry-dependencies | |
uses: actions/cache@v2 | |
with: | |
path: .venv | |
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }} | |
#---------------------------------------------- | |
# install dependencies if cache does not exist | |
#---------------------------------------------- | |
- name: Install dependencies | |
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' | |
run: poetry install --no-interaction --no-root | |
#---------------------------------------------- | |
# install your root project, if required | |
#---------------------------------------------- | |
- name: Install library | |
run: poetry install --no-interaction | |
#---------------------------------------------- | |
# check codestyle & lint | |
#---------------------------------------------- | |
- name: Check codestyle | |
run: | | |
make check-codestyle | |
# - name: Lint with flake8 | |
# run: | | |
# make lint | |
#---------------------------------------------- | |
# add matrix specifics and run test suite | |
#---------------------------------------------- | |
- name: Run tests | |
run: | | |
source .venv/bin/activate | |
make pytest | |
#----------------------------------------------- | |
# Create coverage badge | |
#----------------------------------------------- | |
- name: Create coverage badge | |
run: | | |
make coverage-badge | |
- name: Add & Commit | |
uses: EndBug/add-and-commit@v9.1.1 | |
if: "contains(toJSON(github.event.commits.*.message), '[coverage skip]')" | |
with: | |
author_name: ${{ github.actor }} | |
author_email: ${{ github.actor }}@users.noreply.github.com | |
message: "ci: Update coverage badge [ci skip] [coverage skip]" | |
add: "coverage.svg" | |
# release: | |
# needs: test | |
# # https://github.community/t/how-do-i-specify-job-dependency-running-in-another-workflow/16482 | |
# if: github.event_name == 'push' && github.ref == 'refs/heads/master' && !contains(github.event.head_commit.message, 'chore(release):') | |
# runs-on: ubuntu-latest | |
# steps: | |
# #---------------------------------------------- | |
# # check-out repo and set-up python | |
# #---------------------------------------------- | |
# - uses: actions/setup-python@v2 | |
# with: | |
# python-version: 3.8 | |
# - name: Checkout code | |
# uses: actions/checkout@v2 | |
# with: | |
# fetch-depth: 0 | |
# token: ${{ secrets.GH_TOKEN }} | |
# #----------------------------------------------- | |
# # Publish to PYPI in case of a new version | |
# #----------------------------------------------- | |
# - name: Semantic Release | |
# run: | | |
# pip install python-semantic-release | |
# git config --global user.name "github-actions" | |
# git config --global user.email "action@github.com" | |
# semantic-release publish -D commit_author="github-actions <action@github.com>" | |
# env: | |
# GH_TOKEN: ${{ secrets.GH_TOKEN }} | |
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# REPOSITORY_USERNAME: ${{ secrets.PYPI_USERNAME }} | |
# REPOSITORY_PASSWORD: ${{ secrets.PYPI_PASSWORD }} |