From 0f5f20c12817721132224d6ddc65d7efd3e520a1 Mon Sep 17 00:00:00 2001 From: Vladimir Date: Mon, 19 Apr 2021 16:40:33 +0300 Subject: [PATCH] ci: add GH actions (#6) --- .github/CODEOWNERS | 1 + .github/ISSUE_TEMPLATE/bug_report.md | 26 ++++++++++ .github/ISSUE_TEMPLATE/feature_request.md | 20 ++++++++ .github/auto-release.yml | 59 +++++++++++++++++++++++ .github/labeler.yml | 27 +++++++++++ .github/labels.yml | 57 ++++++++++++++++++++++ .github/workflows/docs.yml | 29 +++++++++++ .github/workflows/labeler.yml | 13 +++++ .github/workflows/labels.yml | 17 +++++++ .github/workflows/pr-lint.yml | 36 ++++++++++++++ .github/workflows/release.yml | 20 ++++++++ .github/workflows/stale.yml | 21 ++++++++ .github/workflows/terraform.yml | 34 +++++++++++++ 13 files changed, 360 insertions(+) create mode 100644 .github/CODEOWNERS create mode 100644 .github/ISSUE_TEMPLATE/bug_report.md create mode 100644 .github/ISSUE_TEMPLATE/feature_request.md create mode 100644 .github/auto-release.yml create mode 100644 .github/labeler.yml create mode 100644 .github/labels.yml create mode 100644 .github/workflows/docs.yml create mode 100644 .github/workflows/labeler.yml create mode 100644 .github/workflows/labels.yml create mode 100644 .github/workflows/pr-lint.yml create mode 100644 .github/workflows/release.yml create mode 100644 .github/workflows/stale.yml create mode 100644 .github/workflows/terraform.yml diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 0000000..e1aee9b --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1 @@ +* @SweetOps diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000..49b494b --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,26 @@ +--- +name: Bug report +about: Create a report to help us improve +title: '' +labels: bug +assignees: SweetOps + +--- + +**Describe the bug** +A clear and concise description of what the bug is. + +**To Reproduce** +Steps to reproduce the behavior. + +**Expected behavior** +A clear and concise description of what you expected to happen. + +**Screenshots** +If applicable, add screenshots to help explain your problem. + +**Terraform version** +Output of command: +```sh +terraform version +``` diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 0000000..e8fc172 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,20 @@ +--- +name: Feature request +about: Suggest an idea for this project +title: '' +labels: 'feature' +assignees: 'SweetOps' + +--- + +**Is your feature request related to a problem? Please describe.** +A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] + +**Describe the solution you'd like** +A clear and concise description of what you want to happen. + +**Describe alternatives you've considered** +A clear and concise description of any alternative solutions or features you've considered. + +**Additional context** +Add any other context or screenshots about the feature request here. diff --git a/.github/auto-release.yml b/.github/auto-release.yml new file mode 100644 index 0000000..cbd91a4 --- /dev/null +++ b/.github/auto-release.yml @@ -0,0 +1,59 @@ +name-template: 'v$RESOLVED_VERSION' +tag-template: '$RESOLVED_VERSION' +version-template: '$MAJOR.$MINOR.$PATCH' +version-resolver: + major: + labels: + - 'major' + minor: + labels: + - 'minor' + - 'enhancement' + - 'feat' + patch: + labels: + - 'auto-update' + - 'patch' + - 'fix' + - 'bugfix' + - 'bug' + - 'hotfix' + - 'refactor' + - 'ci' + - 'build' + - 'docs' + - 'test' + - 'chore' + default: 'minor' + +categories: +- title: '🚀 Enhancements' + labels: + - 'minor' + - 'enhancement' + - 'feat' +- title: '🐛 Bug Fixes' + labels: + - 'auto-update' + - 'patch' + - 'fix' + - 'bugfix' + - 'bug' + - 'hotfix' + - 'refactor' + - 'ci' + - 'build' + - 'docs' + - 'test' + - 'chore' +- title: '🤖 Automatic Updates' + labels: + - 'auto-update' + +change-template: | +
+ $TITLE @$AUTHOR (#$NUMBER) + $BODY +
+template: | + $CHANGES \ No newline at end of file diff --git a/.github/labeler.yml b/.github/labeler.yml new file mode 100644 index 0000000..3eb9dc9 --- /dev/null +++ b/.github/labeler.yml @@ -0,0 +1,27 @@ +version: v1 + +labels: + - label: "feat" + matcher: + title: "^feat:.*" + - label: "fix" + matcher: + title: "^fix:.*" + - label: "ci" + matcher: + title: "^ci:.*" + - label: "chore" + matcher: + title: "^chore:.*" + - label: "build" + matcher: + title: "^build:.*" + - label: "docs" + matcher: + title: "^docs:.*" + - label: "refactor" + matcher: + title: "^refactor:.*" + - label: "test" + matcher: + title: "^test:.*" \ No newline at end of file diff --git a/.github/labels.yml b/.github/labels.yml new file mode 100644 index 0000000..4a88a7a --- /dev/null +++ b/.github/labels.yml @@ -0,0 +1,57 @@ +--- +# Default GitHub labels +- color: d73a4a + name: bug + description: Something isn't working +- color: cfd3d7 + name: duplicate + description: This issue or pull request already exists +- color: a2eeef + name: enhancement + description: New feature or request +- color: 7057ff + name: good first issue + description: Good for newcomers +- color: 008672 + name: help wanted + description: Extra attention is needed +- color: e4e669 + name: invalid + description: This doesn't seem right +- color: d876e3 + name: question + description: Further information is requested +- color: ffffff + name: wontfix + description: This will not be worked on + +- color: a0040c + name: no-pr-activity + description: stalled PR +- color: d93f0b + name: no-issue-activity + description: stalled issue +- color: f9dcbd + name: build + description: Changes that affect the build system or external dependencies +- color: 63dae2 + name: ci + description: Changes to our CI configuration files and scripts +- color: 6e93e5 + name: docs + description: Documentation only changes +- color: 5edb3f + name: feat + description: A new feature +- color: 58e8c8 + name: fix + description: A bug fix +- color: efada0 + name: refactor + description: A code change that neither fixes a bug nor adds a feature +- color: 1d76db + name: test + description: Adding missing tests or correcting existing tests +- color: dfb443 + name: chore + description: Adding missing tests or correcting existing tests \ No newline at end of file diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml new file mode 100644 index 0000000..c0a01f4 --- /dev/null +++ b/.github/workflows/docs.yml @@ -0,0 +1,29 @@ +name: Generate terraform docs +on: + pull_request_target: + +jobs: + docs: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + ref: ${{ github.event.pull_request.head.ref }} + + - name: main docs + uses: Dirrk/terraform-docs@v1.0.8 + with: + tf_docs_working_dir: . + tf_docs_output_file: README.md + tf_docs_output_method: inject + tf_docs_git_push: 'true' + tf_docs_args: '--sort-inputs-by-required' + + - name: basic example docs + uses: Dirrk/terraform-docs@v1.0.8 + with: + tf_docs_working_dir: ./examples/basic/ + tf_docs_output_file: README.md + tf_docs_output_method: inject + tf_docs_git_push: 'true' + tf_docs_args: '--sort-inputs-by-required' diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml new file mode 100644 index 0000000..17ea40d --- /dev/null +++ b/.github/workflows/labeler.yml @@ -0,0 +1,13 @@ +name: Auto Label +on: + pull_request_target: + +jobs: + labeler: + name: Labeler + runs-on: ubuntu-latest + steps: + - uses: fuxingloh/multi-labeler@v1.5.0 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + config-path: .github/labeler.yml \ No newline at end of file diff --git a/.github/workflows/labels.yml b/.github/workflows/labels.yml new file mode 100644 index 0000000..097f5bc --- /dev/null +++ b/.github/workflows/labels.yml @@ -0,0 +1,17 @@ +--- +name: Sync labels in the declarative way +on: + push: + branches: + - master +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@1.0.0 + - uses: micnncim/action-label-syncer@v0.3.1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_REPOSITORY: ${{ github.repository }} + with: + manifest: .github/labels.yml \ No newline at end of file diff --git a/.github/workflows/pr-lint.yml b/.github/workflows/pr-lint.yml new file mode 100644 index 0000000..18ee989 --- /dev/null +++ b/.github/workflows/pr-lint.yml @@ -0,0 +1,36 @@ +name: Lint PR +on: + pull_request_target: + +jobs: + main: + runs-on: ubuntu-latest + + steps: + - name: Lint PR + uses: aslafy-z/conventional-pr-title-action@master + with: + preset: conventional-changelog-angular@^5.0.6 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Comment for PR title conformance + if: failure() + uses: peter-evans/create-or-update-comment@v1 + with: + issue-number: ${{tojson(github.event.number)}} + body: | + Please ensure your PR conforms to conventional commits (see https://www.conventionalcommits.org). + + Commits MUST be prefixed with a type, which consists of one of the following: + + * **build**: Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm) + * **ci**: Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs) + * **docs**: Documentation only changes + * **feat**: A new feature + * **fix**: A bug fix + * **perf**: A code change that improves performance + * **refactor**: A code change that neither fixes a bug nor adds a feature + * **style**: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc) + * **test**: Adding missing tests or correcting existing tests + * **chore**: No production code change diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..c583401 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,20 @@ + +name: Release Drafter + +on: + push: + branches: + - master + +jobs: + publish: + runs-on: ubuntu-latest + steps: + # Drafts your next Release notes as Pull Requests are merged into "master" + - uses: release-drafter/release-drafter@v5 + with: + publish: true + prerelease: false + config-name: auto-release.yml + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml new file mode 100644 index 0000000..9447b05 --- /dev/null +++ b/.github/workflows/stale.yml @@ -0,0 +1,21 @@ +name: Mark stale issues and pull requests + +on: + schedule: + - cron: "0 12 * * *" + +jobs: + stale: + + runs-on: ubuntu-latest + + steps: + - uses: actions/stale@v1 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + stale-issue-message: 'This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days' + stale-pr-message: 'This pull-request is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days' + stale-issue-label: 'no-issue-activity' + stale-pr-label: 'no-pr-activity' + days-before-stale: 30 + days-before-close: 5 \ No newline at end of file diff --git a/.github/workflows/terraform.yml b/.github/workflows/terraform.yml new file mode 100644 index 0000000..e4a0761 --- /dev/null +++ b/.github/workflows/terraform.yml @@ -0,0 +1,34 @@ +name: 'Validate TF manifests' +on: + pull_request_target: + +jobs: + terraform: + name: Terraform + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@master + + - name: Terraform + uses: hashicorp/setup-terraform@v1 + with: + terraform_version: 0.14.7 + + - name: Terraform Format + run: terraform fmt + + - name: Terraform Init + run: terraform init + + - name: Terraform Validate + run: terraform validate -no-color + + - name: tflint + uses: reviewdog/action-tflint@master + with: + github_token: ${{ secrets.github_token }} + reporter: github-pr-review + fail_on_error: "true" + filter_mode: "nofilter" + flags: "--module"