Skip to content

Commit

Permalink
Add GitHub Action specific files (#65)
Browse files Browse the repository at this point in the history
* add github action specific files

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* add yaml start

* fix tests

* add yaml starts

* fix test 2

* fix test 3

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* fix comment, test

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Nilashish Chakraborty <[email protected]>
  • Loading branch information
3 people authored Jan 16, 2024
1 parent 15ffaaa commit 8df21e1
Show file tree
Hide file tree
Showing 12 changed files with 77 additions and 18 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
name: Release {{ namespace }}.{{ collection_name }}
{% raw %}
on: # yamllint disable-line rule:truthy
release:
types: [published]

jobs:
release_automation_hub:
uses: ansible/ansible-content-actions/.github/workflows/release_galaxy.yaml@main
with:
environment: release
secrets:
ah_token: ${{ secrets.ANSIBLE_GALAXY_API_KEY }}
{%- endraw %}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
name: GHA for {{ namespace }}.{{ collection_name }}
{% raw %}
concurrency:
Expand All @@ -12,24 +13,25 @@ on: # yamllint disable-line rule:truthy
- cron: "0 0 * * *"

jobs:
ansible-lint:
uses: ansible-network/github_actions/.github/workflows/ansible-lint.yml@main
changelog:
uses: ansible-network/github_actions/.github/workflows/changelog.yml@main
integration:
uses: ansible-network/github_actions/.github/workflows/integration_simple.yml@main
uses: ansible/ansible-content-actions/.github/workflows/changelog.yaml@main
if: github.event_name == 'pull_request'
ansible-lint:
uses: ansible/ansible-content-actions/.github/workflows/ansible_lint.yaml@main
sanity:
uses: ansible-network/github_actions/.github/workflows/sanity.yml@main
uses: ansible/ansible-content-actions/.github/workflows/sanity.yaml@main
unit-galaxy:
uses: ansible-network/github_actions/.github/workflows/unit_galaxy.yml@main

uses: ansible/ansible-content-actions/.github/workflows/unit.yaml@main
integration:
uses: ansible/ansible-content-actions/.github/workflows/integration.yaml@main
all_green:
if: ${{ always() && (github.event_name != 'schedule') }}
needs:
- changelog
- integration
- sanity
- unit-galaxy
- ansible-lint
runs-on: ubuntu-latest
steps:
- run: >-
Expand All @@ -38,5 +40,6 @@ jobs:
'${{ needs.integration.result }}',
'${{ needs.sanity.result }}',
'${{ needs.unit-galaxy.result }}'
'${{ needs.ansible-lint.result }}'
]) == {'success'}"
{%- endraw %}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
changelog_filename_template: ../CHANGELOG.rst
changelog_filename_version_depth: 0
changes_file: changelog.yaml
Expand Down
1 change: 1 addition & 0 deletions src/ansible_creator/resources/new_collection/galaxy.yml.j2
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
# This collection is initialized by https://github.com/ansible-community/ansible-creator {{ creator_version }}

# See https://docs.ansible.com/ansible/latest/dev_guide/collections_galaxy_meta.html
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
requires_ansible: ">=2.13.0"
requires_ansible: ">=2.14.0"
10 changes: 10 additions & 0 deletions src/ansible_creator/resources/new_collection/tox-ansible.ini.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[ansible]

skip =
py3.7
py3.8
2.9
2.10
2.11
2.12
2.13
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
name: Release testorg.testcol

on: # yamllint disable-line rule:truthy
release:
types: [published]

jobs:
release_automation_hub:
uses: ansible/ansible-content-actions/.github/workflows/release_galaxy.yaml@main
with:
environment: release
secrets:
ah_token: ${{ secrets.ANSIBLE_GALAXY_API_KEY }}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
name: GHA for testorg.testcol

concurrency:
Expand All @@ -12,24 +13,25 @@ on: # yamllint disable-line rule:truthy
- cron: "0 0 * * *"

jobs:
ansible-lint:
uses: ansible-network/github_actions/.github/workflows/ansible-lint.yml@main
changelog:
uses: ansible-network/github_actions/.github/workflows/changelog.yml@main
integration:
uses: ansible-network/github_actions/.github/workflows/integration_simple.yml@main
uses: ansible/ansible-content-actions/.github/workflows/changelog.yaml@main
if: github.event_name == 'pull_request'
ansible-lint:
uses: ansible/ansible-content-actions/.github/workflows/ansible_lint.yaml@main
sanity:
uses: ansible-network/github_actions/.github/workflows/sanity.yml@main
uses: ansible/ansible-content-actions/.github/workflows/sanity.yaml@main
unit-galaxy:
uses: ansible-network/github_actions/.github/workflows/unit_galaxy.yml@main

uses: ansible/ansible-content-actions/.github/workflows/unit.yaml@main
integration:
uses: ansible/ansible-content-actions/.github/workflows/integration.yaml@main
all_green:
if: ${{ always() && (github.event_name != 'schedule') }}
needs:
- changelog
- integration
- sanity
- unit-galaxy
- ansible-lint
runs-on: ubuntu-latest
steps:
- run: >-
Expand All @@ -38,4 +40,5 @@ jobs:
'${{ needs.integration.result }}',
'${{ needs.sanity.result }}',
'${{ needs.unit-galaxy.result }}'
'${{ needs.ansible-lint.result }}'
]) == {'success'}"
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
changelog_filename_template: ../CHANGELOG.rst
changelog_filename_version_depth: 0
changes_file: changelog.yaml
Expand Down
1 change: 1 addition & 0 deletions tests/fixtures/collection/testorg/testcol/galaxy.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
# This collection is initialized by https://github.com/ansible-community/ansible-creator 0.0.1

# See https://docs.ansible.com/ansible/latest/dev_guide/collections_galaxy_meta.html
Expand Down
2 changes: 1 addition & 1 deletion tests/fixtures/collection/testorg/testcol/meta/runtime.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
requires_ansible: ">=2.13.0"
requires_ansible: ">=2.14.0"
10 changes: 10 additions & 0 deletions tests/fixtures/collection/testorg/testcol/tox-ansible.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[ansible]

skip =
py3.7
py3.8
2.9
2.10
2.11
2.12
2.13

0 comments on commit 8df21e1

Please sign in to comment.