-
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
Showing
28 changed files
with
168 additions
and
177 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
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 |
---|---|---|
@@ -1,5 +1,15 @@ | ||
# Workflow/Actions to Automate | ||
|
||
- [coverage-tests.yaml](coverage-tests.yaml): Runs unit test and static analysis of Go. | ||
- [merte-tests.yaml](merge-tests.yaml): Runs tests for requirements to merge including shell scripts. | ||
- [update-on-release.yaml](update-on-release.yaml): Updates the package in [pkg.go.dev](https://pkg.go.dev/github.com/KEINOS/Hello-Cobra) when new version was released. | ||
- [merte-tests.yaml](merge-tests.yaml): マージ前に必要なテストを実行します。 | ||
|
||
## Fork 時の注意 | ||
|
||
Fork 先のリポジトリの設定で、翻訳 API のアクセストークン(認証キー)を設定・登録する必要があります。 | ||
|
||
### Repository secrets の設定 | ||
|
||
Fork 先のリポジトリの [Settings] -> [Secrets] -> "Actions secrets" の "New repository secrets" ボタンから以下の設定でトークンを設定します. | ||
|
||
- DeepL PRO API ([認証キー確認先](https://www.deepl.com/pro-account/plan)) | ||
- Name: `DEEPL_API_KEY` | ||
- Value: DEEPL で発行した認証キー |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,56 +1,66 @@ | ||
name: Tests before merge | ||
name: All Tests | ||
|
||
on: | ||
workflow_dispatch: | ||
pull_request: | ||
|
||
jobs: | ||
merge_tests: | ||
coverage: | ||
name: Unit test and coverage | ||
environment: TOKENS_BY_KEINOS | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout the code | ||
- name: Checkout repo | ||
uses: actions/checkout@v2 | ||
|
||
- uses: actions/setup-go@v2 | ||
- name: Install Golang | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: 1.15.x | ||
|
||
- name: Use Cache | ||
uses: actions/cache@v2 | ||
with: | ||
path: ~/go/pkg/mod | ||
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | ||
restore-keys: | | ||
${{ runner.os }}-go- | ||
go-version: 1.16 | ||
|
||
- name: Download Modules | ||
if: steps.cache.outputs.cache-hit != 'true' | ||
run: go mod download | ||
|
||
- name: Run shellcheck (pre-installed) | ||
- name: Install ShellCheck | ||
run: | | ||
find . -name '*.sh' -type f -print0 | xargs -0 shellcheck | ||
url_download="https://github.com/koalaman/shellcheck/releases/download/latest/shellcheck-latest.linux.$(uname -m).tar.xz" | ||
timestamp="$(date +%Y%m%d%H%M%S)" | ||
path_tmp_dir=$(mktemp "/tmp/${NameRepo}-${timestamp}.tmp.XXXXXX") | ||
echo "TEMP PATH: ${path_tmp_dir}" | ||
wget -P "${path_tmp_dir}/" "$url_download" | ||
tar xvf "${path_tmp_dir}"/shellcheck* -C "${path_tmp_dir}/" | ||
sudo cp "${path_tmp_dir}/shellcheck-latest/shellcheck" "$(dirname $(which tar))/shellcheck" | ||
shellcheck --version | ||
- name: Install and run shfmt | ||
- name: Install shfmt | ||
run: | | ||
GO111MODULE=on go get mvdan.cc/sh/v3/cmd/shfmt | ||
find . -name '*.sh' -type f -print0 | xargs -0 shfmt -d | ||
- name: Install go-carpet | ||
run: | | ||
GO111MODULE=on go get github.com/msoap/go-carpet | ||
- name: Install gomarkdoc | ||
run: | | ||
GO111MODULE=on go get github.com/princjef/gomarkdoc/cmd/gomarkdoc | ||
- name: Run gofmt | ||
uses: Jerome1337/gofmt-action@v1.0.4 | ||
with: | ||
gofmt-path: '.' | ||
gofmt-flags: '-d -e' # display diffs and report all errors | ||
|
||
- name: Run golangci-lint | ||
uses: golangci/golangci-lint-action@v2 | ||
with: | ||
version: latest | ||
args: --config ./.github/golangci.yml | ||
skip-go-installation: true # use pre-installed Go | ||
- name: Install golangci-lint | ||
run: | | ||
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b "$(go env GOPATH)/bin" | ||
golangci-lint --version | ||
- name: Run requirement check | ||
- name: Run coverage (Linux) | ||
env: | ||
DEEPL_API_KEY: ${{ secrets.DEEPL_API_KEY }} | ||
if: runner.os != 'Windows' | ||
run: | | ||
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin | ||
./.github/check-requirements.sh | ||
go mod tidy | ||
./.github/run-tests-merge.sh |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -5,7 +5,6 @@ man | |
.vagrant | ||
|
||
coverage.out | ||
go.sum | ||
go-carpet-* | ||
|
||
.DS_Store |
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 |
---|---|---|
|
@@ -6,5 +6,6 @@ | |
"MD024": false, | ||
"MD029": false, | ||
"MD033": false, | ||
"MD040": false | ||
"MD040": false, | ||
"MD041": false | ||
} |
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
File renamed without changes.
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
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
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
Oops, something went wrong.