Skip to content

Commit

Permalink
ci: fix misc
Browse files Browse the repository at this point in the history
  • Loading branch information
ginokent committed Oct 29, 2023
1 parent e2b6ae3 commit 11ef842
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 14 deletions.
23 changes: 14 additions & 9 deletions .github/workflows/go-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: DEBUG
shell: bash
run: |
cat <<'DEBUG_DOC'
== DEBUG =======================================================
Expand All @@ -59,7 +60,6 @@ jobs:
${{ toJSON(github) }}
================================================================
DEBUG_DOC
shell: bash
- name: actions/cache for versenv
uses: actions/cache@v3
with:
Expand All @@ -69,6 +69,7 @@ jobs:
restore-keys: |
versenv-${{ runner.os }}-
- name: Add GITHUB_PATH, GITHUB_ENV
shell: bash
run: |
# Update GITHUB_PATH
cat <<GITHUB_PATH >> $GITHUB_PATH
Expand All @@ -79,6 +80,7 @@ jobs:
# Update GITHUB_ENV
grep -Ev '^\s*$|^\s*#' .versenv.env >> $GITHUB_ENV
- name: Setup versenv
shell: bash
run: |
# Setup versenv
direnv allow ${{ env.WORKDIR }}
Expand All @@ -90,6 +92,7 @@ jobs:
go-version-file: ${{ env.WORKDIR }}/go.mod
- name: Get Golang info
id: golang-info
shell: bash
run: |
echo "GOVERSION=$(go version | cut -d' ' -f3)" >> "$GITHUB_OUTPUT"
echo "GOCACHE=$(go env GOCACHE)" >> "$GITHUB_OUTPUT"
Expand All @@ -104,14 +107,16 @@ jobs:
${{ runner.os }}-go-${{ steps.golang-info.outputs.GOVERSION }}-${{ hashFiles('**/go.sum') }}-
${{ runner.os }}-go-${{ steps.golang-info.outputs.GOVERSION }}-
${{ runner.os }}-go-
# - name: Run go mod tidy
# if: ${{ steps.setup-go.outputs.cache-hit != 'true' }}
# env:
# DEBIAN_FRONTEND: noninteractive
# # GITHUB_TOKEN: ${{ secrets.GH_BOT_TOKEN }}
# working-directory: ${{ env.WORKDIR }}
# run: |
# direnv exec . go-mod-tidy-all
- name: Setup git config for go mod download
env:
DEBIAN_FRONTEND: noninteractive
# GITHUB_TOKEN: ${{ secrets.GH_BOT_TOKEN }}
working-directory: ${{ env.WORKDIR }}
shell: bash
run: |
set -Eeu -o pipefail -x
direnv allow .
direnv exec . bash -Eeux -o pipefail -c 'echo "${GOPRIVATE:-}${GOPRIVATE+,}" | while read -d , -r LINE; do echo "set git config: ${LINE}"; git config --global url."https://${GITHUB_TOKEN}:x-oauth-basic@${LINE}".insteadOf "https://${LINE}"; done'
- uses: golangci/[email protected] # ref. https://github.com/golangci/golangci-lint-action#how-to-use
with:
working-directory: ${{ env.WORKDIR }}
Expand Down
16 changes: 15 additions & 1 deletion .github/workflows/go-mod-tidy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ jobs:
with:
ref: ${{ github.event.pull_request.head.ref }} # needed for gh pr view
- name: DEBUG
shell: bash
run: |
cat <<'DEBUG_DOC'
== DEBUG =======================================================
Expand All @@ -56,7 +57,6 @@ jobs:
${{ toJSON(github) }}
================================================================
DEBUG_DOC
shell: bash
- name: actions/cache for versenv
uses: actions/cache@v3
with:
Expand All @@ -66,6 +66,7 @@ jobs:
restore-keys: |
versenv-${{ runner.os }}-
- name: Add GITHUB_PATH, GITHUB_ENV
shell: bash
run: |
# Update GITHUB_PATH
cat <<GITHUB_PATH >> $GITHUB_PATH
Expand All @@ -76,6 +77,7 @@ jobs:
# Update GITHUB_ENV
grep -Ev '^\s*$|^\s*#' .versenv.env >> $GITHUB_ENV
- name: Setup versenv
shell: bash
run: |
# Setup versenv
direnv allow ${{ env.WORKDIR }}
Expand All @@ -87,6 +89,7 @@ jobs:
go-version-file: ${{ env.WORKDIR }}/go.mod
- name: Get Golang info
id: golang-info
shell: bash
run: |
echo "GOVERSION=$(go version | cut -d' ' -f3)" >> "$GITHUB_OUTPUT"
echo "GOCACHE=$(go env GOCACHE)" >> "$GITHUB_OUTPUT"
Expand All @@ -101,12 +104,23 @@ jobs:
${{ runner.os }}-go-${{ steps.golang-info.outputs.GOVERSION }}-${{ hashFiles('**/go.sum') }}-
${{ runner.os }}-go-${{ steps.golang-info.outputs.GOVERSION }}-
${{ runner.os }}-go-
- name: Setup git config for go mod download
env:
DEBIAN_FRONTEND: noninteractive
# GITHUB_TOKEN: ${{ secrets.GH_BOT_TOKEN }}
working-directory: ${{ env.WORKDIR }}
shell: bash
run: |
set -Eeu -o pipefail -x
direnv allow .
direnv exec . bash -Eeux -o pipefail -c 'echo "${GOPRIVATE:-}${GOPRIVATE+,}" | while read -d , -r LINE; do echo "set git config: ${LINE}"; git config --global url."https://${GITHUB_TOKEN}:x-oauth-basic@${LINE}".insteadOf "https://${LINE}"; done'
- name: Run go mod tidy
if: ${{ steps.setup-go.outputs.cache-hit != 'true' }}
env:
DEBIAN_FRONTEND: noninteractive
# GITHUB_TOKEN: ${{ secrets.GH_BOT_TOKEN }}
working-directory: ${{ env.WORKDIR }}
shell: bash
run: |
direnv exec . go-mod-tidy-all
git config --local user.name "github-actions[bot]"
Expand Down
16 changes: 15 additions & 1 deletion .github/workflows/go-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: DEBUG
shell: bash
run: |
cat <<'DEBUG_DOC'
== DEBUG =======================================================
Expand All @@ -59,7 +60,6 @@ jobs:
${{ toJSON(github) }}
================================================================
DEBUG_DOC
shell: bash
- name: actions/cache for versenv
uses: actions/cache@v3
with:
Expand Down Expand Up @@ -90,6 +90,7 @@ jobs:
go-version-file: ${{ env.WORKDIR }}/go.mod
- name: Get Golang info
id: golang-info
shell: bash
run: |
echo "GOVERSION=$(go version | cut -d' ' -f3)" >> "$GITHUB_OUTPUT"
echo "GOCACHE=$(go env GOCACHE)" >> "$GITHUB_OUTPUT"
Expand All @@ -104,12 +105,25 @@ jobs:
${{ runner.os }}-go-${{ steps.golang-info.outputs.GOVERSION }}-${{ hashFiles('**/go.sum') }}-
${{ runner.os }}-go-${{ steps.golang-info.outputs.GOVERSION }}-
${{ runner.os }}-go-
- name: Setup git config for go mod download
env:
DEBIAN_FRONTEND: noninteractive
# GITHUB_TOKEN: ${{ secrets.GH_BOT_TOKEN }}
working-directory: ${{ env.WORKDIR }}
shell: bash
run: |
set -Eeu -o pipefail -x
direnv allow .
direnv exec . bash -Eeux -o pipefail -c 'echo "${GOPRIVATE:-}${GOPRIVATE+,}" | while read -d , -r LINE; do echo "set git config: ${LINE}"; git config --global url."https://${GITHUB_TOKEN}:x-oauth-basic@${LINE}".insteadOf "https://${LINE}"; done'
- name: Run go test
env:
DEBIAN_FRONTEND: noninteractive
# GITHUB_TOKEN: ${{ secrets.GH_BOT_TOKEN }}
working-directory: ${{ env.WORKDIR }}
shell: bash
run: |
set -Eeu -o pipefail -x
direnv allow .
direnv exec . make test
- uses: codecov/codecov-action@v3 # ref. https://github.com/codecov/codecov-action#example-workflowyml-with-codecov-action
with:
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/go-vuln.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: DEBUG
shell: bash
run: |
cat <<'DEBUG_DOC'
== DEBUG =======================================================
Expand All @@ -60,7 +61,6 @@ jobs:
${{ toJSON(github) }}
================================================================
DEBUG_DOC
shell: bash
- name: actions/cache for versenv
uses: actions/cache@v3
with:
Expand All @@ -70,6 +70,7 @@ jobs:
restore-keys: |
versenv-${{ runner.os }}-
- name: Add GITHUB_PATH, GITHUB_ENV
shell: bash
run: |
# Update GITHUB_PATH
cat <<GITHUB_PATH >> $GITHUB_PATH
Expand All @@ -80,6 +81,7 @@ jobs:
# Update GITHUB_ENV
grep -Ev '^\s*$|^\s*#' .versenv.env >> $GITHUB_ENV
- name: Setup versenv
shell: bash
run: |
# Setup versenv
direnv allow ${{ env.WORKDIR }}
Expand All @@ -91,6 +93,7 @@ jobs:
go-version-file: ${{ env.WORKDIR }}/go.mod
- name: Get Golang info
id: golang-info
shell: bash
run: |
echo "GOVERSION=$(go version | cut -d' ' -f3)" >> "$GITHUB_OUTPUT"
echo "GOCACHE=$(go env GOCACHE)" >> "$GITHUB_OUTPUT"
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/label-checker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
- opened
- edited
- labeled
- unlabeled
- ready_for_review
- reopened
- synchronize
Expand All @@ -22,7 +23,8 @@ jobs:
id-token: write
contents: read
pull-requests: read
statuses: write
statuses: read
checks: read
steps:
- uses: actions/checkout@v4
with:
Expand All @@ -42,7 +44,7 @@ jobs:
# Add labels based on PR title
GH_PR_TITLE=$(gh pr view --json title --jq .title)
gh label list --json name --jq ".[].name" | while read -r LINE; do echo "${GH_PR_TITLE:?}" | awk -F: "/^${LINE-}:/ {print \$1}" ; done | xargs -t -I{} gh pr edit --add-label {}
gh label list --json name --jq ".[].name" | while read -r LINE; do awk -F: "/^${LINE-}(\([^\)]+\))?:/ {print \$1}" <<<"${GH_PR_TITLE:?}" ; done | xargs -t -I{} gh pr edit --add-label {}
# If any of the labels are present, exit with success
while read -r LINE; do
Expand Down

0 comments on commit 11ef842

Please sign in to comment.