This repository has been archived by the owner on Nov 7, 2023. It is now read-only.
-
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.
- Loading branch information
1 parent
b1ec42c
commit bd7f259
Showing
24 changed files
with
1,096 additions
and
779 deletions.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
.github/scripts/test_precommit.sh → .github/scripts/job-50-test-precommit.sh
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
2 changes: 1 addition & 1 deletion
2
.github/scripts/prune_test_releases.sh → ...hub/scripts/job-60-prune-test-releases.sh
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
2 changes: 1 addition & 1 deletion
2
.github/scripts/test_push.sh → .github/scripts/job-60-test-push.sh
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
2 changes: 1 addition & 1 deletion
2
.github/scripts/template.sh → .github/scripts/task-render-template.sh
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
2 changes: 1 addition & 1 deletion
2
.github/scripts/requirements.sh → ...hub/scripts/task-template-requirements.sh
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,30 @@ | ||
#!/bin/bash | ||
|
||
# .github/scripts/workflow-setup-environment.sh | ||
# Configures environment variables for GitHub Workflows. | ||
|
||
# CI only script. | ||
|
||
set -eo pipefail | ||
|
||
main() { | ||
|
||
ANSIBLE_WORKBENCH_BRANCH_NAME_BASE="master" | ||
ANSIBLE_WORKBENCH_BRANCH_NAME_DEVELOPMENT="dev" | ||
PROJECT_NAME="ansible-workbench" | ||
USER_NAME="niall-byrne" | ||
TEMPLATED_NAME="flower-generator" | ||
VERBOSE_NOTIFICATIONS="${VERBOSE_NOTIFICATIONS:-0}" | ||
|
||
{ | ||
echo "ANSIBLE_WORKBENCH_BRANCH_NAME_BASE=${ANSIBLE_WORKBENCH_BRANCH_NAME_BASE}" | ||
echo "ANSIBLE_WORKBENCH_BRANCH_NAME_DEVELOPMENT=${ANSIBLE_WORKBENCH_BRANCH_NAME_DEVELOPMENT}" | ||
echo "PROJECT_NAME=${PROJECT_NAME}" | ||
echo "USER_NAME=${USER_NAME}" | ||
echo "TEMPLATED_NAME=${TEMPLATED_NAME}" | ||
echo "VERBOSE_NOTIFICATIONS=${VERBOSE_NOTIFICATIONS}" | ||
} >> "${GITHUB_ENV}" | ||
|
||
} | ||
|
||
main "$@" |
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,37 @@ | ||
--- | ||
name: ansible-workbench-job-start-notification | ||
|
||
on: | ||
workflow_call: | ||
secrets: | ||
SLACK_WEBHOOK: | ||
description: "Optional, enables Slack notifications." | ||
required: false | ||
|
||
jobs: | ||
|
||
start_notification: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Start -- Checkout Repository | ||
uses: actions/checkout@v3 | ||
with: | ||
path: 'template' | ||
|
||
- name: Start -- Setup Environment | ||
run: | | ||
source "./template/.github/scripts/workflow-setup-environment.sh" | ||
source "./template/{{cookiecutter.project_slug}}/.github/scripts/setup.sh" | ||
env: | ||
WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }} | ||
|
||
- name: Start -- Report Job Status on Success | ||
run: | | ||
"./template/{{cookiecutter.project_slug}}/.github/scripts/notifications.sh" "${NOTIFICATION}" ":white_check_mark: workflow has started!" | ||
- name: Start -- Report Job Status on Failure | ||
if: failure() | ||
run: | | ||
"./template/{{cookiecutter.project_slug}}/.github/scripts/notifications.sh" "${NOTIFICATION}" ":x: error reporting job status!" |
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,37 @@ | ||
--- | ||
name: ansible-workbench-job-start-notification | ||
|
||
on: | ||
workflow_call: | ||
secrets: | ||
SLACK_WEBHOOK: | ||
description: "Optional, enables Slack notifications." | ||
required: false | ||
|
||
jobs: | ||
|
||
start_notification: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Success -- Checkout Repository | ||
uses: actions/checkout@v3 | ||
with: | ||
path: 'template' | ||
|
||
- name: Success -- Setup Environment | ||
run: | | ||
source "./template/.github/scripts/workflow-setup-environment.sh" | ||
source "./template/{{cookiecutter.project_slug}}/.github/scripts/setup.sh" | ||
env: | ||
WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }} | ||
|
||
- name: Success -- Report Job Status on Success | ||
run: | | ||
"./template/{{cookiecutter.project_slug}}/.github/scripts/notifications.sh" "${NOTIFICATION}" ":white_check_mark: all checks were successful!" | ||
- name: Success -- Report Job Status on Failure | ||
if: failure() | ||
run: | | ||
"./template/{{cookiecutter.project_slug}}/.github/scripts/notifications.sh" "${NOTIFICATION}" ":x: error reporting job status!" |
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,56 @@ | ||
--- | ||
name: ansible-workbench-job-security | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
CONFIGURATION: | ||
description: "The 'cookiecutter.json' file as a configuration object." | ||
required: true | ||
type: string | ||
secrets: | ||
SLACK_WEBHOOK: | ||
description: "Optional, enables Slack notifications." | ||
required: false | ||
|
||
env: | ||
ANSIBLE_WORKBENCH_SKIP_POETRY: 1 | ||
ANSIBLE_WORKBENCH_SKIP_PRECOMMIT: 1 | ||
|
||
jobs: | ||
|
||
run_trufflehog: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Security Test Repo -- Checkout Repository | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Security Test Repo -- Setup Environment | ||
run: | | ||
source "./.github/scripts/workflow-setup-environment.sh" | ||
source "./{{cookiecutter.project_slug}}/.github/scripts/setup.sh" | ||
source "./{{cookiecutter.project_slug}}/.github/scripts/pushed_commit_range.sh" | ||
env: | ||
GITHUB_CONTEXT: ${{ toJson(github) }} | ||
WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }} | ||
|
||
- name: Security Test -- Run Trufflehog | ||
uses: trufflesecurity/[email protected] | ||
with: | ||
path: . | ||
base: ${{ env.PUSHED_COMMIT_START }} | ||
head: ${{ env.BRANCH_OR_TAG }} | ||
|
||
- name: Security Test Repo -- Report Job Status on Success | ||
if: fromJSON(inputs.CONFIGURATION)._GITHUB_CI_VERBOSE_NOTIFICATIONS == true | ||
run: | | ||
"./{{cookiecutter.project_slug}}/.github/scripts/notifications.sh" "${NOTIFICATION}" ":white_check_mark: security checks succeeded!" | ||
- name: Security Test Repo -- Report Job Status on Failure | ||
if: failure() | ||
run: | | ||
"./{{cookiecutter.project_slug}}/.github/scripts/notifications.sh" "${NOTIFICATION}" ":x: security checks failed!" |
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,83 @@ | ||
--- | ||
name: ansible-workbench-job-documentation | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
CONFIGURATION: | ||
description: "The 'cookiecutter.json' file as a configuration object." | ||
required: true | ||
type: string | ||
secrets: | ||
SLACK_WEBHOOK: | ||
description: "Optional, enables Slack notifications." | ||
required: false | ||
|
||
env: | ||
ANSIBLE_WORKBENCH_SKIP_POETRY: 1 | ||
ANSIBLE_WORKBENCH_SKIP_PRECOMMIT: 1 | ||
|
||
jobs: | ||
|
||
check_markdown_links: | ||
|
||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: true | ||
matrix: | ||
python-version: ${{ fromJSON(inputs.CONFIGURATION)._GITHUB_CI_DEFAULT_PYTHON_VERSIONS }} | ||
max-parallel: ${{ fromJSON(inputs.CONFIGURATION)._GITHUB_CI_DEFAULT_CONCURRENCY }} | ||
|
||
steps: | ||
- name: Documentation Test -- Checkout Repository | ||
uses: actions/checkout@v3 | ||
with: | ||
path: 'template' | ||
|
||
- name: Documentation Test -- Setup Environment | ||
run: | | ||
source "./template/.github/scripts/workflow-setup-environment.sh" | ||
source "./template/{{cookiecutter.project_slug}}/.github/scripts/setup.sh" | ||
env: | ||
WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }} | ||
|
||
- name: Documentation Test -- Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Documentation Test -- Install Template Requirements | ||
run: | | ||
source "./template/.github/scripts/task-template-requirements.sh" | ||
- name: Documentation Test -- Render Template | ||
run: | | ||
source "./template/.github/scripts/task-render-template.sh" | ||
- name: Documentation Test -- Check Markdown Links For Template | ||
uses: gaurav-nelson/github-action-markdown-link-check@v1 | ||
with: | ||
config-file: 'template/{{cookiecutter.project_slug}}/.github/config/actions/gaurav-nelson-github-action-markdown-link-check.json' | ||
use-quiet-mode: 'no' | ||
use-verbose-mode: 'yes' | ||
folder-path: 'template, template/.github/workflows' | ||
max-depth: 1 | ||
|
||
- name: Documentation Test -- Check Markdown Links For Rendered Template | ||
uses: gaurav-nelson/github-action-markdown-link-check@v1 | ||
with: | ||
config-file: 'template/{{cookiecutter.project_slug}}/.github/config/actions/gaurav-nelson-github-action-markdown-link-check.json' | ||
use-quiet-mode: 'no' | ||
use-verbose-mode: 'yes' | ||
folder-path: ${{ env.TEMPLATED_NAME }} | ||
max-depth: -1 | ||
|
||
- name: Documentation Test -- Report Job Status on Success | ||
if: fromJSON(inputs.CONFIGURATION)._GITHUB_CI_VERBOSE_NOTIFICATIONS == true | ||
run: | | ||
"./template/{{cookiecutter.project_slug}}/.github/scripts/notifications.sh" "${NOTIFICATION}" ":white_check_mark: documentation checks succeeded!" | ||
- name: Documentation Test -- Report Job Status on Failure | ||
if: failure() | ||
run: | | ||
"./template/{{cookiecutter.project_slug}}/.github/scripts/notifications.sh" "${NOTIFICATION}" ":x: documentation checks failed!" |
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,89 @@ | ||
--- | ||
name: ansible-workbench-job-molecule | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
CONFIGURATION: | ||
description: "The 'cookiecutter.json' file as a configuration object." | ||
required: true | ||
type: string | ||
secrets: | ||
SLACK_WEBHOOK: | ||
description: "Optional, enables Slack notifications." | ||
required: false | ||
|
||
env: | ||
ANSIBLE_WORKBENCH_SKIP_POETRY: 0 | ||
ANSIBLE_WORKBENCH_SKIP_PRECOMMIT: 0 | ||
|
||
jobs: | ||
|
||
run_molecule_lint: | ||
|
||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: true | ||
matrix: | ||
python-version: ${{ fromJSON(inputs.CONFIGURATION)._GITHUB_CI_DEFAULT_PYTHON_VERSIONS }} | ||
max-parallel: ${{ fromJSON(inputs.CONFIGURATION)._GITHUB_CI_DEFAULT_CONCURRENCY }} | ||
|
||
steps: | ||
- name: Molecule Lint Test -- Checkout Repository | ||
uses: actions/checkout@v3 | ||
with: | ||
path: 'template' | ||
|
||
- name: Molecule Lint Test -- Setup Environment | ||
run: | | ||
source "./template/.github/scripts/workflow-setup-environment.sh" | ||
source "./template/{{cookiecutter.project_slug}}/.github/scripts/setup.sh" | ||
env: | ||
WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }} | ||
|
||
- name: Molecule Lint Test -- Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Molecule Lint Test -- Install Template Requirements | ||
run: | | ||
source "./template/.github/scripts/task-template-requirements.sh" | ||
- name: Molecule Lint Test -- Initialize Cache Locations | ||
run: | | ||
mkdir -p ~/.cache/pypoetry/virtualenvs | ||
source "./template/{{cookiecutter.project_slug}}/.github/scripts/ansible_cache.sh" \ | ||
"$(pwd)/ansible_cache" \ | ||
~/.cache | ||
- name: Molecule Lint Test -- Mount Ansible Cache | ||
uses: actions/cache@v3 | ||
with: | ||
key: ansible-${{ hashFiles('./template/{{cookiecutter.project_slug}}/requirements.yml') }}-${{ env.CACHE_TTL }} | ||
path: ansible_cache | ||
|
||
- name: Molecule Lint Test -- Mount Poetry Cache | ||
uses: actions/cache@v3 | ||
with: | ||
key: poetry-${{ hashFiles('./template/{{cookiecutter.project_slug}}/pyproject.toml') }}-${{ runner.os }}-${{ env.CACHE_TTL }} | ||
path: ~/.cache/pypoetry/virtualenvs | ||
|
||
- name: Molecule Lint Test -- Render Template | ||
run: | | ||
source "./template/.github/scripts/task-render-template.sh" | ||
- name: Molecule Lint Test -- Lint Rendered Template With Default Scenario | ||
run: | | ||
cd "${TEMPLATED_NAME}" | ||
poetry run molecule lint | ||
- name: Molecule Lint Test -- Report Job Status on Success | ||
if: fromJSON(inputs.CONFIGURATION)._GITHUB_CI_VERBOSE_NOTIFICATIONS == true | ||
run: | | ||
"./template/{{cookiecutter.project_slug}}/.github/scripts/notifications.sh" "${NOTIFICATION}" ":white_check_mark: molecule linting checks succeeded!" | ||
- name: Molecule Lint Test -- Report Job Status on Failure | ||
if: failure() | ||
run: | | ||
"./template/{{cookiecutter.project_slug}}/.github/scripts/notifications.sh" "${NOTIFICATION}" ":x: molecule linting checks failed!" |
Oops, something went wrong.