Skip to content

Commit

Permalink
gh-action: define ci action, avoid using Travis #68
Browse files Browse the repository at this point in the history
  • Loading branch information
guilgautier committed Dec 1, 2021
1 parent 3c1d230 commit 9323baa
Show file tree
Hide file tree
Showing 3 changed files with 86 additions and 76 deletions.
86 changes: 86 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
# This is a basic workflow to help you get started with Actions
# based on https://github.com/snok/install-poetry

name: CI

# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
branches:
- master
- v1-dev
paths:
- "src/**"
- "tests/**"
- "pyproject.toml"
- "poetry.toml"
- "poetry.lock"
- "!**.md"
- "!.github/workflows/docs.yml"
pull_request:
paths-ignore:
- "**.md"

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "test"
test:
# The type of runner that the job will run on
strategy:
matrix:
os: ["ubuntu-latest"] #, "macos-latest"]
python-version: ["3.7", "3.8", "3.9"]
runs-on: ${{ matrix.os }}

steps:
# https://github.com/actions/checkout
- name: Checkout project repository
uses: actions/checkout@v2

# https://github.com/actions/setup-python
- name: Install Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

# https://github.com/snok/install-poetry
- name: Install Poetry
uses: snok/install-poetry@v1

# with:
# virtualenvs-create: true
# virtualenvs-in-project: true

- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v2
with:
path: .venv
key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}

- name: Install main (non-optional) and dev dependencies
# see [tool.poetry.dependencies] and [tool.poetry.dev-dependencies]
# in pyproject.toml
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-root

- name: Install package
run: poetry install

- name: Test with pytest and create coverage report
# Configuration of pytest [tool.pytest.ini_options] in pyproject.toml
# https://docs.pytest.org/en/latest/reference/customize.html#pyproject-toml
run: poetry run pytest --cov-report=xml

- name: Upload coverage to Codecov
# https://docs.codecov.com/docs
# https://github.com/codecov/codecov-action
uses: codecov/codecov-action@v2
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.xml
# generated using --cov-report=xml above
44 changes: 0 additions & 44 deletions .travis.yml

This file was deleted.

32 changes: 0 additions & 32 deletions scripts/install.sh

This file was deleted.

0 comments on commit 9323baa

Please sign in to comment.