From bba001d1ad9ec5d30da79feb05cb8edc627095bb Mon Sep 17 00:00:00 2001 From: GomathiselviS Date: Fri, 20 Oct 2023 12:19:51 -0400 Subject: [PATCH 1/8] Divide github workflows for consistency --- .github/workflows/all_green_check.yml | 42 +++++++++++ .github/workflows/linters.yml | 7 ++ .../{unit_and_sanity.yml => sanity.yml} | 38 +--------- .github/workflows/units.yml | 71 +++++++++++++++++++ 4 files changed, 122 insertions(+), 36 deletions(-) create mode 100644 .github/workflows/all_green_check.yml create mode 100644 .github/workflows/linters.yml rename .github/workflows/{unit_and_sanity.yml => sanity.yml} (83%) create mode 100644 .github/workflows/units.yml diff --git a/.github/workflows/all_green_check.yml b/.github/workflows/all_green_check.yml new file mode 100644 index 00000000..e55aeadc --- /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: + linters: + uses: ./.github/workflows/linters.yml # use the callable 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: + - linters + - sanity + - units + runs-on: ubuntu-latest + steps: + - run: >- + python -c "assert set([ + '${{ needs.linters.result }}', + '${{ needs.sanity.result }}', + '${{ needs.units.result }}' + ]) == {'success'}" diff --git a/.github/workflows/linters.yml b/.github/workflows/linters.yml new file mode 100644 index 00000000..5c21acaf --- /dev/null +++ b/.github/workflows/linters.yml @@ -0,0 +1,7 @@ +name: linters + +on: [workflow_call] # allow this workflow to be called from other workflows + +jobs: + linters: + uses: ansible-network/github_actions/.github/workflows/tox-linters.yml@main diff --git a/.github/workflows/unit_and_sanity.yml b/.github/workflows/sanity.yml similarity index 83% rename from .github/workflows/unit_and_sanity.yml rename to .github/workflows/sanity.yml index 9787938a..678fbd7a 100644 --- a/.github/workflows/unit_and_sanity.yml +++ b/.github/workflows/sanity.yml @@ -1,26 +1,8 @@ -name: unit_and_sanity -concurrency: - group: ${{ github.head_ref }} - cancel-in-progress: true +name: sanity tests -on: - pull_request: - types: - - opened - - reopened - - labeled - - unlabeled - - synchronize - - closed - branches: - - main - - stable-* - tags: - - '*' +on: [workflow_call] # allow this workflow to be called from other workflows jobs: - linters: - uses: ansible-network/github_actions/.github/workflows/tox-linters.yml@main sanity: uses: ansible-network/github_actions/.github/workflows/sanity.yml@main with: @@ -161,19 +143,3 @@ jobs: } ] collection_pre_install: '' - all_green: - if: ${{ always() }} - needs: - - linters - - sanity - - unit-source - runs-on: ubuntu-latest - steps: - - run: >- - python -c "assert set([ - '${{ needs.linters.result }}', - '${{ needs.unit-source.result }}' - ]) == {'success'}" - - run: >- - python -c "assert '${{ needs.sanity.result }}' - in ['success', 'failure']" diff --git a/.github/workflows/units.yml b/.github/workflows/units.yml new file mode 100644 index 00000000..ed091cf9 --- /dev/null +++ b/.github/workflows/units.yml @@ -0,0 +1,71 @@ +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": "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" + } + ] + collection_pre_install: '' From a99371fddd08ccc44b282eebca315d2360428350 Mon Sep 17 00:00:00 2001 From: GomathiselviS Date: Fri, 20 Oct 2023 12:30:47 -0400 Subject: [PATCH 2/8] add changelog workflow to all_green --- .github/workflows/all_green_check.yml | 4 ++++ .github/workflows/changelog.yml | 17 +---------------- 2 files changed, 5 insertions(+), 16 deletions(-) diff --git a/.github/workflows/all_green_check.yml b/.github/workflows/all_green_check.yml index e55aeadc..9d6ed407 100644 --- a/.github/workflows/all_green_check.yml +++ b/.github/workflows/all_green_check.yml @@ -20,6 +20,8 @@ on: # yamllint disable-line rule:truthy - '*' jobs: + changelog: + uses: ./.github/workflows/changelog.yml # use the callable changelog job to run tests linters: uses: ./.github/workflows/linters.yml # use the callable linters job to run tests sanity: @@ -29,6 +31,7 @@ jobs: all_green: if: ${{ always() }} needs: + - changelog - linters - sanity - units @@ -36,6 +39,7 @@ jobs: steps: - run: >- python -c "assert set([ + '${{ needs.changelog.result }}', '${{ needs.linters.result }}', '${{ needs.sanity.result }}', '${{ needs.units.result }}' diff --git a/.github/workflows/changelog.yml b/.github/workflows/changelog.yml index 5478cd85..6d62f3eb 100644 --- a/.github/workflows/changelog.yml +++ b/.github/workflows/changelog.yml @@ -1,21 +1,6 @@ name: changelog -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true -on: - pull_request: - types: - - opened - - reopened - - labeled - - unlabeled - - synchronize - branches: - - main - - stable-* - tags: - - '*' +on: [workflow_call] # allow this workflow to be called from other workflows jobs: test: From f1cb3cf9bb950eafb23d05b7917833171168f363 Mon Sep 17 00:00:00 2001 From: GomathiselviS Date: Fri, 20 Oct 2023 14:48:01 -0400 Subject: [PATCH 3/8] Fix sanity workflow --- .github/workflows/sanity.yml | 65 ------------------------------------ 1 file changed, 65 deletions(-) diff --git a/.github/workflows/sanity.yml b/.github/workflows/sanity.yml index 678fbd7a..4910f5cc 100644 --- a/.github/workflows/sanity.yml +++ b/.github/workflows/sanity.yml @@ -77,69 +77,4 @@ jobs: "python-version": "3.9" } ] - 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": "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" - } - ] collection_pre_install: '' From f4fc821a2290f03928bedf945d0767a838188087 Mon Sep 17 00:00:00 2001 From: GomathiselviS Date: Fri, 20 Oct 2023 15:01:20 -0400 Subject: [PATCH 4/8] Fix sanity workflow --- .github/workflows/sanity.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/sanity.yml b/.github/workflows/sanity.yml index 4910f5cc..49802b7f 100644 --- a/.github/workflows/sanity.yml +++ b/.github/workflows/sanity.yml @@ -1,3 +1,4 @@ +--- name: sanity tests on: [workflow_call] # allow this workflow to be called from other workflows @@ -77,4 +78,3 @@ jobs: "python-version": "3.9" } ] - collection_pre_install: '' From e3d349200b2f31bb8b5f92ac43c812a0383e3d60 Mon Sep 17 00:00:00 2001 From: GomathiselviS Date: Fri, 20 Oct 2023 15:56:37 -0400 Subject: [PATCH 5/8] Fix sanity workflow --- .github/workflows/sanity.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/sanity.yml b/.github/workflows/sanity.yml index 49802b7f..11d130a3 100644 --- a/.github/workflows/sanity.yml +++ b/.github/workflows/sanity.yml @@ -64,7 +64,7 @@ jobs: { "ansible-version": "milestone", "python-version": "3.9" - } + }, { "ansible-version": "devel", "python-version": "3.7" From 118faa2f7dbd32863657299084653b14a7ed5760 Mon Sep 17 00:00:00 2001 From: GomathiselviS Date: Wed, 25 Oct 2023 11:13:14 -0400 Subject: [PATCH 6/8] Make changelog a separate workflow --- .github/workflows/all_green_check.yml | 4 ---- .github/workflows/changelog.yml | 17 ++++++++++++++++- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/.github/workflows/all_green_check.yml b/.github/workflows/all_green_check.yml index 9d6ed407..e55aeadc 100644 --- a/.github/workflows/all_green_check.yml +++ b/.github/workflows/all_green_check.yml @@ -20,8 +20,6 @@ on: # yamllint disable-line rule:truthy - '*' jobs: - changelog: - uses: ./.github/workflows/changelog.yml # use the callable changelog job to run tests linters: uses: ./.github/workflows/linters.yml # use the callable linters job to run tests sanity: @@ -31,7 +29,6 @@ jobs: all_green: if: ${{ always() }} needs: - - changelog - linters - sanity - units @@ -39,7 +36,6 @@ jobs: steps: - run: >- python -c "assert set([ - '${{ needs.changelog.result }}', '${{ needs.linters.result }}', '${{ needs.sanity.result }}', '${{ needs.units.result }}' diff --git a/.github/workflows/changelog.yml b/.github/workflows/changelog.yml index 6d62f3eb..e42d0a87 100644 --- a/.github/workflows/changelog.yml +++ b/.github/workflows/changelog.yml @@ -1,6 +1,21 @@ name: changelog +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true -on: [workflow_call] # allow this workflow to be called from other workflows +on: + pull_request: + types: + - opened + - reopened + - labeled + - unlabeled + - synchronize + branches: + - main + - stable-* + tags: + - '*' jobs: test: From db13b4d52f3c9a5bddab48ea103ef8c225c11add Mon Sep 17 00:00:00 2001 From: GomathiselviS Date: Wed, 25 Oct 2023 11:18:28 -0400 Subject: [PATCH 7/8] remove label and unlabel triggers for all_green --- .github/workflows/all_green_check.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/all_green_check.yml b/.github/workflows/all_green_check.yml index e55aeadc..f594c597 100644 --- a/.github/workflows/all_green_check.yml +++ b/.github/workflows/all_green_check.yml @@ -10,8 +10,6 @@ on: # yamllint disable-line rule:truthy types: - opened - reopened - - labeled - - unlabeled - synchronize branches: - main From e46da822ad9cfe4f7ffb0e55536eef14634593c1 Mon Sep 17 00:00:00 2001 From: GomathiselviS Date: Wed, 25 Oct 2023 11:19:56 -0400 Subject: [PATCH 8/8] remove label and unlabel triggers for all_green --- .github/workflows/changelog.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/changelog.yml b/.github/workflows/changelog.yml index e42d0a87..5478cd85 100644 --- a/.github/workflows/changelog.yml +++ b/.github/workflows/changelog.yml @@ -1,6 +1,6 @@ name: changelog concurrency: - group: ${{ github.workflow }}-${{ github.ref }} + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} cancel-in-progress: true on: