Skip to content

Commit

Permalink
chore(ci): rewrite backend ci
Browse files Browse the repository at this point in the history
  • Loading branch information
tosuke committed Dec 17, 2024
1 parent 2e5b570 commit 671f327
Showing 1 changed file with 46 additions and 41 deletions.
87 changes: 46 additions & 41 deletions .github/workflows/backend-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,64 +24,69 @@ jobs:
with:
go_version_file: backend/go.mod
workdir: backend
fail_on_error: true
fail_level: error

Check failure on line 27 in .github/workflows/backend-ci.yml

View workflow job for this annotation

GitHub Actions / actionlint

[actionlint] .github/workflows/backend-ci.yml#L27

input "fail_level" is not defined in action "reviewdog/action-golangci-lint@v2". available inputs are "cache", "fail_on_error", "filter_mode", "github_token", "go_version", "go_version_file", "golangci_lint_flags", "golangci_lint_version", "level", "reporter", "reviewdog_flags", "reviewdog_version", "tool_name", "workdir" [action]
Raw output
.github/workflows/backend-ci.yml:27:11: input "fail_level" is not defined in action "reviewdog/action-golangci-lint@v2". available inputs are "cache", "fail_on_error", "filter_mode", "github_token", "go_version", "go_version_file", "golangci_lint_flags", "golangci_lint_version", "level", "reporter", "reviewdog_flags", "reviewdog_version", "tool_name", "workdir" [action]
filter_mode: nofilter
golangci_lint_flags: --timeout=10m
format:
name: Format
generate:
name: Generate
runs-on: ubuntu-latest
steps:
- name: Generate a token
id: token
uses: actions/create-github-app-token@v1
with:
app-id: ${{ secrets.PUSHER_APP_ID }}
private-key: ${{ secrets.PUSHER_PRIVATE_KEY }}
- name: Checkout
uses: actions/checkout@v4
with:
token: ${{ steps.token.outputs.token }}
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: backend/go.mod
cache-dependency-path: backend/go.sum
- name: Mod Tidy
run: go mod tidy
- name: Install Format Tools
run: |
go install golang.org/x/tools/cmd/[email protected]
go install mvdan.cc/[email protected]
- name: Run Format Tools
run: |
find . -type f -name '*.go' -not -path "*/internal/proto/*" | while IFS='' read -r file; do goimports -l -w "$file"; done
gofumpt -l -w .
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
go-version: 1.23
cache: false
- uses: actions/cache/restore@v4
id: go-cache
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: go-${{ hashFiles('backend/go.sum') }}
restore-keys: |
go-
- name: Go Generate
run: go generate -x ./...
- name: Check Diff
run: git diff --exit-code
- uses: actions/cache/save@v4
if: steps.go-cache.outputs.cache-hit != 'true' && github.ref == 'refs/heads/main'
with:
go-version-file: backend/go.mod
cache-dependency-path: backend/go.sum
- name: Mod Download
run: go mod download
- name: Build
run: CGO_ENABLED=0 go build -ldflags "-s -w" -trimpath .
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ steps.go-cache.outputs.cache-primary-key }}
test:
name: Test
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: backend/go.mod
cache-dependency-path: backend/go.sum
go-version: 1.23
cache: false
- uses: actions/cache/restore@v4
id: go-cache
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: go-${{ hashFiles('backend/go.sum') }}
restore-keys: |
go-
- name: Go Modules
if: steps.go-cache.outputs.cache-hit != 'true'
run: go mod download -x
- name: Run Test
run: go test ./... -v
run: go test -race -shuffle on -parallel 8 -v ./...
- uses: actions/cache/save@v4
if: steps.go-cache.outputs.cache-hit != 'true' && github.ref == 'refs/heads/main'
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ steps.go-cache.outputs.cache-primary-key }}

0 comments on commit 671f327

Please sign in to comment.