ControlPlaneKubeletLocalMode-fix-1 #4026
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
name: Tests and Validations | |
on: | |
push: | |
branches: | |
- '**' | |
env: | |
COPYRIGHT_COMPANY: 'NetCracker Technology Corporation' | |
COPYRIGHT_YEAR: '2021-2023' | |
jobs: | |
license: | |
runs-on: ubuntu-latest | |
if: github.ref_name == 'main' || endsWith(github.ref_name, '_branch') | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
token: ${{ secrets.NCCLPLCI_PAT }} | |
- run: docker run -v "${PWD}:/src" -i ghcr.io/google/addlicense -v -c "${{ env.COPYRIGHT_COMPANY }}" -y "${{ env.COPYRIGHT_YEAR }}" $(find . -type f -name "*.py" | xargs echo) | |
- uses: stefanzweifel/git-auto-commit-action@v4 | |
with: | |
commit_message: Auto-update license header | |
unit-tests: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- run: docker build -t kubemarine --build-arg BUILD_TYPE=test --no-cache . | |
- run: docker run --entrypoint=python3 kubemarine -m unittest discover -s /opt/kubemarine/test/unit -t /opt/kubemarine/test/unit | |
coverage: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: "3.12" | |
# Install coverage and kubemarine with all dependencies except ansible. | |
# Then uninstall only kubemarine to avoid ambiguity and to surely run coverage on sources. | |
- run: pip install coverage . && pip uninstall -y kubemarine | |
- run: coverage run -m unittest discover -s test/unit -t test/unit; coverage report -m | |
linter: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: "3.12" | |
# Install pylint and kubemarine with all dependencies except ansible. | |
# Then uninstall only kubemarine to avoid ambiguity and to surely run pylint on sources. | |
- run: pip install .[pylint] && pip install -r requirements-pyinstaller.txt && pip uninstall -y kubemarine | |
- run: | | |
if ! pylint kubemarine scripts test ; then | |
echo -e "\033[91mCheck [tool.pylint.main] in pyproject.toml for how to fix pylint check\033[0m" | |
exit 1 | |
fi | |
radon: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: "3.12" | |
- run: pip install radon xenon | |
# Use `radon cc {paths} -a` locally for full report per function | |
# xenon checks, if radon absolute result is A | |
- run: | | |
radon cc kubemarine scripts -a | |
xenon -a A kubemarine scripts | |
mypy: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: | |
- "3.8" | |
- "3.9" | |
- "3.10" | |
- "3.11" | |
- "3.12" | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
# Install kubemarine with all dependencies except ansible but including mypy and library stubs. | |
# Then uninstall only kubemarine to avoid ambiguity and to surely run mypy on sources. | |
- run: pip install .[mypy] && pip uninstall -y kubemarine | |
- run: mypy |