Prep fo release v0.3.0-beta #228
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#################################################################################################### | |
# 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: true | |
matrix: | |
# TODO(amir): enable `windows-latest` and fix possible `poetry` issues and glmnet | |
# TODO(amir): add `"3.12"` once the glmnet wheel is released | |
os: ["ubuntu-latest", "macos-latest"] | |
python-version: ["3.9", "3.10", "3.11"] | |
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 }}-${{ 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 greet | |
poe test | |
- name: Build | |
run: | | |
source $VENV | |
poe greet | |
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 == 'ubuntu-latest' }} | |
uses: codecov/[email protected] | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
directory: ./xmlcov/ | |
fail_ci_if_error: true | |
files: ./xmlcov/coverage.xml | |
flags: unittests | |
name: codecov-umbrella | |
verbose: true |