forked from ansible-collections/community.aws
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add sanity, linters, changelog and units workflows
Signed-off-by: Alina Buzachis <[email protected]>
- Loading branch information
1 parent
2c4575c
commit c4c9656
Showing
8 changed files
with
266 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
--- | ||
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 | ||
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: | ||
- 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'}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
--- | ||
name: 'Python formatting linter (Black)' | ||
|
||
on: | ||
workflow_dispatch: | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
permissions: | ||
contents: read | ||
pull-requests: read | ||
|
||
# This allows a subsequently queued workflow run to interrupt previous runs | ||
concurrency: | ||
group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}' | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
check-black: | ||
runs-on: ${{ fromJSON('["ubuntu-latest", "self-hosted"]')[github.repository == 'github/docs-internal'] }} | ||
steps: | ||
- name: Checkout the collection repository | ||
uses: actions/checkout@v3 | ||
with: | ||
path: ${{ env.source_directory }} | ||
ref: ${{ github.event.pull_request.head.sha }} | ||
fetch-depth: "0" | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: ${{ inputs.python }} | ||
|
||
- name: Read collection metadata from galaxy.yml | ||
id: identify | ||
uses: ansible-network/github_actions/.github/actions/identify_collection@main | ||
with: | ||
source_path: ${{ env.source_directory }} | ||
|
||
- name: Build and install the collection | ||
uses: ansible-network/github_actions/.github/actions/build_install_collection@main | ||
with: | ||
install_python_dependencies: false | ||
source_path: ${{ env.source_directory }} | ||
collection_path: ${{ steps.identify.outputs.collection_path }} | ||
tar_file: ${{ steps.identify.outputs.tar_file }} | ||
|
||
- name: Install black | ||
run: pip install black | ||
|
||
- name: Run black | ||
run: | | ||
black -v --check --diff . | ||
working-directory: ${{ steps.identify.outputs.collection_path }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- | ||
name: changelog | ||
|
||
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: abikouo/github_actions/.github/workflows/tox-linters.yml@tox_linters |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
--- | ||
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" | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
--- | ||
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" | ||
} | ||
] | ||
collection_pre_install: '' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
[tox] | ||
minversion = 1.4.2 | ||
skipsdist = True | ||
|
||
[testenv:black_check] | ||
deps = | ||
black >=23.0, <24.0 | ||
|
||
commands = | ||
black -v --check --diff {toxinidir}/plugins {toxinidir}/tests | ||
|
||
[testenv:black] | ||
deps = | ||
{[testenv:black_check]deps} | ||
|
||
commands = | ||
black -v {posargs:{toxinidir}/plugins {toxinidir}/tests} | ||
|
||
[testenv:linters] | ||
deps = | ||
yamllint | ||
flake8 | ||
{[testenv:black_check]deps} | ||
|
||
commands = | ||
{[testenv:black_check]commands} | ||
yamllint -s {toxinidir} | ||
flake8 {toxinidir} |