Skip to content

Commit 20cd698

Browse files
committed
build: fix misc
1 parent b6d14a7 commit 20cd698

File tree

7 files changed

+308
-121
lines changed

7 files changed

+308
-121
lines changed

.bin/direnv

Lines changed: 25 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env bash
22
# shellcheck disable=SC2155
3-
# MIT License Copyright (c) 2022 ginokent https://github.com/versenv/versenv
3+
# LISENCE: https://github.com/versenv/versenv/blob/HEAD/LICENSE
44
set -Eeu -o pipefail
55

66
# versenv unique
@@ -48,22 +48,23 @@ ExecProgram() {
4848
exec "${prog_version_exe:?}" "$@" <&0
4949
}
5050

51-
# MIT License Copyright (c) 2021 ginokent https://github.com/rec-logger/rec.sh
51+
# LISENCE: https://github.com/kunitsucom/rec.sh/blob/HEAD/LICENSE
5252
# Common
53+
if [ -t 2 ]; then REC_COLOR=true; else REC_COLOR=''; fi
5354
_recRFC3339() { date "+%Y-%m-%dT%H:%M:%S%z" | sed "s/\(..\)$/:\1/"; }
5455
_recCmd() { for a in "$@"; do if echo "${a:-}" | grep -Eq "[[:blank:]]"; then printf "'%s' " "${a:-}"; else printf "%s " "${a:-}"; fi; done | sed "s/ $//"; }
5556
# Color
56-
RecDefault() { test " ${REC_SEVERITY:-0}" -gt 000 2>/dev/null || echo "$*" | awk "{print \"$(_recRFC3339) [\\033[0;35m DEFAULT\\033[0m] \"\$0\"\"}" 1>&2; }
57-
RecDebug() { test " ${REC_SEVERITY:-0}" -gt 100 2>/dev/null || echo "$*" | awk "{print \"$(_recRFC3339) [\\033[0;34m DEBUG\\033[0m] \"\$0\"\"}" 1>&2; }
58-
RecInfo() { test " ${REC_SEVERITY:-0}" -gt 200 2>/dev/null || echo "$*" | awk "{print \"$(_recRFC3339) [\\033[0;32m INFO\\033[0m] \"\$0\"\"}" 1>&2; }
59-
RecNotice() { test " ${REC_SEVERITY:-0}" -gt 300 2>/dev/null || echo "$*" | awk "{print \"$(_recRFC3339) [\\033[0;36m NOTICE\\033[0m] \"\$0\"\"}" 1>&2; }
60-
RecWarning() { test " ${REC_SEVERITY:-0}" -gt 400 2>/dev/null || echo "$*" | awk "{print \"$(_recRFC3339) [\\033[0;33m WARNING\\033[0m] \"\$0\"\"}" 1>&2; }
61-
RecError() { test " ${REC_SEVERITY:-0}" -gt 500 2>/dev/null || echo "$*" | awk "{print \"$(_recRFC3339) [\\033[0;31m ERROR\\033[0m] \"\$0\"\"}" 1>&2; }
62-
RecCritical() { test " ${REC_SEVERITY:-0}" -gt 600 2>/dev/null || echo "$*" | awk "{print \"$(_recRFC3339) [\\033[0;1;31m CRITICAL\\033[0m] \"\$0\"\"}" 1>&2; }
63-
RecAlert() { test " ${REC_SEVERITY:-0}" -gt 700 2>/dev/null || echo "$*" | awk "{print \"$(_recRFC3339) [\\033[0;41m ALERT\\033[0m] \"\$0\"\"}" 1>&2; }
64-
RecEmergency() { test "${REC_SEVERITY:-0}" -gt 800 2>/dev/null || echo "$*" | awk "{print \"$(_recRFC3339) [\\033[0;1;41mEMERGENCY\\033[0m] \"\$0\"\"}" 1>&2; }
57+
RecDefault() { test " ${REC_SEVERITY:-0}" -gt 000 2>/dev/null || echo "$*" | awk "{print \"$(_recRFC3339) [${REC_COLOR:+\\033[0;35m} DEFAULT${REC_COLOR:+\\033[0m}] \"\$0\"\"}" 1>&2; }
58+
RecDebug() { test " ${REC_SEVERITY:-0}" -gt 100 2>/dev/null || echo "$*" | awk "{print \"$(_recRFC3339) [${REC_COLOR:+\\033[0;34m} DEBUG${REC_COLOR:+\\033[0m}] \"\$0\"\"}" 1>&2; }
59+
RecInfo() { test " ${REC_SEVERITY:-0}" -gt 200 2>/dev/null || echo "$*" | awk "{print \"$(_recRFC3339) [${REC_COLOR:+\\033[0;32m} INFO${REC_COLOR:+\\033[0m}] \"\$0\"\"}" 1>&2; }
60+
RecNotice() { test " ${REC_SEVERITY:-0}" -gt 300 2>/dev/null || echo "$*" | awk "{print \"$(_recRFC3339) [${REC_COLOR:+\\033[0;36m} NOTICE${REC_COLOR:+\\033[0m}] \"\$0\"\"}" 1>&2; }
61+
RecWarning() { test " ${REC_SEVERITY:-0}" -gt 400 2>/dev/null || echo "$*" | awk "{print \"$(_recRFC3339) [${REC_COLOR:+\\033[0;33m} WARNING${REC_COLOR:+\\033[0m}] \"\$0\"\"}" 1>&2; }
62+
RecError() { test " ${REC_SEVERITY:-0}" -gt 500 2>/dev/null || echo "$*" | awk "{print \"$(_recRFC3339) [${REC_COLOR:+\\033[0;31m} ERROR${REC_COLOR:+\\033[0m}] \"\$0\"\"}" 1>&2; }
63+
RecCritical() { test " ${REC_SEVERITY:-0}" -gt 600 2>/dev/null || echo "$*" | awk "{print \"$(_recRFC3339) [${REC_COLOR:+\\033[0;1;31m} CRITICAL${REC_COLOR:+\\033[0m}] \"\$0\"\"}" 1>&2; }
64+
RecAlert() { test " ${REC_SEVERITY:-0}" -gt 700 2>/dev/null || echo "$*" | awk "{print \"$(_recRFC3339) [${REC_COLOR:+\\033[0;41m} ALERT${REC_COLOR:+\\033[0m}] \"\$0\"\"}" 1>&2; }
65+
RecEmergency() { test "${REC_SEVERITY:-0}" -gt 800 2>/dev/null || echo "$*" | awk "{print \"$(_recRFC3339) [${REC_COLOR:+\\033[0;1;41m}EMERGENCY${REC_COLOR:+\\033[0m}] \"\$0\"\"}" 1>&2; }
6566
RecExec() { RecInfo "$ $(_recCmd "$@")" && "$@"; }
66-
RecRun() { _dlm="####R#E#C#D#E#L#I#M#I#T#E#R####" _all=$({ _out=$("$@") && _rtn=$? || _rtn=$? && printf "\n%s" "${_dlm:?}${_out:-}" && return ${_rtn:-0}; } 2>&1) && _rtn=$? || _rtn=$? && _dlmno=$(echo "${_all:-}" | sed -n "/${_dlm:?}/=") && _cmd=$(_recCmd "$@") && _stdout=$(echo "${_all:-}" | tail -n +"${_dlmno:-1}" | sed "s/^${_dlm:?}//") && _stderr=$(echo "${_all:-}" | head -n "${_dlmno:-1}" | grep -v "^${_dlm:?}") && RecInfo "$ ${_cmd:-}" && { [ -z "${_stdout:-}" ] || RecInfo "${_stdout:?}"; } && { [ -z "${_stderr:-}" ] || RecWarning "${_stderr:?}"; } && return ${_rtn:-0}; }
67+
RecRun() { _dlm="####R#E#C#D#E#L#I#M#I#T#E#R####" && _all=$({ _out=$("$@") && _rtn=$? || _rtn=$? && printf "\n%s" "${_dlm:?}${_out:-}" && return "${_rtn:-0}"; } 2>&1) && _rtn=$? || _rtn=$? && _dlmno=$(echo "${_all:-}" | sed -n "/${_dlm:?}/=") && _cmd=$(_recCmd "$@") && _stdout=$(echo "${_all:-}" | tail -n +"${_dlmno:-1}" | sed "s/^${_dlm:?}//") && _stderr=$(echo "${_all:-}" | head -n "${_dlmno:-1}" | grep -v "^${_dlm:?}") && RecInfo "$ ${_cmd:-}" && { [ -z "${_stdout:-}" ] || RecInfo "${_stdout:?}"; } && { [ -z "${_stderr:-}" ] || RecWarning "${_stderr:?}"; } && return "${_rtn:-0}"; }
6768

6869
# versenv common
6970
DownloadURL() {
@@ -79,16 +80,18 @@ DownloadURL() {
7980
fi
8081
}
8182

82-
GetURL() {
83-
local url="${1:?}"
84-
if command -v wget >/dev/null; then
85-
wget --secure-protocol=TLSv1_2 --dns-timeout=2 --connect-timeout=2 -q -O- "${url:?}"
86-
elif command -v curl >/dev/null; then
87-
curl --tlsv1.2 --connect-timeout 2 -fLRSs "${url:?}"
88-
else
89-
RecCritical "command not found: curl or wget"
90-
exit 127
91-
fi
83+
GetURLs() {
84+
for arg in "$@"; do
85+
local url="${arg:?}"
86+
if command -v wget >/dev/null; then
87+
wget --secure-protocol=TLSv1_2 --dns-timeout=2 --connect-timeout=2 -q -O- "${url:?}"
88+
elif command -v curl >/dev/null; then
89+
curl --tlsv1.2 --connect-timeout 2 -fLRSs "${url:?}"
90+
else
91+
RecCritical "command not found: curl or wget"
92+
exit 127
93+
fi
94+
done
9295
}
9396

9497
HeadURL() {

.bin/golangci-lint

Lines changed: 28 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
#!/usr/bin/env bash
22
# shellcheck disable=SC2155
3-
# MIT License Copyright (c) 2022 ginokent https://github.com/versenv/versenv
3+
# LISENCE: https://github.com/versenv/versenv/blob/HEAD/LICENSE
44
set -Eeu -o pipefail
55

66
# versenv unique
77
exe_filename=golangci-lint
8-
env_key_version=GOLANGCI_VERSION
8+
env_key_version=GOLANGCI_LINT_VERSION
99
git_url_prefix=https://github.com/golangci/golangci-lint
1010

1111
GetProgramLatestStableVersion() { HeadURL "${git_url_prefix:?}/releases/latest" | awk -F"/tag/" "/^[Ll]ocation:/ {print \$2}" | tr -d "[:cntrl:]" | tr -d "^v" | tail -n 1; }
@@ -17,14 +17,9 @@ FindTargetZipDownloadURL() {
1717
local prog_os="${2:?}"
1818
local prog_arch="${3:?}"
1919
local path_suffix && path_suffix=$(
20-
if ! GetURL "${git_url_prefix:?}/releases" | grep -Eo "href=\"[^\"]+/v?${prog_version:?}/[^\"]*${prog_os:?}[^\"]*${prog_arch:?}[^\"]*\.(zip|tar|tgz|tar\.gz)" | sed 's/href="//'; then
21-
i=2
22-
until { GetURL "${git_url_prefix:?}/releases?page=${i:?}" | grep -Eo "href=\"[^\"]+/v?${prog_version:?}/[^\"]*${prog_os:?}[^\"]*${prog_arch:?}[^\"]*\.(zip|tar|tgz|tar\.gz)" | sed 's/href="//'; }; do
23-
i=$((i+1))
24-
done
25-
fi
20+
GetURLs "${git_url_prefix:?}/releases/expanded_assets/"{,v}"${prog_version:?}" | grep -Eo "href=\"[^\"]+/v?${prog_version:?}/[^\"]*${prog_os:?}[^\"]*${prog_arch:?}[^\"]*\.(zip|tar|tgz|tar\.gz)" | sed 's/href="//'
2621
)
27-
echo "https://github.com/${path_suffix:?}"
22+
echo "https://github.com${path_suffix:?}"
2823
}
2924

3025
Unzip() {
@@ -79,22 +74,23 @@ ExecProgram() {
7974
exec "${prog_version_exe:?}" "$@" <&0
8075
}
8176

82-
# MIT License Copyright (c) 2021 ginokent https://github.com/rec-logger/rec.sh
77+
# LISENCE: https://github.com/kunitsucom/rec.sh/blob/HEAD/LICENSE
8378
# Common
79+
if [ -t 2 ]; then REC_COLOR=true; else REC_COLOR=''; fi
8480
_recRFC3339() { date "+%Y-%m-%dT%H:%M:%S%z" | sed "s/\(..\)$/:\1/"; }
8581
_recCmd() { for a in "$@"; do if echo "${a:-}" | grep -Eq "[[:blank:]]"; then printf "'%s' " "${a:-}"; else printf "%s " "${a:-}"; fi; done | sed "s/ $//"; }
8682
# Color
87-
RecDefault() { test " ${REC_SEVERITY:-0}" -gt 000 2>/dev/null || echo "$*" | awk "{print \"$(_recRFC3339) [\\033[0;35m DEFAULT\\033[0m] \"\$0\"\"}" 1>&2; }
88-
RecDebug() { test " ${REC_SEVERITY:-0}" -gt 100 2>/dev/null || echo "$*" | awk "{print \"$(_recRFC3339) [\\033[0;34m DEBUG\\033[0m] \"\$0\"\"}" 1>&2; }
89-
RecInfo() { test " ${REC_SEVERITY:-0}" -gt 200 2>/dev/null || echo "$*" | awk "{print \"$(_recRFC3339) [\\033[0;32m INFO\\033[0m] \"\$0\"\"}" 1>&2; }
90-
RecNotice() { test " ${REC_SEVERITY:-0}" -gt 300 2>/dev/null || echo "$*" | awk "{print \"$(_recRFC3339) [\\033[0;36m NOTICE\\033[0m] \"\$0\"\"}" 1>&2; }
91-
RecWarning() { test " ${REC_SEVERITY:-0}" -gt 400 2>/dev/null || echo "$*" | awk "{print \"$(_recRFC3339) [\\033[0;33m WARNING\\033[0m] \"\$0\"\"}" 1>&2; }
92-
RecError() { test " ${REC_SEVERITY:-0}" -gt 500 2>/dev/null || echo "$*" | awk "{print \"$(_recRFC3339) [\\033[0;31m ERROR\\033[0m] \"\$0\"\"}" 1>&2; }
93-
RecCritical() { test " ${REC_SEVERITY:-0}" -gt 600 2>/dev/null || echo "$*" | awk "{print \"$(_recRFC3339) [\\033[0;1;31m CRITICAL\\033[0m] \"\$0\"\"}" 1>&2; }
94-
RecAlert() { test " ${REC_SEVERITY:-0}" -gt 700 2>/dev/null || echo "$*" | awk "{print \"$(_recRFC3339) [\\033[0;41m ALERT\\033[0m] \"\$0\"\"}" 1>&2; }
95-
RecEmergency() { test "${REC_SEVERITY:-0}" -gt 800 2>/dev/null || echo "$*" | awk "{print \"$(_recRFC3339) [\\033[0;1;41mEMERGENCY\\033[0m] \"\$0\"\"}" 1>&2; }
83+
RecDefault() { test " ${REC_SEVERITY:-0}" -gt 000 2>/dev/null || echo "$*" | awk "{print \"$(_recRFC3339) [${REC_COLOR:+\\033[0;35m} DEFAULT${REC_COLOR:+\\033[0m}] \"\$0\"\"}" 1>&2; }
84+
RecDebug() { test " ${REC_SEVERITY:-0}" -gt 100 2>/dev/null || echo "$*" | awk "{print \"$(_recRFC3339) [${REC_COLOR:+\\033[0;34m} DEBUG${REC_COLOR:+\\033[0m}] \"\$0\"\"}" 1>&2; }
85+
RecInfo() { test " ${REC_SEVERITY:-0}" -gt 200 2>/dev/null || echo "$*" | awk "{print \"$(_recRFC3339) [${REC_COLOR:+\\033[0;32m} INFO${REC_COLOR:+\\033[0m}] \"\$0\"\"}" 1>&2; }
86+
RecNotice() { test " ${REC_SEVERITY:-0}" -gt 300 2>/dev/null || echo "$*" | awk "{print \"$(_recRFC3339) [${REC_COLOR:+\\033[0;36m} NOTICE${REC_COLOR:+\\033[0m}] \"\$0\"\"}" 1>&2; }
87+
RecWarning() { test " ${REC_SEVERITY:-0}" -gt 400 2>/dev/null || echo "$*" | awk "{print \"$(_recRFC3339) [${REC_COLOR:+\\033[0;33m} WARNING${REC_COLOR:+\\033[0m}] \"\$0\"\"}" 1>&2; }
88+
RecError() { test " ${REC_SEVERITY:-0}" -gt 500 2>/dev/null || echo "$*" | awk "{print \"$(_recRFC3339) [${REC_COLOR:+\\033[0;31m} ERROR${REC_COLOR:+\\033[0m}] \"\$0\"\"}" 1>&2; }
89+
RecCritical() { test " ${REC_SEVERITY:-0}" -gt 600 2>/dev/null || echo "$*" | awk "{print \"$(_recRFC3339) [${REC_COLOR:+\\033[0;1;31m} CRITICAL${REC_COLOR:+\\033[0m}] \"\$0\"\"}" 1>&2; }
90+
RecAlert() { test " ${REC_SEVERITY:-0}" -gt 700 2>/dev/null || echo "$*" | awk "{print \"$(_recRFC3339) [${REC_COLOR:+\\033[0;41m} ALERT${REC_COLOR:+\\033[0m}] \"\$0\"\"}" 1>&2; }
91+
RecEmergency() { test "${REC_SEVERITY:-0}" -gt 800 2>/dev/null || echo "$*" | awk "{print \"$(_recRFC3339) [${REC_COLOR:+\\033[0;1;41m}EMERGENCY${REC_COLOR:+\\033[0m}] \"\$0\"\"}" 1>&2; }
9692
RecExec() { RecInfo "$ $(_recCmd "$@")" && "$@"; }
97-
RecRun() { _dlm="####R#E#C#D#E#L#I#M#I#T#E#R####" _all=$({ _out=$("$@") && _rtn=$? || _rtn=$? && printf "\n%s" "${_dlm:?}${_out:-}" && return ${_rtn:-0}; } 2>&1) && _rtn=$? || _rtn=$? && _dlmno=$(echo "${_all:-}" | sed -n "/${_dlm:?}/=") && _cmd=$(_recCmd "$@") && _stdout=$(echo "${_all:-}" | tail -n +"${_dlmno:-1}" | sed "s/^${_dlm:?}//") && _stderr=$(echo "${_all:-}" | head -n "${_dlmno:-1}" | grep -v "^${_dlm:?}") && RecInfo "$ ${_cmd:-}" && { [ -z "${_stdout:-}" ] || RecInfo "${_stdout:?}"; } && { [ -z "${_stderr:-}" ] || RecWarning "${_stderr:?}"; } && return ${_rtn:-0}; }
93+
RecRun() { _dlm="####R#E#C#D#E#L#I#M#I#T#E#R####" && _all=$({ _out=$("$@") && _rtn=$? || _rtn=$? && printf "\n%s" "${_dlm:?}${_out:-}" && return "${_rtn:-0}"; } 2>&1) && _rtn=$? || _rtn=$? && _dlmno=$(echo "${_all:-}" | sed -n "/${_dlm:?}/=") && _cmd=$(_recCmd "$@") && _stdout=$(echo "${_all:-}" | tail -n +"${_dlmno:-1}" | sed "s/^${_dlm:?}//") && _stderr=$(echo "${_all:-}" | head -n "${_dlmno:-1}" | grep -v "^${_dlm:?}") && RecInfo "$ ${_cmd:-}" && { [ -z "${_stdout:-}" ] || RecInfo "${_stdout:?}"; } && { [ -z "${_stderr:-}" ] || RecWarning "${_stderr:?}"; } && return "${_rtn:-0}"; }
9894

9995
# versenv common
10096
DownloadURL() {
@@ -110,16 +106,18 @@ DownloadURL() {
110106
fi
111107
}
112108

113-
GetURL() {
114-
local url="${1:?}"
115-
if command -v wget >/dev/null; then
116-
wget --secure-protocol=TLSv1_2 --dns-timeout=2 --connect-timeout=2 -q -O- "${url:?}"
117-
elif command -v curl >/dev/null; then
118-
curl --tlsv1.2 --connect-timeout 2 -fLRSs "${url:?}"
119-
else
120-
RecCritical "command not found: curl or wget"
121-
exit 127
122-
fi
109+
GetURLs() {
110+
for arg in "$@"; do
111+
local url="${arg:?}"
112+
if command -v wget >/dev/null; then
113+
wget --secure-protocol=TLSv1_2 --dns-timeout=2 --connect-timeout=2 -q -O- "${url:?}"
114+
elif command -v curl >/dev/null; then
115+
curl --tlsv1.2 --connect-timeout 2 -fLRSs "${url:?}"
116+
else
117+
RecCritical "command not found: curl or wget"
118+
exit 127
119+
fi
120+
done
123121
}
124122

125123
HeadURL() {

.github/workflows/ci.yml

Lines changed: 0 additions & 67 deletions
This file was deleted.

.github/workflows/go-lint.yml

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
name: go-lint
2+
# ~~~~~~~
3+
# https://github.com/kunitsucom/ilog.go/workflows/go-lint/badge.svg
4+
# ~~~~~~~
5+
6+
on:
7+
push:
8+
branches:
9+
- main
10+
paths-ignore:
11+
- '.github/dependabot.yml'
12+
- '.github/pull_request_template.md'
13+
- '.github/release.yml'
14+
- 'README.md'
15+
pull_request:
16+
# branches:
17+
# - main
18+
paths-ignore:
19+
- '.github/dependabot.yml'
20+
- '.github/pull_request_template.md'
21+
- '.github/release.yml'
22+
- 'README.md'
23+
workflow_dispatch:
24+
inputs: {}
25+
26+
# NOTE: 連続で commit & push した時に最新の commit 以外のワークフローをキャンセルする
27+
concurrency:
28+
group: ${{ github.workflow }}-${{ github.base_ref }}-${{ github.head_ref }}-${{ github.ref }}
29+
cancel-in-progress: true
30+
31+
permissions:
32+
id-token: write
33+
contents: read
34+
35+
env:
36+
WORKDIR: .
37+
38+
defaults:
39+
run:
40+
shell: bash
41+
42+
jobs:
43+
go-lint: # NOTE: for Branch protection rule `Status checks that are required.`
44+
runs-on: ubuntu-latest # ref. https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-syntax-for-github-actions#jobsjob_idruns-on
45+
steps:
46+
- uses: actions/checkout@v3
47+
- name: DEBUG
48+
run: |
49+
cat <<'DEBUG_DOC'
50+
== DEBUG =======================================================
51+
github.ref: ${{ github.ref }}
52+
github.event_name: ${{ github.event_name }}
53+
-- toJSON(github.event.inputs) ---------------------------------
54+
${{ toJSON(github.event.inputs) }}
55+
-- toJSON(github) ----------------------------------------------
56+
${{ toJSON(github) }}
57+
================================================================
58+
DEBUG_DOC
59+
shell: bash
60+
- name: actions/cache for versenv
61+
uses: actions/cache@v3
62+
with:
63+
path: |
64+
~/.cache/versenv
65+
key: versenv-${{ runner.os }}-${{ hashFiles('**/.versenv.env') }}
66+
restore-keys: |
67+
versenv-${{ runner.os }}-
68+
- name: Add GITHUB_PATH, GITHUB_ENV
69+
run: |
70+
# Update GITHUB_PATH
71+
cat <<GITHUB_PATH >> $GITHUB_PATH
72+
${PWD}/${{ env.WORKDIR }}/.local/bin
73+
${PWD}/.bin
74+
GITHUB_PATH
75+
# Update GITHUB_ENV
76+
grep -Ev '^\s*$|^\s*#' .versenv.env >> $GITHUB_ENV
77+
- name: Setup versenv
78+
run: |
79+
# Setup versenv
80+
direnv allow ${{ env.WORKDIR }}
81+
make versenv
82+
- uses: actions/setup-go@v4 # ref. https://github.com/actions/setup-go#usage
83+
id: setup-go
84+
with:
85+
cache: false
86+
go-version-file: ${{ env.WORKDIR }}/go.mod
87+
- name: Get Golang info
88+
id: golang-info
89+
run: |
90+
echo "GOVERSION=$(go version | cut -d' ' -f3)" >> "$GITHUB_OUTPUT"
91+
echo "GOCACHE=$(go env GOCACHE)" >> "$GITHUB_OUTPUT"
92+
- name: actions/cache for go
93+
uses: actions/cache@v3
94+
with:
95+
path: |
96+
~/go/pkg/mod
97+
${{ steps.golang-info.outputs.GOCACHE }}
98+
key: ${{ runner.os }}-go-${{ steps.golang-info.outputs.GOVERSION }}-${{ hashFiles('**/go.sum') }}-${{ hashFiles('**/*.go') }}
99+
restore-keys: |
100+
${{ runner.os }}-go-${{ steps.golang-info.outputs.GOVERSION }}-${{ hashFiles('**/go.sum') }}-
101+
${{ runner.os }}-go-${{ steps.golang-info.outputs.GOVERSION }}-
102+
${{ runner.os }}-go-
103+
- name: Run go mod tidy
104+
if: ${{ steps.setup-go.outputs.cache-hit != 'true' }}
105+
env:
106+
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }}
107+
working-directory: ${{ env.WORKDIR }}
108+
run: |
109+
direnv exec . go mod tidy
110+
git diff --exit-code go.mod go.sum
111+
- uses: golangci/[email protected] # ref. https://github.com/golangci/golangci-lint-action#how-to-use
112+
with:
113+
working-directory: ${{ env.WORKDIR }}
114+
args: --timeout=600s
115+
version: ${{ env.GOLANGCI_LINT_VERSION }}

0 commit comments

Comments
 (0)