From ef590dbc09719f4e557539d8465b2234891dbedd Mon Sep 17 00:00:00 2001 From: GomathiselviS Date: Wed, 15 May 2024 13:56:30 -0400 Subject: [PATCH] Use configure_ci tool to scaffold gh workflows --- .github/workflows/linters.yml | 20 +++++++++---- .github/workflows/sanity.yml | 8 ------ .../{all_green_check.yml => tests.yml} | 28 +++++++++---------- .github/workflows/units.yml | 8 ------ tox-ansible.ini | 14 ++++++++++ 5 files changed, 42 insertions(+), 36 deletions(-) delete mode 100644 .github/workflows/sanity.yml rename .github/workflows/{all_green_check.yml => tests.yml} (51%) delete mode 100644 .github/workflows/units.yml create mode 100644 tox-ansible.ini diff --git a/.github/workflows/linters.yml b/.github/workflows/linters.yml index 0bbf1025dc3..7ca301fd71b 100644 --- a/.github/workflows/linters.yml +++ b/.github/workflows/linters.yml @@ -1,11 +1,19 @@ --- -name: changelog and linters +name: Linters -on: [workflow_call] # allow this workflow to be called from other workflows +concurrency: + group: ${{ github.head_ref || github.run_id }} + cancel-in-progress: true +on: + push: + pull_request: jobs: linters: - uses: ansible-network/github_actions/.github/workflows/tox.yml@main - with: - envname: "" - labelname: lint + uses: ansible-network/github_actions/.github/workflows/tox-linters.yml@main + ansible-lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Run ansible-lint + uses: ansible/ansible-lint@v6.22.1 diff --git a/.github/workflows/sanity.yml b/.github/workflows/sanity.yml deleted file mode 100644 index d3d4e312089..00000000000 --- a/.github/workflows/sanity.yml +++ /dev/null @@ -1,8 +0,0 @@ ---- -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 diff --git a/.github/workflows/all_green_check.yml b/.github/workflows/tests.yml similarity index 51% rename from .github/workflows/all_green_check.yml rename to .github/workflows/tests.yml index 9f2a8347d61..8f628a7f692 100644 --- a/.github/workflows/all_green_check.yml +++ b/.github/workflows/tests.yml @@ -1,40 +1,40 @@ ---- -name: all_green - +name: CI concurrency: - group: ${{ github.head_ref }} + group: ${{ github.head_ref || github.run_id }} cancel-in-progress: true on: # yamllint disable-line rule:truthy pull_request: - types: - - opened - - reopened - - synchronize branches: - main - stable-* - tags: - - "*" + workflow_dispatch: jobs: linters: uses: ./.github/workflows/linters.yml # use the callable linters job to run tests + changelog: + uses: ansible/ansible-content-actions/.github/workflows/changelog.yaml@main + if: github.event_name == 'pull_request' sanity: - uses: ./.github/workflows/sanity.yml # use the callable sanity job to run tests + uses: ansible/ansible-content-actions/.github/workflows/sanity.yaml@main units: - uses: ./.github/workflows/units.yml # use the callable units job to run tests + uses: ansible-network/github_actions/.github/workflows/unit_source.yml@main + all_green: if: ${{ always() }} needs: - linters + - changelog - sanity - units runs-on: ubuntu-latest steps: - run: >- - python -c "assert set([ + python -c "assert 'failure' not in + set([ '${{ needs.linters.result }}', + '${{ needs.changelog.result }}', '${{ needs.sanity.result }}', '${{ needs.units.result }}' - ]) == {'success'}" + ])" diff --git a/.github/workflows/units.yml b/.github/workflows/units.yml deleted file mode 100644 index 4d8de6bb101..00000000000 --- a/.github/workflows/units.yml +++ /dev/null @@ -1,8 +0,0 @@ ---- -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 diff --git a/tox-ansible.ini b/tox-ansible.ini new file mode 100644 index 00000000000..f4ee11769e6 --- /dev/null +++ b/tox-ansible.ini @@ -0,0 +1,14 @@ +[ansible] + +skip = + py3.7 + py3.8 + 2.9 + 2.10 + 2.11 + 2.12 + 2.13 + 2.14 + +[testenv:sanity-{py3.10,py3.11,py3.12}-devel] +ignore_outcome = true