Skip to content

Commit

Permalink
Template migration (GSI-380) (#8)
Browse files Browse the repository at this point in the history
* Update template files

Make minor changes according to pre-commit results

* Update the readme

* Quiet mypy

---------

Co-authored-by: TheByronHimes <TheByronHimes@gmail.com>
  • Loading branch information
TheByronHimes and TheByronHimes authored Oct 11, 2023
1 parent 8af81c2 commit 996a1f2
Show file tree
Hide file tree
Showing 56 changed files with 2,299 additions and 828 deletions.
5 changes: 5 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[paths]
source =
src
/workspace/src
**/lib/python*/site-packages
7 changes: 7 additions & 0 deletions .deprecated_files
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,15 @@

.github/workflows/check_mandatory_and_static_files.yaml
.github/workflows/dev_cd.yaml
.github/workflows/unit_and_int_tests.yaml

scripts/check_mandatory_and_static_files.py
scripts/update_static_files.py

docs

setup.py
setup.cfg

.pylintrc
.flake8
8 changes: 4 additions & 4 deletions .devcontainer/dev_install
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ cd /workspace
# upgrade pip
python -m pip install --upgrade pip

# install with all extras in editable mode
pip install -e .[all]

# install or upgrade dependencies for development and testing
pip install -r requirements-dev.txt
pip install --no-deps -r requirements-dev.txt

# install the package itself in edit mode:
pip install --no-deps -e .

# install pre-commit hooks to git
pre-commit install
21 changes: 0 additions & 21 deletions .flake8

This file was deleted.

5 changes: 3 additions & 2 deletions .github/workflows/cd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ name: CD

on:
release:
types: [published]
types:
[published]
# trigger only on new release

jobs:
Expand Down Expand Up @@ -44,7 +45,7 @@ jobs:
name: Verify package version vs tag version
# package version must be same with tag version
run: |
PKG_VER="$(python setup.py --version)"
PKG_VER="$(grep -oP 'version = "\K[^"]+' pyproject.toml)"
echo "Package version is $PKG_VER" >&2
echo "Tag version is ${{ steps.get_version_tag.outputs.version }}" >&2
if [ "$PKG_VER" != "${{ steps.get_version_tag.outputs.version }}" ]; then
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/check_config_docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
- uses: actions/checkout@v3

- id: common
uses: ghga-de/gh-action-common@v2
uses: ghga-de/gh-action-common@v3

- name: Check config docs
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/check_readme.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
- uses: actions/checkout@v3

- id: common
uses: ghga-de/gh-action-common@v2
uses: ghga-de/gh-action-common@v3

- name: Check readme
run: |
Expand Down
16 changes: 3 additions & 13 deletions .github/workflows/static_code_analysis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,29 +10,19 @@ jobs:
- uses: actions/checkout@v3

- id: common
uses: ghga-de/gh-action-common@v2
uses: ghga-de/gh-action-common@v3

- uses: pre-commit/action@v3.0.0
env:
SKIP: no-commit-to-branch
- name: ruff
uses: chartboost/ruff-action@v1
- name: black
run: |
black --check .
- name: isort
run: |
isort --check --profile black .
- name: mypy
run: |
mypy .
- name: pylint
run: |
pylint "${{ steps.common.outputs.MAIN_SRC_DIR }}"
- name: flake8
run: |
flake8 --config .flake8
- name: bandit
run: |
bandit -r "${{ steps.common.outputs.MAIN_SRC_DIR }}"
- name: Check license header and file
run: |
./scripts/license_checker.py
Original file line number Diff line number Diff line change
@@ -1,24 +1,26 @@
name: Unit and Integration Tests
name: Tests

on: push

jobs:
unit_and_int_tests:
tests:
runs-on: ubuntu-latest
name: Unit and Integration Tests
name: Tests

steps:
- uses: actions/checkout@v3

- id: common
uses: ghga-de/gh-action-common@v2
uses: ghga-de/gh-action-common@v3

- name: Run pytest
- id: pytest
run: |
export ${{ steps.common.outputs.CONFIG_YAML_ENV_VAR_NAME }}="${{ steps.common.outputs.CONFIG_YAML }}"
pytest \
--cov="${{ steps.common.outputs.MAIN_SRC_DIR }}" \
--cov-report=xml
--cov="${{ steps.common.outputs.PACKAGE_NAME }}" \
--cov-report=xml \
tests
- id: coveralls
name: Upload coverage to coveralls
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ coverage.xml
*.py,cover
.hypothesis/
.pytest_cache/
.ruff_cache/
prof/

# Translations
Expand Down
6 changes: 4 additions & 2 deletions .mandatory_files
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,12 @@ Dockerfile
config_schema.json
example_config.yaml
LICENSE
pyproject.toml
README.md
setup.py
setup.cfg
requirements-dev.in
requirements-dev.txt
requirements.txt

.description.md
.design.md
.pre-commit-config.yaml
44 changes: 21 additions & 23 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,20 @@ default_language_version:
minimum_pre_commit_version: 3.0.0

repos:
- repo: local
hooks:
- id: update-hook-revs
name: "ensure hooks are up to date"
language: python
additional_dependencies:
- "packaging"
- "typer"
fail_fast: true
always_run: true
entry: ./scripts/update_hook_revs.py
files: '\.pre-commit-config.yaml'
args: [--check]
pass_filenames: false
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
Expand Down Expand Up @@ -36,33 +50,17 @@ repos:
- id: debug-statements
- id: debug-statements
- id: debug-statements
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.0.292
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
- repo: https://github.com/psf/black
rev: 23.1.0
rev: 23.9.1
hooks:
- id: black
- repo: https://github.com/pycqa/isort
rev: 5.12.0
hooks:
- id: isort
args: [--profile, black]
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.0.0
rev: v1.5.1
hooks:
- id: mypy
args: [--no-warn-unused-ignores]
- repo: https://github.com/PyCQA/pylint
rev: v2.16.4
hooks:
- id: pylint
args: [--disable=E0401]
exclude: tests|.devcontainer
- repo: https://github.com/PyCQA/flake8
rev: 6.0.0
hooks:
- id: flake8
args: [--config, .flake8]
- repo: https://github.com/PyCQA/bandit
rev: 1.7.4
hooks:
- id: bandit
exclude: tests|.devcontainer|scripts
Loading

0 comments on commit 996a1f2

Please sign in to comment.