Skip to content

Instantly share code, notes, and snippets.

@yemreak
Created April 2, 2020 10:33
Show Gist options
  • Save yemreak/52ab15e5cc377b27fdb60098dcbc0528 to your computer and use it in GitHub Desktop.
Save yemreak/52ab15e5cc377b27fdb60098dcbc0528 to your computer and use it in GitHub Desktop.
GitHub python package workflow
# 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: Python package
on:
push:
branches: [ master, dev ]
pull_request:
branches: [ master, dev ]
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
max-parallel: 4
fail-fast: false
matrix:
python-version: [3.8]
os: [windows-latest, ubuntu-latest, macos-latest]
include:
- os: windows-latest
INSTALL: |
python -m pip install --upgrade pip -r requirements.txt .
- os: macos-latest
INSTALL: |
python3 -m pip install --upgrade pip
python3 -m pip install -r requirements.txt
python3 -m pip install .
- os: ubuntu-latest
INSTALL: |
python3 -m pip install --upgrade pip
python3 -m pip install -r requirements.txt
python3 -m pip install .
steps:
- uses: actions/checkout@v2
- name: 🔨 Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: 📦 Installing dependencies
run: |
${{matrix.INSTALL}}
- name: ⏬ Downloading test repos
run: |
git clone https://github.com/YEmreAk/YLib ../YLib
git clone https://github.com/YEmreAk/YPython ../YPython
git clone https://github.com/yedhrab/DarkCode-Theme ../DarkCode-Theme
- name: ⚗️ Functional testing
run: |
pip install pytest
mkdir test-results
python -m pytest --junitxml=test-results/junit.xml
- 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment