Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stable-6] Add github workflows (sanity, units, linters and changelog) #1672

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions .github/workflows/all_green_check.yml
Original file line number Diff line number Diff line change
@@ -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
Comment on lines +13 to +14
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this triggers are impacting changelog workflow only, we should create a different file for that and all_green does not need to changelog being success as this will fail automatically
anyway we can keep it like that as it is already like this in the main branch

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Once this is merged, if you want, you can open a PR against main and backport to stable-6 and stable-5 this way we ensure consistency between branches.

- 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'}"
17 changes: 0 additions & 17 deletions .github/workflows/ansible-bot.yml

This file was deleted.

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: ansible-network/github_actions/.github/workflows/tox-linters.yml@main
68 changes: 68 additions & 0 deletions .github/workflows/sanity.yml
Original file line number Diff line number Diff line change
@@ -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"
}
]
68 changes: 68 additions & 0 deletions .github/workflows/units.yml
Original file line number Diff line number Diff line change
@@ -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: >-
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we actually need this anymore? It seems like we should be able to just use the default excludes.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried to add the only ones non listed https://github.com/ansible-network/github_actions/blob/main/.github/workflows/unit_source.yml and https://github.com/ansible-network/github_actions/blob/main/.github/workflows/sanity.yml. Correct me if I am wrong. I will prepare a PR for the other branches too.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change won't work because changes in this repo aren't merged with the defaults, they completely overwrite. What I'm suggesting is that we just don't provide a matrix_exclude at all for the unit test workflow and just use whatever that action defaults to. I don't think we can do the same yet for sanity because of ansible 2.9.

[
{
"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: ''
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: ansible-network/github_actions/.github/workflows/update_aws_variables.yml@main
2 changes: 2 additions & 0 deletions changelogs/fragments/20230704-add_github_workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
trivial:
- "Add sanity, units and linters and changelog GitHub workflows."
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Loading