Skip to content

Commit

Permalink
Add black and github workflow rework
Browse files Browse the repository at this point in the history
Signed-off-by: Alina Buzachis <[email protected]>
  • Loading branch information
alinabuzachis committed May 2, 2023
1 parent 7ae909b commit 3014e3f
Show file tree
Hide file tree
Showing 10 changed files with 236 additions and 53 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/all_green_check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
---
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:
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:
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.result }}',
'${{ needs.sanity.result }}',
'${{ needs.linters.result }}',
'${{ needs.units.result }}'
]) == {'success'}"
2 changes: 1 addition & 1 deletion .github/workflows/ansible-bot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ jobs:
steps:
- uses: actions-ecosystem/action-add-labels@v1
with:
labels: needs_triage
labels: needs_triage
17 changes: 17 additions & 0 deletions .github/workflows/black.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
name: black

concurrency:
group: '${{ github.workflow }} @ ${{ github.sha }}'
cancel-in-progress: true

on:
push:
branches:
- main
- 'stable-*'
pull_request_target:

jobs:
format:
uses: abikouo/github_actions/.github/workflows/black.yml@automate_changes_a
8 changes: 8 additions & 0 deletions .github/workflows/changelog.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
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
10 changes: 10 additions & 0 deletions .github/workflows/changelog_and_linters.yml
Original file line number Diff line number Diff line change
@@ -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: abikouo/github_actions/.github/workflows/tox-linters.yml@tox_linters
50 changes: 0 additions & 50 deletions .github/workflows/darker-pr.yml

This file was deleted.

64 changes: 64 additions & 0 deletions .github/workflows/sanity.yml
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"
}
]
64 changes: 64 additions & 0 deletions .github/workflows/units.yml
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: ''
2 changes: 1 addition & 1 deletion .github/workflows/update-variables.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ on:

jobs:
update-variables:
uses: abikouo/github_actions/.github/workflows/update_aws_variables.yml@automate_aws_user_agent_variable
uses: abikouo/github_actions/.github/workflows/update_aws_variables.yml@automate_aws_user_agent_variable
27 changes: 26 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,31 @@ 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

[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}

0 comments on commit 3014e3f

Please sign in to comment.