diff --git a/.github/workflows/build-and-check-python-package.yml b/.github/workflows/build-and-check-python-package.yml
new file mode 100644
index 00000000..d7c13509
--- /dev/null
+++ b/.github/workflows/build-and-check-python-package.yml
@@ -0,0 +1,137 @@
+---
+name: build-and-check-python-package
+
+
+on:
+ workflow_call:
+ inputs:
+ path:
+ description: Where to look for the Python package to inspect.
+ required: false
+ type: string
+ default: .
+ outputs:
+ dist:
+ description: The location of the built packages.
+ value: ${{ jobs.build-package.outputs.dist }}
+
+
+jobs:
+ build-package:
+ name: Build and Verify package
+ runs-on: ubuntu-latest
+ outputs:
+ dist: ${{ steps.setter.outputs.dist }}
+
+ steps:
+ - uses: actions/checkout@v4
+ with:
+ fetch-depth: 0
+
+ - name: Set up Python
+ uses: actions/setup-python@v5
+ id: python-bavp
+ with:
+ python-version: '3.10'
+
+ - name: Create venv for tools
+ run: ${{ steps.python-bavp.outputs.python-path }} -Im venv /tmp/bavp
+ shell: bash
+
+ - name: Install dependencies
+ run: >
+ /tmp/bavp/bin/python
+ -Im pip
+ --disable-pip-version-check
+ --no-python-version-warning
+ install build check-wheel-contents==0.6.0 twine==5.1.1 wheel==0.42.0 wheel-filename==1.4.1
+ shell: bash
+
+ - name: Build package
+ run: |
+ SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct)
+ /tmp/bavp/bin/python -m build --outdir /tmp/bavp/dist
+ shell: bash
+ working-directory: ${{ inputs.path }}
+
+ - name: Set output
+ id: setter
+ run: echo "dist=/tmp/bavp/dist" >>$GITHUB_OUTPUT
+ shell: bash
+ working-directory: ${{ inputs.path }}
+
+ - run: ls -l /tmp/bavp/dist
+ shell: bash
+ working-directory: ${{ inputs.path }}
+
+ - name: Upload built artifacts.
+ uses: actions/upload-artifact@v4
+ with:
+ name: Packages
+ path: /tmp/bavp/dist/*
+
+ - run: /tmp/bavp/bin/check-wheel-contents /tmp/bavp/dist/*.whl
+ shell: bash
+ working-directory: ${{ inputs.path }}
+
+ - name: Check PyPI README
+ shell: bash
+ working-directory: ${{ inputs.path }}
+ run: >
+ /tmp/bavp/bin/python
+ -m twine check
+ --strict
+ /tmp/bavp/dist/*
+
+ - name: Show wheel and SDist contents hierarchically, including metadata.
+ shell: bash
+ working-directory: ${{ inputs.path }}
+ run: |
+ cd /tmp/bavp/dist
+ mkdir -p out/sdist
+ mkdir -p out/wheels
+ /tmp/bavp/bin/python -m wheel unpack --dest out/wheels *.whl
+ tar xf *.tar.gz -C out/sdist
+
+ echo -e '\nSDist contents
\n' >> $GITHUB_STEP_SUMMARY
+ (cd /tmp/bavp/dist/out/sdist && tree -Da --timefmt="%Y-%m-%dT%H:%M:%SZ" * | sed 's/^/ /' | tee -a $GITHUB_STEP_SUMMARY)
+ echo -e '\n \n' >> $GITHUB_STEP_SUMMARY
+
+ echo -e '\nWheel contents
\n' >> $GITHUB_STEP_SUMMARY
+ (cd /tmp/bavp/dist/out/wheels && tree -Da --timefmt="%Y-%m-%dT%H:%M:%SZ" * | sed 's/^/ /' | tee -a $GITHUB_STEP_SUMMARY)
+ echo -e '\n \n' >> $GITHUB_STEP_SUMMARY
+
+ echo ----- Metadata Follows -----
+ echo -e '\nMetadata
\n' >> $GITHUB_STEP_SUMMARY
+ cat out/sdist/*/PKG-INFO | sed 's/^/ /' | tee -a $GITHUB_STEP_SUMMARY
+ echo -e '\n \n' >> $GITHUB_STEP_SUMMARY
+ echo ----- End of Metadata -----
+
+ - name: Upload metadata
+ uses: actions/upload-artifact@v4
+ with:
+ name: Package Metadata
+ path: /tmp/bavp/dist/out/sdist/*/PKG-INFO
+
+ - name: Extract PyPI README
+ shell: bash
+ working-directory: /tmp/bavp/dist/out/sdist/
+ run: |
+ cat */PKG-INFO | python -c '
+ import email.parser
+ import sys
+
+ em = email.parser.Parser().parsestr(sys.stdin.read())
+ suffix = {
+ "text/markdown": "md",
+ "text/x-rst": "rst",
+ }[em["Description-Content-Type"]]
+ with open(f"PyPI-README.{suffix}", "w") as f:
+ f.write(em.get_payload())
+ '
+
+ - name: Upload PyPI README
+ uses: actions/upload-artifact@v4
+ with:
+ name: PyPI README
+ path: /tmp/bavp/dist/out/sdist/PyPI-README.*
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
new file mode 100644
index 00000000..419a680c
--- /dev/null
+++ b/.github/workflows/ci.yml
@@ -0,0 +1,103 @@
+name: ci-for-build-and-tests
+
+on:
+ # push:
+ # branches: [ "feature/ci_implement_tests" ]
+ pull_request:
+ branches: [ "main", "develop" ]
+
+jobs:
+ build-package:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v4
+ - name: Check modified files in cli directory
+ id: check_cli_files
+ shell: bash
+ run: |
+ pwd
+ ls -la
+ git fetch origin develop
+ changed_files=$(git diff --name-only develop)
+ echo "Changed files: ${changed_files}"
+ checked_directory="cli/"
+ for file in ${changed_files}
+ do
+ if [[ ${file} == ${checked_directory}* ]]
+ then
+ echo "Target directory was modified."
+ echo "changes_found=true" >>$GITHUB_OUTPUT
+ exit 0
+ fi
+ done
+ echo "Target directory was not modified."
+ echo "changes_found=false" >>$GITHUB_OUTPUT
+ echo "dist=/tmp/bavp/dist" >>$GITHUB_OUTPUT
+ - name: Build
+ uses: ./.github/workflows/build-and-check-python-package.yml
+ if: steps.check_cli_files.outputs.changes_found == 'true'
+ with:
+ path: ./cli
+
+ tests:
+ needs: build-package
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v4
+
+ - name: Set up Python 3.10
+ uses: actions/setup-python@v5
+ with:
+ python-version: '3.10'
+
+ - name: Check modified files
+ id: check_src_files
+ shell: bash
+ run: |
+ git fetch origin ${{ github.pull_request_target }}
+ changed_files=$(git diff --name-only prigin/${{ github.pull_request_target }})
+ echo "Changed files: ${changed_files}"
+ checked_directory="src/"
+ for file in ${changed_files}
+ do
+ if [[ ${file} == ${checked_directory}* ]]
+ then
+ echo "Target directory was modified."
+ echo "changes_found=true" >>$GITHUB_OUTPUT
+ exit 0
+ fi
+ done
+ echo "Target directory was not modified."
+ echo "changes_found=false" >>$GITHUB_OUTPUT
+ echo "dist=/tmp/bavp/dist" >>$GITHUB_OUTPUT
+
+ - name: Setup test env
+ if: steps.check_src_files.outputs.changes_found == 'true'
+ run: |
+ python -VV
+ pip install virtualenv
+ virtualenv .venv
+ source .venv/bin/activate
+ pip --cache-dir=.cache/pip --quiet install tox
+
+ - name: tests
+ if: steps.check_src_files.outputs.changes_found == 'true'
+ run: |
+ source .venv/bin/activate
+ tox -e py310
+
+ - name: Upload coverage report
+ if: steps.check_src_files.outputs.changes_found == 'true'
+ uses: actions/upload-artifact@v4
+ with:
+ name: coverage-report
+ path: coverage.xml
+ retention-days: 1
+
+ - name: Upload test report
+ if: steps.check_src_files.outputs.changes_found == 'true'
+ uses: actions/upload-artifact@v4
+ with:
+ name: test-report
+ path: report.xml
+ retention-days: 1
diff --git a/tox.ini b/tox.ini
index 5e117fc2..03a5b003 100644
--- a/tox.ini
+++ b/tox.ini
@@ -28,61 +28,3 @@ deps =
basepython = python3.10
commands =
pytest -v {posargs} tests/ --cov=src/ --cov-report term-missing --cov-report xml:coverage.xml --junitxml=report.xml
-
-
-[testenv:lint]
-extras =
- docs
- pics
- test_data
-deps =
- mypy
- flake8
-commands =
- flake8
- mypy src/onprem docker/ src/handlers tests/
-
-[flake8]
-exclude = setup.py,.git,.venv*,venv,python2.7,.tox,scripts,pics,docs,build,report_commands_to_tables_script
-; W291 trailing whitespace
-; E501 line too long
-; W504 line break after binary operator
-; W503 line break before binary operator
-; E251 unexpected spaces around keyword / parameter equals
-; W605 invalid escape sequence '\/'
-; E741 ambiguous variable name 'l'
-; E126 continuation line over-indented for hanging indent
-; E127 continuation line over-indented for visual indent
-; F811 redefinition of unused # remove when mobile-team synchronize its part after our renaming of parameters in commands
-; F841 local variable '_LOG' is assigned to but never used
-; E121 continuation line under-indented for hanging indent
-ignore = W291,W503,W504,E251,W605,E741,E126,E127,F811,E501,F841, E121
-max-line-length = 82
-
-
-[testenv:pylint]
-deps =
- pylint
-commands =
- pylint --rcfile=tox.ini {toxinidir}/src {toxinidir}/scripts {toxinidir}/c7n {toxinidir}/docker
-
-[MESSAGES CONTROL]
-; C0111 Missing docstring
-; I0011: Locally disabling %s
-; I0012: Locally enabling %s
-; W0704 Except doesn't do anything Used when an except clause does nothing but "pass" and there is no "else" clause
-; W0142 Used * or * magic* Used when a function or method is called using *args or **kwargs to dispatch arguments.
-; W0212 Access to a protected member %s of a client class
-; W0232 Class has no __init__ method Used when a class has no __init__ method, neither its parent classes.
-; W0613 Unused argument %r Used when a function or method argument is not used.
-; W0702 No exception's type specified Used when an except clause doesn't specify exceptions type to catch.
-; R0201 Method could be a function
-; W0614 Unused import XYZ from wildcard import
-; R0903 Too few public methods
-; R0904 Too many public methods
-; R0914 Too many local variables
-; R0912 Too many branches
-; R0915 Too many statements
-; R0913 Too many arguments
-; R0923: Interface not implemented
-disable=I0011,I0012,C0111,W0142,R