Skip to content

Merge pull request #127 from khoivan88/pyup-update-requests-2.26.0-to… #229

Merge pull request #127 from khoivan88/pyup-update-requests-2.26.0-to…

Merge pull request #127 from khoivan88/pyup-update-requests-2.26.0-to… #229

Workflow file for this run

# This is a basic workflow to help you get started with Actions
name: pytest + codecov
# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
# 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 "build"
build:
# The type of runner that the job will run on
# runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}
strategy:
max-parallel: 3
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
# os: [ubuntu-latest]
python-version: ['3.10', '3.11', '3.x']
# python-version: ['3.x']
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Display Python version
run: python -c "import sys; print(sys.version)"
- name: Cache pip Ubuntu
uses: actions/cache@v2
if: startsWith(runner.os, 'Linux')
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Cache pip MacOS
uses: actions/cache@v2
if: startsWith(runner.os, 'macOS')
with:
path: ~/Library/Caches/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Cache pip Windows
uses: actions/cache@v2
if: startsWith(runner.os, 'Windows')
with:
path: ~\AppData\Local\pip\Cache
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Lint with flake8
run: |
pip install flake8
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
pip install pytest pytest-cov
python -m pytest --cov=./ --cov-report=xml tests
# - name: Create a package but do not deploy anywhere
# run: |
# pip install ./
- name: Upload coverage to codecov.io
uses: codecov/codecov-action@v4
if: startsWith(runner.os, 'Linux') && matrix.python-version == 3.11
with:
# CODECOV_TOKEN is repo-specific and it must be copied from codecov.io for the repository
# and stored as a secret in GitHub's repository Settings > Secrets. CODECOV_TOKEN does not
# need to be stored in codecov.io as a secret even though codecov.io provides that feature.
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml # file where pytest-cov will store results
fail_ci_if_error: false