diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-03-28 06:11:39 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-03-28 06:11:39 +0000 |
commit | 1fd6a618b60d7168fd8f37585d5d39d22d775afd (patch) | |
tree | fbc6d0c213b8acdd0a31deafe5c5fc0d05a3a312 /.github/workflows/code-testing.yml | |
parent | Initial commit. (diff) | |
download | anta-1fd6a618b60d7168fd8f37585d5d39d22d775afd.tar.xz anta-1fd6a618b60d7168fd8f37585d5d39d22d775afd.zip |
Adding upstream version 0.13.0.upstream/0.13.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '.github/workflows/code-testing.yml')
-rw-r--r-- | .github/workflows/code-testing.yml | 144 |
1 files changed, 144 insertions, 0 deletions
diff --git a/.github/workflows/code-testing.yml b/.github/workflows/code-testing.yml new file mode 100644 index 0000000..4d4c0a6 --- /dev/null +++ b/.github/workflows/code-testing.yml @@ -0,0 +1,144 @@ +--- +name: Linting and Testing Anta +on: + push: + branches: + - main + pull_request: + +jobs: + file-changes: + runs-on: ubuntu-latest + outputs: + code: ${{ steps.filter.outputs.code }} + docs: ${{ steps.filter.outputs.docs }} + steps: + - uses: actions/checkout@v4 + - uses: dorny/paths-filter@v3 + id: filter + with: + filters: | + code: + - 'anta/*' + - 'anta/**' + - 'tests/*' + - 'tests/**' + core: + - 'anta/*' + - 'anta/reporter/*' + - 'anta/result_manager/*' + - 'anta/tools/*' + cli: + - 'anta/cli/*' + - 'anta/cli/**' + tests: + - 'anta/tests/*' + - 'anta/tests/**' + docs: + - '.github/workflows/pull-request-management.yml' + - 'mkdocs.yml' + - 'docs/*' + - 'docs/**' + - 'README.md' + check-requirements: + runs-on: ubuntu-20.04 + strategy: + matrix: + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] + needs: file-changes + steps: + - uses: actions/checkout@v4 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + - name: install requirements + run: | + pip install . + - name: install dev requirements + run: pip install .[dev] + missing-documentation: + name: "Warning documentation is missing" + runs-on: ubuntu-20.04 + needs: [file-changes] + if: needs.file-changes.outputs.cli == 'true' && needs.file-changes.outputs.docs == 'false' + steps: + - name: Documentation is missing + uses: GrantBirki/comment@v2.0.9 + with: + body: | + Please consider that documentation is missing under `docs/` folder. + You should update documentation to reflect your change, or maybe not :) + lint-yaml: + name: Run linting for yaml files + runs-on: ubuntu-20.04 + needs: [file-changes, check-requirements] + if: needs.file-changes.outputs.code == 'true' + steps: + - uses: actions/checkout@v4 + - name: yaml-lint + uses: ibiqlik/action-yamllint@v3 + with: + config_file: .yamllint.yml + file_or_dir: . + lint-python: + name: Run isort, black, flake8 and pylint + runs-on: ubuntu-20.04 + needs: file-changes + if: needs.file-changes.outputs.code == 'true' + steps: + - uses: actions/checkout@v4 + - name: Setup Python + uses: actions/setup-python@v5 + with: + python-version: "3.11" + - name: Install dependencies + run: pip install tox + - name: "Run tox linting environment" + run: tox -e lint + type-python: + name: Run mypy + runs-on: ubuntu-20.04 + needs: file-changes + if: needs.file-changes.outputs.code == 'true' + steps: + - uses: actions/checkout@v4 + - name: Setup Python + uses: actions/setup-python@v5 + with: + python-version: "3.11" + - name: Install dependencies + run: pip install tox + - name: "Run tox typing environment" + run: tox -e type + test-python: + name: Pytest across all supported python versions + runs-on: ubuntu-20.04 + needs: [lint-python, type-python] + strategy: + matrix: + python: ["3.8", "3.9", "3.10", "3.11", "3.12"] + steps: + - uses: actions/checkout@v4 + - name: Setup Python + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python }} + - name: Install dependencies + run: pip install tox tox-gh-actions + - name: "Run pytest via tox for ${{ matrix.python }}" + run: tox + test-documentation: + name: Build offline documentation for testing + runs-on: ubuntu-20.04 + needs: [lint-python, type-python, test-python] + steps: + - uses: actions/checkout@v4 + - name: Setup Python + uses: actions/setup-python@v5 + with: + python-version: "3.11" + - name: Install dependencies + run: pip install .[doc] + - name: "Build mkdocs documentation offline" + run: mkdocs build |