Skip to content

Instantly share code, notes, and snippets.

@dhassault
Last active July 2, 2022 02:45
Show Gist options
  • Save dhassault/1bd6b16dba0879107846c51b00d62ac6 to your computer and use it in GitHub Desktop.
Save dhassault/1bd6b16dba0879107846c51b00d62ac6 to your computer and use it in GitHub Desktop.
Github Actions Workflow
name: Unittests
on:
pull_request:
paths-ignore:
- "docs/**"
- "*.md"
jobs:
check-syntax-lints-type:
strategy:
fail-fast: false
matrix:
python-version: [3.9]
runs-on: "ubuntu-latest"
steps:
#------------------------------------------------
# ----- checkout repo and set-up python -----
#------------------------------------------------
- name: Check out repository
uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
#--------------------------------------------------------------
# ----- install dependencies -----
#--------------------------------------------------------------]
- uses: actions/checkout@v3
- name: Install poetry
run: pip install poetry
- name: Install dependencies
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: "poetry"
- run: poetry config virtualenvs.in-project false && poetry install
#----------------------------------------------
# -------- run code format checks ---------
#----------------------------------------------
- name: Format check with isort
run: poetry run isort --check . --profile black
- name: Format check with black
run: poetry run black --check .
#-----------------------------------
# -------- run linters ---------
#-----------------------------------
- name: Run linters
run: poetry run pylint
#--------------------------------
# -------- run mypy ---------
#--------------------------------
- name: Run mypy
run: poetry run mypy ./
run-unittests:
needs: [check-syntax-lints-type]
strategy:
fail-fast: true
matrix:
os: ["ubuntu-latest"]
python-version: [3.9]
runs-on: ${{ matrix.os }}
steps:
#------------------------------------------------
# ----- checkout repo and set-up python -----
#------------------------------------------------
- name: Check out repository
uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
#--------------------------------------------------------------
# ----- install dependencies -----
#--------------------------------------------------------------]
- uses: actions/checkout@v3
- name: Install poetry
run: pip install poetry
- name: Install dependencies
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: "poetry"
- run: poetry config virtualenvs.in-project false && poetry install
#--------------------------------------
# -------- run test suite ---------
#--------------------------------------
- name: Run tests
run: |
poetry run pytest -m 'not integration'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment