summaryrefslogtreecommitdiffstats
path: root/.github/workflows
diff options
context:
space:
mode:
Diffstat (limited to '.github/workflows')
-rw-r--r--.github/workflows/code-testing.yml144
-rw-r--r--.github/workflows/main-doc.yml37
-rw-r--r--.github/workflows/on-demand.yml49
-rw-r--r--.github/workflows/pr-conflicts.yml18
-rw-r--r--.github/workflows/pr-triage.yml73
-rw-r--r--.github/workflows/pull-request-rn-labeler.yml27
-rw-r--r--.github/workflows/release.yml110
7 files changed, 458 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
diff --git a/.github/workflows/main-doc.yml b/.github/workflows/main-doc.yml
new file mode 100644
index 0000000..0d46fa9
--- /dev/null
+++ b/.github/workflows/main-doc.yml
@@ -0,0 +1,37 @@
+---
+# This is deploying the latest commits on main to main documentation
+name: Mkdocs
+on:
+ push:
+ branches:
+ - main
+ paths:
+ # Run only if any of the following paths are changed when pushing to main
+ # May need to update this
+ - "docs/**"
+ - "mkdocs.yml"
+ workflow_dispatch:
+
+jobs:
+ 'build_latest_doc':
+ name: 'Update Public main documentation'
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v4
+ with:
+ fetch-depth: 0
+
+ - name: 'Setup Python 3 on runner'
+ uses: actions/setup-python@v5
+ with:
+ python-version: '3.x'
+
+ - name: Setup Git config
+ run: |
+ git config --global user.name 'github-actions[bot]'
+ git config --global user.email 'github-actions[bot]@users.noreply.github.com'
+
+ - name: 'Build mkdocs content and deploy to gh-pages to main'
+ run: |
+ pip install .[doc]
+ mike deploy --push main
diff --git a/.github/workflows/on-demand.yml b/.github/workflows/on-demand.yml
new file mode 100644
index 0000000..85e7c41
--- /dev/null
+++ b/.github/workflows/on-demand.yml
@@ -0,0 +1,49 @@
+name: 'Build docker on-demand'
+on:
+ workflow_dispatch:
+ inputs:
+ tag:
+ description: 'docker container tag'
+ required: true
+ type: string
+ default: 'dev'
+
+jobs:
+ docker:
+ name: Docker Image Build
+ runs-on: ubuntu-latest
+ strategy:
+ matrix:
+ platform:
+ - linux/amd64
+ - linux/arm64
+ - linux/arm/v7
+ - linux/arm/v8
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v4
+
+ - name: Docker meta for TAG
+ id: meta
+ uses: docker/metadata-action@v5
+ with:
+ images: ghcr.io/${{ github.repository }}
+ tags: |
+ type=raw,value=${{ inputs.tag }}
+
+ - name: Login to GitHub Container Registry
+ uses: docker/login-action@v3
+ with:
+ registry: ghcr.io
+ username: ${{ github.actor }}
+ password: ${{ secrets.GITHUB_TOKEN }}
+
+ - name: Build and push
+ uses: docker/build-push-action@v5
+ with:
+ context: .
+ file: Dockerfile
+ push: true
+ platforms: linux/amd64
+ tags: ${{ steps.meta.outputs.tags }}
+ labels: ${{ steps.meta.outputs.labels }}
diff --git a/.github/workflows/pr-conflicts.yml b/.github/workflows/pr-conflicts.yml
new file mode 100644
index 0000000..a126268
--- /dev/null
+++ b/.github/workflows/pr-conflicts.yml
@@ -0,0 +1,18 @@
+name: "PR Conflicts checker"
+on:
+ pull_request_target:
+ types: [synchronize]
+
+jobs:
+ Conflict_Check:
+ name: 'Check PR status: conflicts and resolution'
+ runs-on: ubuntu-latest
+ steps:
+ - name: check if PRs are dirty
+ uses: eps1lon/actions-label-merge-conflict@releases/2.x
+ with:
+ dirtyLabel: "state: conflict"
+ removeOnDirtyLabel: "state: conflict resolved"
+ repoToken: "${{ secrets.GITHUB_TOKEN }}"
+ commentOnDirty: "This pull request has conflicts, please resolve those before we can evaluate the pull request."
+ commentOnClean: "Conflicts have been resolved. A maintainer will review the pull request shortly."
diff --git a/.github/workflows/pr-triage.yml b/.github/workflows/pr-triage.yml
new file mode 100644
index 0000000..d60937d
--- /dev/null
+++ b/.github/workflows/pr-triage.yml
@@ -0,0 +1,73 @@
+name: "Pull Request Triage"
+
+on:
+ pull_request_target:
+ types:
+ - opened
+ - edited
+ - synchronize
+
+jobs:
+ assign_author:
+ name: "Assign Author to PR"
+ # https://github.com/marketplace/actions/auto-author-assign
+ runs-on: ubuntu-latest
+ steps:
+ - uses: toshimaru/auto-author-assign@v2.1.0
+ with:
+ repo-token: "${{ secrets.GITHUB_TOKEN }}"
+
+ check_pr_semantic:
+ runs-on: ubuntu-latest
+ steps:
+ # Please look up the latest version from
+ # https://github.com/amannn/action-semantic-pull-request/releases
+ - uses: amannn/action-semantic-pull-request@v5.4.0
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ with:
+ # Configure which types are allowed.
+ # Default: https://github.com/commitizen/conventional-commit-types
+ # Updated as part of PR 1930
+ types: |
+ feat
+ fix
+ cut
+ doc
+ ci
+ bump
+ test
+ refactor
+ revert
+ make
+ chore
+ # Configure which scopes are allowed.
+ scopes: |
+ anta
+ anta.tests
+ anta.cli
+ # Configure that a scope must always be provided.
+ requireScope: false
+ # Configure additional validation for the subject based on a regex.
+ # This example ensures the subject doesn't start with an uppercase character.
+ # subjectPattern: ^(?![A-Z]).+$
+ # If `subjectPattern` is configured, you can use this property to override
+ # the default error message that is shown when the pattern doesn't match.
+ # The variables `subject` and `title` can be used within the message.
+ subjectPatternError: |
+ The subject "{subject}" found in the pull request title "{title}"
+ didn't match the configured pattern. Please ensure that the subject
+ doesn't start with an uppercase character.
+ # When using "Squash and merge" on a PR with only one commit, GitHub
+ # will suggest using that commit message instead of the PR title for the
+ # merge commit, and it's easy to commit this by mistake. Enable this option
+ # to also validate the commit message for one commit PRs.
+ # Update 13-Jul-2022 CH: GitHub now offers a toggle for this behavior.
+ # We have set that to always use the PR title, so this check is no longer needed.
+ validateSingleCommit: false
+ # Related to `validateSingleCommit` you can opt-in to validate that the PR
+ # title matches a single commit to avoid confusion.
+ validateSingleCommitMatchesPrTitle: true
+ ignoreLabels: |
+ bot
+ ignore-semantic-pull-request
diff --git a/.github/workflows/pull-request-rn-labeler.yml b/.github/workflows/pull-request-rn-labeler.yml
new file mode 100644
index 0000000..39da881
--- /dev/null
+++ b/.github/workflows/pull-request-rn-labeler.yml
@@ -0,0 +1,27 @@
+# This workflow is triggered after a PR is merged or when the title of a PR is
+# changed post merge
+name: "Label for Release Notes"
+
+
+on:
+ pull_request_target:
+ types:
+ - closed
+ - edited # interested in post merge title changes
+
+jobs:
+ ###################################################
+ # Assign labels on merge to generate Release Notes
+ # https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#running-your-workflow-when-a-pull-request-merges
+ ###################################################
+ if_merged:
+ name: "PR was merged"
+ if: (github.event.pull_request.merged == true) && ( github.event.action == 'closed' || (github.event.action == 'edited' && github.event.changes.title != null) )
+ runs-on: ubuntu-latest
+ env:
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ steps:
+ - uses: actions/checkout@v4
+ - uses: ./.github/actions/rn-pr-labeler-action
+ with:
+ auto_create_label: true
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
new file mode 100644
index 0000000..6b9088f
--- /dev/null
+++ b/.github/workflows/release.yml
@@ -0,0 +1,110 @@
+---
+name: "Tag & Release management"
+on:
+ release:
+ types:
+ - published
+
+jobs:
+ pypi:
+ name: Publish version to Pypi servers
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout code
+ uses: actions/checkout@v4
+ - name: Install dependencies
+ run: |
+ python -m pip install --upgrade pip
+ pip install setuptools wheel build
+ - name: Build package
+ run: |
+ python -m build
+ - name: Publish package to Pypi
+ uses: pypa/gh-action-pypi-publish@release/v1
+ with:
+ user: __token__
+ password: ${{ secrets.PYPI_API_TOKEN }}
+
+ release-coverage:
+ name: Updated ANTA release coverage badge
+ runs-on: ubuntu-20.04
+ needs: [pypi]
+ steps:
+ - uses: actions/checkout@v4
+ - name: Setup Python
+ uses: actions/setup-python@v5
+ with:
+ python-version: "3.11"
+ - name: Install dependencies
+ run: pip install genbadge[coverage] tox tox-gh-actions
+ - name: "Run pytest via tox for ${{ matrix.python }}"
+ run: tox
+ - name: Generate coverage badge
+ run: genbadge coverage -i .coverage.xml -o badge/latest-release-coverage.svg
+ - name: Publish coverage badge to gh-pages branch
+ uses: JamesIves/github-pages-deploy-action@v4
+ with:
+ branch: coverage-badge
+ folder: badge
+ release-doc:
+ name: "Publish documentation for release ${{github.ref_name}}"
+ runs-on: ubuntu-latest
+ needs: [release-coverage]
+ steps:
+ - uses: actions/checkout@v4
+ with:
+ fetch-depth: 0
+ - name: 'Setup Python 3 on runner'
+ uses: actions/setup-python@v5
+ with:
+ python-version: '3.x'
+ - name: Setup Git config
+ run: |
+ git config --global user.name 'github-actions[bot]'
+ git config --global user.email 'github-actions[bot]@users.noreply.github.com'
+
+ - name: 'Build mkdocs content to site folder'
+ run: |
+ pip install .[doc]
+ mike deploy --update-alias --push ${{github.ref_name}} stable
+
+ docker:
+ name: Docker Image Build
+ runs-on: ubuntu-latest
+ needs: [pypi]
+ strategy:
+ matrix:
+ platform:
+ - linux/amd64
+ - linux/arm64
+ - linux/arm/v7
+ - linux/arm/v8
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v4
+
+ - name: Docker meta for TAG
+ id: meta
+ uses: docker/metadata-action@v5
+ with:
+ images: ghcr.io/${{ github.repository }}
+ tags: |
+ type=semver,pattern={{version}}
+ type=raw,value=latest
+
+ - name: Login to GitHub Container Registry
+ uses: docker/login-action@v3
+ with:
+ registry: ghcr.io
+ username: ${{ github.actor }}
+ password: ${{ secrets.GITHUB_TOKEN }}
+
+ - name: Build and push
+ uses: docker/build-push-action@v5
+ with:
+ context: .
+ file: Dockerfile
+ push: true
+ platforms: linux/amd64
+ tags: ${{ steps.meta.outputs.tags }}
+ labels: ${{ steps.meta.outputs.labels }}