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.
feat(INITIAL) setup initial template and ci/cd
- Loading branch information
0 parents
commit 2f0ced2
Showing
34 changed files
with
1,480 additions
and
0 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,7 @@ | ||
#!/bin/bash | ||
|
||
# Takes two text arguments | ||
# Message Format: <ARG1>: <ARG2> | ||
|
||
[[ -z ${WEBHOOK_URL} ]] && exit 0 | ||
curl -X POST -H 'Content-type: application/json' --data "{\"text\":\"${1}: ${2}\"}" "${WEBHOOK_URL}" |
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,13 @@ | ||
#!/bin/bash | ||
|
||
main() { | ||
BRANCH_OR_TAG="$(echo "${GITHUB_REF}" | sed 's/refs\/heads\///g' | sed 's/refs\/tags\///g')" | ||
PROJECT_NAME="ansible-workbench" | ||
echo "BRANCH_OR_TAG=${BRANCH_OR_TAG}" >> $GITHUB_ENV | ||
echo "WEBHOOK_URL=${WEBHOOK_URL}" >> $GITHUB_ENV | ||
echo "PROJECT_NAME=${PROJECT_NAME}" >> $GITHUB_ENV | ||
echo "NOTIFICATION=${PROJECT_NAME} [${BRANCH_OR_TAG}]" >> $GITHUB_ENV | ||
echo "USERNAME=shared-vision-solutions" >> $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,13 @@ | ||
#!/bin/bash | ||
|
||
NAME=${1:-"Pro Buddy Dev"} | ||
EMAIL=${2:-"[email protected]"} | ||
|
||
main() { | ||
pip install cookiecutter poetry | ||
git config --global user.name "${NAME}" | ||
git config --global user.email "${EMAIL}" | ||
echo -e '\n\n\n\n\n\n\n' | cookiecutter template/ | ||
} | ||
|
||
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,229 @@ | ||
name: ansible-workbench-self-test | ||
|
||
# Required Github Repository Secrets: | ||
# REMOTE_TOKEN - Github Token With Access To This Repo | ||
# REMOTE_ORIGIN - The git remote repository name (organization/repo) | ||
# SLACK_WEBHOOK - The slack webhook for build notifications | ||
|
||
on: | ||
push: | ||
schedule: | ||
- cron: "0 6 * * 1" | ||
workflow_dispatch: | ||
|
||
jobs: | ||
|
||
documentation_test: | ||
|
||
runs-on: ubuntu-20.04 | ||
strategy: | ||
max-parallel: 4 | ||
matrix: | ||
python-version: [ 3.7 ] | ||
|
||
steps: | ||
|
||
- uses: actions/checkout@v2 | ||
with: | ||
path: 'template' | ||
- name: Setup Environment | ||
run: | | ||
source ./template/.github/setup.sh | ||
env: | ||
WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }} | ||
|
||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v1 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Create Template | ||
run: | | ||
source ./template/.github/template.sh | ||
- name: Check Markdown Links For Readme | ||
uses: gaurav-nelson/[email protected] | ||
with: | ||
use-quiet-mode: 'no' | ||
use-verbose-mode: 'yes' | ||
folder-path: 'template, template/.github/workflows' | ||
max-depth: 1 | ||
- name: Check Markdown Links For Rendered Template | ||
uses: gaurav-nelson/[email protected] | ||
with: | ||
use-quiet-mode: 'no' | ||
use-verbose-mode: 'yes' | ||
folder-path: './flower_generator' | ||
max-depth: -1 | ||
|
||
- name: Report Job Status on Success | ||
run: | | ||
./template/.github/notifications.sh "${NOTIFICATION}" "documentation checks succeeded!" | ||
- name: Report Job Status on Failure | ||
if: failure() | ||
run: | | ||
./template/.github/notifications.sh "${NOTIFICATION}" "documentation checks failed!" | ||
linting: | ||
|
||
runs-on: ubuntu-20.04 | ||
strategy: | ||
max-parallel: 4 | ||
matrix: | ||
python-version: [3.7] | ||
|
||
steps: | ||
|
||
- uses: actions/checkout@v2 | ||
with: | ||
path: 'template' | ||
- name: Setup Environment | ||
run: | | ||
source ./template/.github/setup.sh | ||
env: | ||
WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }} | ||
|
||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v1 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Create Template | ||
run: | | ||
source ./template/.github/template.sh | ||
- name: Lint Role Defaults | ||
run: | | ||
cd flower_generator | ||
poetry run molecule lint | ||
- name: Report Job Status on Success | ||
run: | | ||
./template/.github/notifications.sh "${NOTIFICATION}" "linting checks succeeded!" | ||
- name: Report Job Status on Failure | ||
if: failure() | ||
run: | | ||
./template/.github/notifications.sh "${NOTIFICATION}" "linting checks failed!" | ||
push_repository_test: | ||
needs: [linting, documentation_test] | ||
|
||
runs-on: ubuntu-20.04 | ||
strategy: | ||
max-parallel: 4 | ||
matrix: | ||
python-version: [3.7] | ||
|
||
steps: | ||
|
||
- uses: actions/checkout@v2 | ||
with: | ||
path: 'template' | ||
persist-credentials: false | ||
- name: Setup Environment | ||
run: | | ||
source ./template/.github/setup.sh "GitHub Action" "[email protected]" | ||
env: | ||
WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }} | ||
|
||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v1 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Create Template | ||
run: | | ||
source ./template/.github/template.sh | ||
- name: Clean Up Tags for Git Push | ||
run: | | ||
cd flower_generator | ||
git checkout master | ||
git tag --delete v0.0.0 # Don't Repush | ||
git tag v1.0.0 | ||
- name: Push To Test Repository (master) | ||
uses: ad-m/[email protected] | ||
with: | ||
github_token: ${{ secrets.REMOTE_TOKEN }} | ||
branch: master | ||
tags: false | ||
directory: flower_generator | ||
repository: ${{ secrets.REMOTE_ORIGIN }} | ||
force: true | ||
- name: Push To Test Repository (production) | ||
uses: ad-m/[email protected] | ||
with: | ||
github_token: ${{ secrets.REMOTE_TOKEN }} | ||
branch: production | ||
tags: false | ||
directory: flower_generator | ||
repository: ${{ secrets.REMOTE_ORIGIN }} | ||
force: true | ||
- name: Push To Test Repository (release tag) | ||
uses: ad-m/[email protected] | ||
with: | ||
github_token: ${{ secrets.REMOTE_TOKEN }} | ||
branch: production | ||
tags: true | ||
directory: flower_generator | ||
repository: ${{ secrets.REMOTE_ORIGIN }} | ||
force: true | ||
|
||
- name: Report Job Status on Success | ||
run: | | ||
./template/.github/notifications.sh "${NOTIFICATION}" "push has been triggered!" | ||
- name: Report Job Status on Failure | ||
if: failure() | ||
run: | | ||
./template/.github/notifications.sh "${NOTIFICATION}" "push failed to trigger!" | ||
create_releases: | ||
needs: [push_repository_test] | ||
|
||
runs-on: ubuntu-20.04 | ||
strategy: | ||
max-parallel: 4 | ||
matrix: | ||
python-version: [ 3.7 ] | ||
|
||
steps: | ||
- uses: actions/checkout@v1 | ||
- name: Setup Environment | ||
if: contains(github.ref, '/tags/v') | ||
run: | | ||
source .github/setup.sh | ||
env: | ||
WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }} | ||
|
||
- name: Releases -- Prepare Release Content | ||
if: contains(github.ref, '/tags/v') | ||
run: | | ||
echo "{}" > package.json | ||
- name: Production -- Generate Changelog | ||
if: contains(github.ref, '/tags/v') | ||
uses: scottbrenner/[email protected] | ||
id: Changelog | ||
env: | ||
REPO: ${{ github.repository }} | ||
- name: Production -- Create Release | ||
if: contains(github.ref, '/tags/v') | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ env.BRANCH_OR_TAG }} | ||
release_name: Release ${{ env.BRANCH_OR_TAG }} | ||
body: | | ||
${{ steps.Changelog.outputs.changelog }} | ||
## Deployment Checklist | ||
- [ ] Ensure correct version is notated | ||
- [ ] Ensure documentation is accurate | ||
- [ ] Ensure self test passes | ||
draft: true | ||
prerelease: false | ||
|
||
- name: Report Job Status on Success | ||
if: contains(github.ref, '/tags/v') | ||
run: | | ||
.github/notifications.sh "${NOTIFICATION}" "automated release has been created!" | ||
- name: Report Job Status on Failure | ||
if: failure() | ||
run: | | ||
.github/notifications.sh "${NOTIFICATION}" "automated release has 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,3 @@ | ||
.txt | ||
.cache | ||
poetry.lock |
Oops, something went wrong.