From d4f4e9fe5c58a8d13722718930886eba7f46f025 Mon Sep 17 00:00:00 2001 From: KEINOS Date: Tue, 30 Nov 2021 16:05:03 +0900 Subject: [PATCH] chore: Add comments --- .github/check-requirements.sh | 2 +- .github/workflows/codeQL-analysis.yaml | 5 ++++- .github/workflows/coverage-tests.yaml | 4 +++- .github/workflows/golangci-lint.yaml | 15 +++---------- .github/workflows/platform-test.yaml | 4 +++- .github/workflows/release_bin.yaml | 26 ++++++++++------------- .github/workflows/update-codecov.yaml | 8 ++++--- .github/workflows/update-mod-monthly.yaml | 14 ++++++------ .github/workflows/version-tests.yaml | 18 ++++------------ .goreleaser.yml | 2 ++ README.md | 2 +- 11 files changed, 44 insertions(+), 56 deletions(-) diff --git a/.github/check-requirements.sh b/.github/check-requirements.sh index 037942d..e4920f9 100755 --- a/.github/check-requirements.sh +++ b/.github/check-requirements.sh @@ -1,7 +1,7 @@ #!/bin/sh # ============================================================================= # This script checks if the commands and packages required for merge testing -# are installed. +# are installed. Run this script before running ./run-tests-merge.sh. # ============================================================================= # ----------------------------------------------------------------------------- diff --git a/.github/workflows/codeQL-analysis.yaml b/.github/workflows/codeQL-analysis.yaml index 9b53f45..83686ea 100644 --- a/.github/workflows/codeQL-analysis.yaml +++ b/.github/workflows/codeQL-analysis.yaml @@ -7,7 +7,10 @@ name: "CodeQL" on: - push: + workflow_dispatch: + pull_request: + branches: + - main schedule: # Runs at 16:30 UTC on day-of-month 1 (Every day-of-month 1 at AM 01:30 JST, my time) # See: https://crontab.guru/ diff --git a/.github/workflows/coverage-tests.yaml b/.github/workflows/coverage-tests.yaml index 45aaffb..bb484f0 100644 --- a/.github/workflows/coverage-tests.yaml +++ b/.github/workflows/coverage-tests.yaml @@ -4,7 +4,9 @@ name: 100% Coverage on: workflow_dispatch: - push: + pull_request: + branches: + - main env: PATH_CACHE: /tmp/docker-img-arch diff --git a/.github/workflows/golangci-lint.yaml b/.github/workflows/golangci-lint.yaml index 2f9aa09..a608ec8 100644 --- a/.github/workflows/golangci-lint.yaml +++ b/.github/workflows/golangci-lint.yaml @@ -4,7 +4,9 @@ name: golangci-lint on: workflow_dispatch: - push: + pull_request: + branches: + - main jobs: golangci: @@ -16,15 +18,4 @@ jobs: uses: golangci/golangci-lint-action@v2 with: version: latest - - # Optional: working directory, useful for monorepos - # working-directory: somedir - - # Optional: golangci-lint command line arguments. args: --config ./.golangci.yml - - # Optional: show only new issues if it's a pull request. The default value is `false`. - # only-new-issues: true - - # Optional: if set to true then the action will use pre-installed Go - # skip-go-installation: true \ No newline at end of file diff --git a/.github/workflows/platform-test.yaml b/.github/workflows/platform-test.yaml index 8d1bf4d..addff1b 100644 --- a/.github/workflows/platform-test.yaml +++ b/.github/workflows/platform-test.yaml @@ -4,7 +4,9 @@ name: Test on macOS/Win/Linux on: workflow_dispatch: - push: + pull_request: + branches: + - main jobs: coverage: diff --git a/.github/workflows/release_bin.yaml b/.github/workflows/release_bin.yaml index a78a9cc..9b9b124 100644 --- a/.github/workflows/release_bin.yaml +++ b/.github/workflows/release_bin.yaml @@ -1,11 +1,18 @@ -# This workflow will release the built binaries for Linux, macOS and Windows. +# ============================================================================= +# Release Assets and Homebrew's Tap +# ============================================================================= +# This workflow will build the binaries and push the archives to the assets in +# the releases page if a release was created. Then pushes the tap config file +# for Homebrew tap. See: ../../.goreleaser.yml name: Release on: workflow_dispatch: release: + types: + - created tags: - - 'v*' + - 'v*' jobs: goreleaser: runs-on: ubuntu-latest @@ -14,24 +21,13 @@ jobs: uses: actions/checkout@v2 with: fetch-depth: 0 + - name: Run tests + run: docker-compose --file ./.github/docker-compose.yml up mergeability - name: Set up Go uses: actions/setup-go@v2 with: go-version: '1.17.x' - - name: Download mods - run: go mod download - # Wait until the unit test (version-tests.yaml) finishes - - name: Wait Tests - id: test_result - uses: Sibz/await-status-action@v1.0.1 - with: - contexts: test-status - authToken: ${{ secrets.GITHUB_TOKEN }} - timeout: 30 - # Push the built assets to the release page and push Homebrew config file - # to https://github.com/EINOS/homebrew-Hello-Cobra repo. - name: Run GoReleaser - if: steps.test_result.outputs.result != 'success' uses: goreleaser/goreleaser-action@v2 with: version: latest diff --git a/.github/workflows/update-codecov.yaml b/.github/workflows/update-codecov.yaml index e463e45..92108d9 100644 --- a/.github/workflows/update-codecov.yaml +++ b/.github/workflows/update-codecov.yaml @@ -1,4 +1,7 @@ -# Workflow to updates the coverage for CodeCov.io on release. +# ============================================================================= +# Update CodeCov +# ============================================================================= +# This Workflow to updates the coverage to CodeCov.io on release. name: Update codecov.io on: @@ -7,8 +10,7 @@ on: types: - created tags: - - 'v[0-9]+.[0-9]+.[0-9]+' - - '**/v[0-9]+.[0-9]+.[0-9]+' + - 'v*' jobs: build: diff --git a/.github/workflows/update-mod-monthly.yaml b/.github/workflows/update-mod-monthly.yaml index 8b2e082..455ef37 100644 --- a/.github/workflows/update-mod-monthly.yaml +++ b/.github/workflows/update-mod-monthly.yaml @@ -1,15 +1,15 @@ # ============================================================================= # Weekly Module Update # ============================================================================= -# This workflow runs monthly to update and test the latest `go.mod` version and -# `go install` (or `go get -u`) functionality. -# -# If all the tests succeeds to run in all Go versions, it will create a new PR -# of the `go.mod` and `go.sum`. +# This workflow runs monthly to: +# 1. Update the `go.mod` and `go.sum` files if all the tests succeeds to run +# in all Go versions with that updated versions. (Go v1.15~latest) +# 2. Test `go get -u` and `go install` functionality of the latest release. +# 3. Pull request the updated `go.mod` and `go.sum` # # NOTE: -# You need to set the repository secreat of `PERSONAL_ACCESS_TOKEN` environment -# variable in your repo's: +# You need to set the "PERSONAL_ACCESS_TOKEN" env variable in the repository +# secreat of your repo at: # [Settings]-[Secrets]-[Actions secrets] # To generate a new token go to: # https://github.com/settings/tokens diff --git a/.github/workflows/version-tests.yaml b/.github/workflows/version-tests.yaml index 36df2cd..0274acf 100644 --- a/.github/workflows/version-tests.yaml +++ b/.github/workflows/version-tests.yaml @@ -1,4 +1,7 @@ -# Workflow for various Go versions over Docker on any push to main. +# ============================================================================= +# Unit Tests on Go v1.15, 16, 17 and latest +# ============================================================================= +# This Workflow runs unit tests on various Go versions over Docker on any push. # This action caches the built Docker image for a day unless any change in the # Dockerfile was made. name: Go 1.15~latest @@ -80,16 +83,3 @@ jobs: run: docker-compose --file ./.github/docker-compose.yml up latest - name: Run tests for mergeability run: docker-compose --file ./.github/docker-compose.yml up mergeability - # If the "go" job suceeds then flag up the finish status as 'success' of this action - # to annouce the other actions. See: release_bin.yaml - test-status: - name: Test status - runs-on: ubuntu-latest - needs: go - steps: - - name: Set Check Status Success - uses: Sibz/github-status-action@v1.1.1 - with: - context: test-status - authToken: ${{ secrets.GITHUB_TOKEN }} - state: success \ No newline at end of file diff --git a/.goreleaser.yml b/.goreleaser.yml index 976b1ef..2e8c0d7 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -1,4 +1,6 @@ # ============================================================================= +# Configuration for `goreleaser`. +# ============================================================================= # What It Is # # This is a configuration file for `goreleaser` command to "automate" releasing diff --git a/README.md b/README.md index 1e7ec4c..03ecf40 100644 --- a/README.md +++ b/README.md @@ -50,7 +50,7 @@ This repo aims to find the best-practices of `Cobra` by refactoring it on a mome $ hello-cobra --version hello-cobra version 1.3.2-alpha (c3c9eab) - $ hello-cobra hello-cobra hello foo bar + $ hello-cobra hello foo bar Hello, foo and bar! $ hello-cobra hello foo bar --reverse