From 2588cf3d500da6443247ea549b6a052d78a310e0 Mon Sep 17 00:00:00 2001 From: Alina Buzachis Date: Tue, 23 May 2023 16:46:55 +0200 Subject: [PATCH 1/4] Add github workflow Manually merged (.github/) --- .github/workflows/all_green_check.yml | 42 ++++++++++++ .github/workflows/ansible-bot.yml | 17 ----- .github/workflows/changelog_and_linters.yml | 10 +++ .github/workflows/sanity.yml | 68 +++++++++++++++++++ .github/workflows/units.yml | 68 +++++++++++++++++++ .github/workflows/update-variables.yml | 2 +- .../20230704-add_github_workflow.yml | 2 + tox.ini | 2 +- 8 files changed, 192 insertions(+), 19 deletions(-) create mode 100644 .github/workflows/all_green_check.yml delete mode 100644 .github/workflows/ansible-bot.yml create mode 100644 .github/workflows/changelog_and_linters.yml create mode 100644 .github/workflows/sanity.yml create mode 100644 .github/workflows/units.yml create mode 100644 changelogs/fragments/20230704-add_github_workflow.yml diff --git a/.github/workflows/all_green_check.yml b/.github/workflows/all_green_check.yml new file mode 100644 index 00000000000..5ea5cc71220 --- /dev/null +++ b/.github/workflows/all_green_check.yml @@ -0,0 +1,42 @@ +--- +name: all_green + +concurrency: + group: ${{ github.head_ref }} + cancel-in-progress: true + +on: # yamllint disable-line rule:truthy + pull_request: + types: + - opened + - reopened + - labeled + - unlabeled + - synchronize + branches: + - main + - 'stable-*' + tags: + - '*' + +jobs: + changelog-and-linters: + uses: ./.github/workflows/changelog_and_linters.yml # use the callable changelog-and-linters job to run tests + sanity: + uses: ./.github/workflows/sanity.yml # use the callable sanity job to run tests + units: + uses: ./.github/workflows/units.yml # use the callable units job to run tests + all_green: + if: ${{ always() }} + needs: + - changelog-and-linters + - sanity + - units + runs-on: ubuntu-latest + steps: + - run: >- + python -c "assert set([ + '${{ needs.changelog-and-linters.result }}', + '${{ needs.sanity.result }}', + '${{ needs.units.result }}' + ]) == {'success'}" diff --git a/.github/workflows/ansible-bot.yml b/.github/workflows/ansible-bot.yml deleted file mode 100644 index 23da46607f7..00000000000 --- a/.github/workflows/ansible-bot.yml +++ /dev/null @@ -1,17 +0,0 @@ -name: ansible bot -on: - issues: - types: - - opened - - reopened - -jobs: - add_label: - runs-on: ubuntu-latest - permissions: - contents: write - issues: write - steps: - - uses: actions-ecosystem/action-add-labels@v1 - with: - labels: needs_triage \ No newline at end of file diff --git a/.github/workflows/changelog_and_linters.yml b/.github/workflows/changelog_and_linters.yml new file mode 100644 index 00000000000..ddd891ea294 --- /dev/null +++ b/.github/workflows/changelog_and_linters.yml @@ -0,0 +1,10 @@ +--- +name: changelog and linters + +on: [workflow_call] # allow this workflow to be called from other workflows + +jobs: + changelog: + uses: ansible-network/github_actions/.github/workflows/changelog.yml@main + linters: + uses: ansible-network/github_actions/.github/workflows/tox-linters.yml@main diff --git a/.github/workflows/sanity.yml b/.github/workflows/sanity.yml new file mode 100644 index 00000000000..c7ebf34c431 --- /dev/null +++ b/.github/workflows/sanity.yml @@ -0,0 +1,68 @@ +--- +name: sanity tests + +on: [workflow_call] # allow this workflow to be called from other workflows + +jobs: + sanity: + uses: ansible-network/github_actions/.github/workflows/sanity.yml@main + with: + matrix_include: "[]" + matrix_exclude: >- + [ + { + "ansible-version": "stable-2.9" + }, + { + "ansible-version": "stable-2.12", + "python-version": "3.7" + }, + { + "ansible-version": "stable-2.12", + "python-version": "3.11" + }, + { + "ansible-version": "stable-2.13", + "python-version": "3.7" + }, + { + "ansible-version": "stable-2.13", + "python-version": "3.11" + }, + { + "ansible-version": "stable-2.14", + "python-version": "3.7" + }, + { + "ansible-version": "stable-2.14", + "python-version": "3.8" + }, + { + "ansible-version": "stable-2.15", + "python-version": "3.7" + }, + { + "ansible-version": "stable-2.15", + "python-version": "3.8" + }, + { + "ansible-version": "milestone", + "python-version": "3.7" + }, + { + "ansible-version": "milestone", + "python-version": "3.8" + }, + { + "ansible-version": "devel", + "python-version": "3.7" + }, + { + "ansible-version": "devel", + "python-version": "3.8" + }, + { + "ansible-version": "devel", + "python-version": "3.9" + } + ] diff --git a/.github/workflows/units.yml b/.github/workflows/units.yml new file mode 100644 index 00000000000..adfa2dddd1f --- /dev/null +++ b/.github/workflows/units.yml @@ -0,0 +1,68 @@ +--- +name: unit tests + +on: [workflow_call] # allow this workflow to be called from other workflows + +jobs: + unit-source: + uses: ansible-network/github_actions/.github/workflows/unit_source.yml@main + with: + matrix_exclude: >- + [ + { + "python-version": "3.11" + }, + { + "ansible-version": "stable-2.12", + "python-version": "3.7" + }, + { + "ansible-version": "stable-2.13", + "python-version": "3.7" + }, + { + "ansible-version": "stable-2.12", + "python-version": "3.8" + }, + { + "ansible-version": "stable-2.13", + "python-version": "3.8" + }, + { + "ansible-version": "stable-2.14", + "python-version": "3.7" + }, + { + "ansible-version": "stable-2.14", + "python-version": "3.8" + }, + { + "ansible-version": "stable-2.15", + "python-version": "3.7" + }, + { + "ansible-version": "stable-2.15", + "python-version": "3.8" + }, + { + "ansible-version": "milestone", + "python-version": "3.7" + }, + { + "ansible-version": "milestone", + "python-version": "3.8" + }, + { + "ansible-version": "devel", + "python-version": "3.7" + }, + { + "ansible-version": "devel", + "python-version": "3.8" + }, + { + "ansible-version": "devel", + "python-version": "3.9" + } + ] + collection_pre_install: '' diff --git a/.github/workflows/update-variables.yml b/.github/workflows/update-variables.yml index 4c9103bed20..f92f77cc6e8 100644 --- a/.github/workflows/update-variables.yml +++ b/.github/workflows/update-variables.yml @@ -14,4 +14,4 @@ on: jobs: update-variables: - uses: abikouo/github_actions/.github/workflows/update_aws_variables.yml@automate_aws_user_agent_variable \ No newline at end of file + uses: ansible-network/github_actions/.github/workflows/update_aws_variables.yml@main diff --git a/changelogs/fragments/20230704-add_github_workflow.yml b/changelogs/fragments/20230704-add_github_workflow.yml new file mode 100644 index 00000000000..0dea59f9134 --- /dev/null +++ b/changelogs/fragments/20230704-add_github_workflow.yml @@ -0,0 +1,2 @@ +trivial: + - "Add sanity, units and linters and changelog GitHub workflows." diff --git a/tox.ini b/tox.ini index e88e5811750..265a442c2a0 100644 --- a/tox.ini +++ b/tox.ini @@ -24,7 +24,7 @@ commands = coverage erase description = Generate a HTML complexity report in the complexity directory deps = # See: https://github.com/lordmauve/flake8-html/issues/30 - flake8>=3.3.0,<5.0.0' + flake8>=3.3.0,<5.0.0 flake8-html commands = -flake8 --select C90 --max-complexity 10 --format=html --htmldir={posargs:complexity} plugins From 7029d205e130ea67027d5270b6cb95a96bba52f7 Mon Sep 17 00:00:00 2001 From: Alina Buzachis Date: Mon, 31 Jul 2023 17:50:20 +0200 Subject: [PATCH 2/4] Update exclude targets Signed-off-by: Alina Buzachis --- .github/workflows/sanity.yml | 44 ------------------------------------ .github/workflows/units.yml | 20 ---------------- 2 files changed, 64 deletions(-) diff --git a/.github/workflows/sanity.yml b/.github/workflows/sanity.yml index c7ebf34c431..f00cd230a31 100644 --- a/.github/workflows/sanity.yml +++ b/.github/workflows/sanity.yml @@ -20,49 +20,5 @@ jobs: { "ansible-version": "stable-2.12", "python-version": "3.11" - }, - { - "ansible-version": "stable-2.13", - "python-version": "3.7" - }, - { - "ansible-version": "stable-2.13", - "python-version": "3.11" - }, - { - "ansible-version": "stable-2.14", - "python-version": "3.7" - }, - { - "ansible-version": "stable-2.14", - "python-version": "3.8" - }, - { - "ansible-version": "stable-2.15", - "python-version": "3.7" - }, - { - "ansible-version": "stable-2.15", - "python-version": "3.8" - }, - { - "ansible-version": "milestone", - "python-version": "3.7" - }, - { - "ansible-version": "milestone", - "python-version": "3.8" - }, - { - "ansible-version": "devel", - "python-version": "3.7" - }, - { - "ansible-version": "devel", - "python-version": "3.8" - }, - { - "ansible-version": "devel", - "python-version": "3.9" } ] diff --git a/.github/workflows/units.yml b/.github/workflows/units.yml index adfa2dddd1f..c5d3993e08d 100644 --- a/.github/workflows/units.yml +++ b/.github/workflows/units.yml @@ -32,37 +32,17 @@ jobs: "ansible-version": "stable-2.14", "python-version": "3.7" }, - { - "ansible-version": "stable-2.14", - "python-version": "3.8" - }, { "ansible-version": "stable-2.15", "python-version": "3.7" }, - { - "ansible-version": "stable-2.15", - "python-version": "3.8" - }, { "ansible-version": "milestone", "python-version": "3.7" }, - { - "ansible-version": "milestone", - "python-version": "3.8" - }, { "ansible-version": "devel", "python-version": "3.7" - }, - { - "ansible-version": "devel", - "python-version": "3.8" - }, - { - "ansible-version": "devel", - "python-version": "3.9" } ] collection_pre_install: '' From 796bb09f709e95340c6c9f9ee4dc976920892f3e Mon Sep 17 00:00:00 2001 From: Alina Buzachis Date: Mon, 31 Jul 2023 18:08:28 +0200 Subject: [PATCH 3/4] Update worflows Signed-off-by: Alina Buzachis --- .github/workflows/sanity.yml | 48 ++++++++++++++++++++++++++++++++++++ .github/workflows/units.yml | 40 ------------------------------ 2 files changed, 48 insertions(+), 40 deletions(-) diff --git a/.github/workflows/sanity.yml b/.github/workflows/sanity.yml index f00cd230a31..f9e4b0b78ca 100644 --- a/.github/workflows/sanity.yml +++ b/.github/workflows/sanity.yml @@ -20,5 +20,53 @@ jobs: { "ansible-version": "stable-2.12", "python-version": "3.11" + }, + { + "ansible-version": "stable-2.13", + "python-version": "3.7" + }, + { + "ansible-version": "stable-2.13", + "python-version": "3.11" + }, + { + "ansible-version": "stable-2.14", + "python-version": "3.7" + }, + { + "ansible-version": "stable-2.14", + "python-version": "3.8" + }, + { + "ansible-version": "stable-2.15", + "python-version": "3.7" + }, + { + "ansible-version": "stable-2.15", + "python-version": "3.8" + }, + { + "ansible-version": "milestone", + "python-version": "3.7" + }, + { + "ansible-version": "milestone", + "python-version": "3.8" + }, + { + "ansible-version": "milestone", + "python-version": "3.9" + }, + { + "ansible-version": "devel", + "python-version": "3.7" + }, + { + "ansible-version": "devel", + "python-version": "3.8" + }, + { + "ansible-version": "devel", + "python-version": "3.9" } ] diff --git a/.github/workflows/units.yml b/.github/workflows/units.yml index c5d3993e08d..d05d8c10294 100644 --- a/.github/workflows/units.yml +++ b/.github/workflows/units.yml @@ -6,43 +6,3 @@ on: [workflow_call] # allow this workflow to be called from other workflows jobs: unit-source: uses: ansible-network/github_actions/.github/workflows/unit_source.yml@main - with: - matrix_exclude: >- - [ - { - "python-version": "3.11" - }, - { - "ansible-version": "stable-2.12", - "python-version": "3.7" - }, - { - "ansible-version": "stable-2.13", - "python-version": "3.7" - }, - { - "ansible-version": "stable-2.12", - "python-version": "3.8" - }, - { - "ansible-version": "stable-2.13", - "python-version": "3.8" - }, - { - "ansible-version": "stable-2.14", - "python-version": "3.7" - }, - { - "ansible-version": "stable-2.15", - "python-version": "3.7" - }, - { - "ansible-version": "milestone", - "python-version": "3.7" - }, - { - "ansible-version": "devel", - "python-version": "3.7" - } - ] - collection_pre_install: '' From 1d17430e7f8ab831c7f8a8c7be11ed1fdc560fbd Mon Sep 17 00:00:00 2001 From: Alina Buzachis Date: Mon, 31 Jul 2023 18:30:49 +0200 Subject: [PATCH 4/4] Update test-requirements.txt Signed-off-by: Alina Buzachis --- test-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test-requirements.txt b/test-requirements.txt index abedede45fd..e7117dcef0c 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -8,7 +8,7 @@ pytest pytest-forked pytest-mock pytest-xdist -pytest-ansible-units ; python_version > '3.8' +pytest-ansible-units ; python_version >= '3.8' # Needed for ansible.utils.ipaddr in tests netaddr