Skip to content

Commit

Permalink
Applying latest changes on aieng-template (#6)
Browse files Browse the repository at this point in the history
Applying latest changes from aieng-template, which includes Ruff for python checks, pip-audit and documentation.
  • Loading branch information
lotif authored Feb 29, 2024
1 parent 927405b commit ee09c97
Show file tree
Hide file tree
Showing 35 changed files with 2,576 additions and 361 deletions.
3 changes: 0 additions & 3 deletions .flake8

This file was deleted.

45 changes: 45 additions & 0 deletions .github/workflows/docs_build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: docs (build)

on:
pull_request:
branches:
- main
paths:
- .pre-commit-config.yaml
- .github/workflows/docs_build.yml
- '**.py'
- '**.ipynb'
- poetry.lock
- pyproject.toml
- '**.rst'
- '**.md'

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- name: Install dependencies, build docs and coverage report
run: python3 -m pip install --upgrade pip && python3 -m pip install poetry
- uses: actions/[email protected]
with:
python-version: '3.9'
cache: 'poetry'
- run: |
python3 -m pip install --upgrade pip && python3 -m pip install poetry
poetry env use '3.9'
source $(poetry env info --path)/bin/activate
poetry install --with docs,test
cd docs && rm -rf source/reference/api/_autosummary && make html
cd .. && coverage run -m pytest -m "not integration_test" && coverage xml && coverage report -m
# - name: Upload coverage to Codecov
# uses: Wandalen/[email protected]
# with:
# action: codecov/[email protected]
# with: |
# token: ${{ secrets.CODECOV_TOKEN }}
# file: ./coverage.xml
# name: codecov-umbrella
# fail_ci_if_error: true
# attempt_limit: 5
# attempt_delay: 30000
55 changes: 55 additions & 0 deletions .github/workflows/docs_deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: docs

on:
push:
branches:
- main
paths:
- .pre-commit-config.yaml
- .github/workflows/static_code_checks.yml
- .github/workflows/docs_build.yml
- .github/workflows/docs_deploy.yml
- .github/workflows/tests.yml
- '**.py'
- '**.ipynb'
- poetry.lock
- pyproject.toml
- '**.rst'
- '**.md'

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
with:
submodules: 'true'
- name: Install dependencies, build docs and coverage report
run: python3 -m pip install --upgrade pip && python3 -m pip install poetry
- uses: actions/[email protected]
with:
python-version: '3.9'
cache: 'poetry'
- run: |
python3 -m pip install --upgrade pip && python3 -m pip install poetry
poetry env use '3.9'
source $(poetry env info --path)/bin/activate
poetry install --with docs,test
cd docs && rm -rf source/reference/api/_autosummary && make html
cd .. && coverage run -m pytest -m "not integration_test" && coverage xml && coverage report -m
# - name: Upload coverage to Codecov
# uses: Wandalen/[email protected]
# with:
# action: codecov/[email protected]
# with: |
# token: ${{ secrets.CODECOV_TOKEN }}
# file: ./coverage.xml
# name: codecov-umbrella
# fail_ci_if_error: true
# attempt_limit: 5
# attempt_delay: 30000
- name: Deploy to Github pages
uses: JamesIves/[email protected]
with:
branch: github_pages
folder: docs/build/html
61 changes: 61 additions & 0 deletions .github/workflows/integration_tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: tests

on:
push:
branches:
- main
paths:
- .pre-commit-config.yaml
- .github/workflows/static_code_checks.yml
- .github/workflows/docs_build.yml
- .github/workflows/docs_deploy.yml
- .github/workflows/tests.yml
- '**.py'
- '**.ipynb'
- poetry.lock
- pyproject.toml
- '**.rst'
- '**.md'
pull_request:
branches:
- main
paths:
- .pre-commit-config.yaml
- .github/workflows/static_code_checks.yml
- .github/workflows/docs_build.yml
- .github/workflows/docs_deploy.yml
- .github/workflows/tests.yml
- '**.py'
- '**.ipynb'
- poetry.lock
- pyproject.toml
- '**.rst'
- '**.md'

jobs:
python-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- name: Install poetry
run: python3 -m pip install --upgrade pip && python3 -m pip install poetry
- uses: actions/[email protected]
with:
python-version: '3.9'
- name: Install dependencies and check code
run: |
poetry env use '3.9'
source $(poetry env info --path)/bin/activate
poetry install --with docs,test
coverage run -m pytest florist/tests/integration && coverage xml && coverage report -m
# - name: Upload coverage to Codecov
# uses: Wandalen/[email protected]
# with:
# action: codecov/[email protected]
# with: |
# token: ${{ secrets.CODECOV_TOKEN }}
# file: ./coverage.xml
# name: codecov-umbrella
# fail_ci_if_error: true
# attempt_limit: 5
# attempt_delay: 30000
27 changes: 27 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: publish package

on:
release:
types: [published]

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Install apt dependencies
run: |
sudo apt-get update
sudo apt-get install libcurl4-openssl-dev libssl-dev
- uses: actions/[email protected]
- name: Install poetry
run: python3 -m pip install --upgrade pip && python3 -m pip install poetry
- uses: actions/[email protected]
with:
python-version: '3.9'
- name: Build package
run: poetry build
- name: Publish package
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
60 changes: 46 additions & 14 deletions .github/workflows/static_code_checks.yaml
Original file line number Diff line number Diff line change
@@ -1,26 +1,58 @@
# only has to pass for python 3.9
name: Static code checks
name: code checks

on:
push:
branches:
main
- main
paths:
- .pre-commit-config.yaml
- .github/workflows/code_checks.yml
- '**.py'
- poetry.lock
- pyproject.toml
- '**.ipynb'
pull_request:
branches:
main
- main
paths:
- .pre-commit-config.yaml
- .github/workflows/code_checks.yml
- '**.py'
- poetry.lock
- pyproject.toml
- '**.ipynb'

jobs:
run-code-check:
runs-on: ubuntu-latest
steps:

- name: Checkout code
uses: actions/checkout@v3

- name: Set up Python 3.9
uses: actions/setup-python@v3
- uses: actions/[email protected]
- name: Install and configure Poetry
uses: snok/install-poetry@v1
with:
python-version: 3.9

- name: precommit checker
uses: pre-commit/[email protected]
virtualenvs-create: true
virtualenvs-in-project: true
- uses: actions/[email protected]
with:
python-version: '3.9'
cache: 'poetry'
- name: Install dependencies and check code
run: |
poetry env use '3.9'
source .venv/bin/activate
poetry install --with test --all-extras
pre-commit run --all-files
- name: pip-audit (gh-action-pip-audit)
uses: pypa/[email protected]
with:
virtual-environment: .venv/
# Ignoring security vulnerabilities in Pillow because pycyclops cannot update it to the
# version that fixes them (>10.0.1).
# Remove those when the issue below is fixed and pycyclops changes its requirements:
# https://github.com/SeldonIO/alibi/issues/991
ignore-vulns: |
PYSEC-2023-175
PYSEC-2023-227
GHSA-j7hp-h8jx-5ppr
GHSA-56pw-mpj4-fxww
GHSA-3f63-hfp8-52jq
42 changes: 0 additions & 42 deletions .github/workflows/tests.yaml

This file was deleted.

61 changes: 61 additions & 0 deletions .github/workflows/unit_tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: tests

on:
push:
branches:
- main
paths:
- .pre-commit-config.yaml
- .github/workflows/static_code_checks.yml
- .github/workflows/docs_build.yml
- .github/workflows/docs_deploy.yml
- .github/workflows/tests.yml
- '**.py'
- '**.ipynb'
- poetry.lock
- pyproject.toml
- '**.rst'
- '**.md'
pull_request:
branches:
- main
paths:
- .pre-commit-config.yaml
- .github/workflows/static_code_checks.yml
- .github/workflows/docs_build.yml
- .github/workflows/docs_deploy.yml
- .github/workflows/tests.yml
- '**.py'
- '**.ipynb'
- poetry.lock
- pyproject.toml
- '**.rst'
- '**.md'

jobs:
python-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- name: Install poetry
run: python3 -m pip install --upgrade pip && python3 -m pip install poetry
- uses: actions/[email protected]
with:
python-version: '3.9'
- name: Install dependencies and check code
run: |
poetry env use '3.9'
source $(poetry env info --path)/bin/activate
poetry install --with docs,test
coverage run -m pytest florist/tests/unit && coverage xml && coverage report -m
# - name: Upload coverage to Codecov
# uses: Wandalen/[email protected]
# with:
# action: codecov/[email protected]
# with: |
# token: ${{ secrets.CODECOV_TOKEN }}
# file: ./coverage.xml
# name: codecov-umbrella
# fail_ci_if_error: true
# attempt_limit: 5
# attempt_delay: 30000
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -166,3 +166,5 @@ yarn-error.log*
*.tsbuildinfo
next-env.d.ts
/florist/tsconfig.json

/metrics/
Loading

0 comments on commit ee09c97

Please sign in to comment.