Skip to content

Commit

Permalink
reload the repository
Browse files Browse the repository at this point in the history
  • Loading branch information
Zaharia Constantin committed Apr 20, 2022
1 parent d4350c5 commit 4816a26
Show file tree
Hide file tree
Showing 129 changed files with 12,613 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[flake8]
ignore = W503
max-line-length = 99
exclude = .git, .github, .eggs, __pycache__, build, dist, notebooks, .ipynb_checkpoints, logs
per-file-ignores = __init__.py:F401
48 changes: 48 additions & 0 deletions .github/workflows/on-merge-to-main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
on:
push:
branches:
- main
tags-ignore:
- '**'

name: merge-to-main

jobs:
quality:
runs-on: ubuntu-latest
steps:

- name: Check out
uses: actions/checkout@v2

- name: Set up the environment
uses: ./.github/workflows/setup-poetry-env

- name: Run checks
uses: ./.github/workflows/run-checks

- name: Documentation Test
run: |
source .venv/bin/activate
make docs-test
tox:
runs-on: ubuntu-latest
needs: quality
strategy:
matrix:
python-version: ['3.10']
steps:

- name: Check out
uses: actions/checkout@v2

- name: Set up the environment
uses: ./.github/workflows/setup-poetry-env
with:
python-version: ${{ matrix.python-version }}

- name: Test with tox
run: |
source .venv/bin/activate
poetry add tox-gh-actions
tox
45 changes: 45 additions & 0 deletions .github/workflows/on-pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
on:
pull_request:
types: [opened, synchronize, reopened]

name: on-pull-request

jobs:
quality:
runs-on: ubuntu-latest
steps:

- name: Check out
uses: actions/checkout@v2

- name: Set up the environment
uses: ./.github/workflows/setup-poetry-env

- name: Run checks
uses: ./.github/workflows/run-checks

- name: Documentation Test
run: |
source .venv/bin/activate
make docs-test
tox:
runs-on: ubuntu-latest
needs: quality
strategy:
matrix:
python-version: ['3.10']
steps:

- name: Check out
uses: actions/checkout@v2

- name: Set up the environment
uses: ./.github/workflows/setup-poetry-env
with:
python-version: ${{ matrix.python-version }}

- name: Test with tox
run: |
source .venv/bin/activate
poetry add tox-gh-actions
tox
84 changes: 84 additions & 0 deletions .github/workflows/on-release-main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
on:
release:
types: [published]
branches: [main]

name: release-main

jobs:
quality:
runs-on: ubuntu-latest
steps:

- name: Check out
uses: actions/checkout@v2

- name: Set up the environment
uses: ./.github/workflows/setup-poetry-env

- name: Run checks
uses: ./.github/workflows/run-checks

- name: Documentation Test
run: |
source .venv/bin/activate
make docs-test
tox:
runs-on: ubuntu-latest
needs: quality
strategy:
matrix:
python-version: ['3.10']
steps:
- name: Check out
uses: actions/checkout@v2

- name: Set up the environment
uses: ./.github/workflows/setup-poetry-env
with:
python-version: ${{ matrix.python-version }}

- name: Test with tox
run: |
source .venv/bin/activate
poetry add tox-gh-actions
tox
publish:
runs-on: ubuntu-latest
needs: tox
steps:

- name: Check out
uses: actions/checkout@v2

- name: Set up the environment
uses: ./.github/workflows/setup-poetry-env

- name: Set output
id: vars
run: echo ::set-output name=tag::${GITHUB_REF#refs/*/}

- name: Build and publish
run: |
source .venv/bin/activate
poetry version $RELEASE_VERSION
make build-and-publish
env:
PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
RELEASE_VERSION: ${{ steps.vars.outputs.tag }}

documentation:
runs-on: ubuntu-latest
needs: publish
steps:

- name: Check out
uses: actions/checkout@v2

- name: Set up the environment
uses: ./.github/workflows/setup-poetry-env

- name: Generate documentation
run: |
source .venv/bin/activate
mkdocs gh-deploy --force
18 changes: 18 additions & 0 deletions .github/workflows/run-checks/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@

name: 'run-checks'
description: 'Composite action to run checks for code formatting and to run the unittests.'
runs:
using: 'composite'
steps:

- name: Formatting check
run: |
source .venv/bin/activate
make lint
shell: bash

- name: Test with pytest
run: |
source .venv/bin/activate
make test
shell: bash
57 changes: 57 additions & 0 deletions .github/workflows/setup-poetry-env/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@

name: "setup-poetry-env"
description: "Composite action to setup the Python and poetry environment."
inputs:
python-version:
required: false
description: "The python version to use"
default: 3.10.4
runs:
using: "composite"
steps:
#----------------------------------------------
# from: https://github.com/snok/install-poetry
# check-out repo and set-up python
#----------------------------------------------
- name: Check out repository
uses: actions/checkout@v2
- name: Set up python
uses: actions/setup-python@v2
with:
python-version: ${{ inputs.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 venv if cache exists
#----------------------------------------------
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v2
with:
path: .venv
key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}

#----------------------------------------------
# install dependencies if cache does not exist
#----------------------------------------------
- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction --no-root
shell: bash
#----------------------------------------------
# install your root project, if required
#----------------------------------------------
- name: Install library
run: poetry install --no-interaction
shell: bash
- name: Activate environment
run: source .venv/bin/activate
shell: bash
Loading

0 comments on commit 4816a26

Please sign in to comment.