Skip to content

feat: Upgrade deps and re arrange poe tasks #20

feat: Upgrade deps and re arrange poe tasks

feat: Upgrade deps and re arrange poe tasks #20

Workflow file for this run

####################################################################################################
# Continuous Integration [Lint, Test, Build] on All Pull-Requests + Push to Master
####################################################################################################
# References:
# - https://github.com/snok/install-poetry
# - https://github.com/actions/setup-python#caching-packages-dependencies
# - https://stackoverflow.com/questions/62977821/how-to-cache-poetry-install-for-github-actions
# - https://github.com/codecov/codecov-action
####################################################################################################
name: build
on:
push:
branches: ["master"]
pull_request:
jobs:
ci:
#----------------------------------------------
# ----- setup operating system (os) -----
#----------------------------------------------
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
# TODO(amir): add "ubuntu-latest", "windows-latest"
os: ["macos-latest"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
steps:
#----------------------------------------------
# ----- check-out repo and set-up python -----
#----------------------------------------------
- name: Checkout Repository
uses: actions/checkout@v3
- name: Setup Python v${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
#----------------------------------------------
# ----- install & configure poetry -----
#----------------------------------------------
- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
#----------------------------------------------
# ----- load cached dependencies -----
#----------------------------------------------
- name: Load Cached venv
id: cached-poetry-dependencies
uses: actions/cache@v3
with:
path: .venv
key: venv-${{ runner.os }}-v${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock') }}
#----------------------------------------------
# ----- install dependencies -----
#----------------------------------------------
- name: Install Dependencies
run: poetry install -vv
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
#----------------------------------------------
# ----- Integration test suite -----
#----------------------------------------------
# TODO(amir): de-dup the `source .venv/bin/activate` (`source $VENV`) command
- name: Lint
run: |
source $VENV
poe check
- name: Test
run: |
source $VENV
poe test
- name: Build
run: |
source $VENV
poetry build
#----------------------------------------------
# --- Upload test coverage to Codecov ---
#----------------------------------------------
- name: Codecov
# NOTE: only run code coverage with one Python Version and OS; the rest is not needed
if: ${{ matrix.python-version == '3.9' && matrix.os == 'macos-latest' }}
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
directory: ./xmlcov/
fail_ci_if_error: true
files: ./xmlcov/coverage.xml
flags: unittests
name: codecov-umbrella
verbose: true