-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #357 from jumpserver/pr@dev@perf_actions_build
perf: 优化 actions 构建
- Loading branch information
Showing
5 changed files
with
176 additions
and
25 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
name: golangci-lint | ||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- dev | ||
|
||
permissions: | ||
contents: read | ||
# Optional: allow read access to pull request. Use with `only-new-issues` option. | ||
# pull-requests: read | ||
|
||
jobs: | ||
golangci: | ||
name: lint | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Create ui/dist directory | ||
run: | | ||
mkdir -p ui/dist | ||
touch ui/dist/.gitkeep | ||
- uses: actions/setup-go@v5 | ||
with: | ||
go-version: stable | ||
|
||
- uses: golangci/golangci-lint-action@v6 | ||
with: | ||
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version | ||
version: latest | ||
|
||
# Optional: working directory, useful for monorepos | ||
# working-directory: somedir | ||
|
||
# Optional: golangci-lint command line arguments. | ||
# args: --issues-exit-code=0 | ||
|
||
# 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 all caching functionality will be complete disabled, | ||
# takes precedence over all other caching options. | ||
# skip-cache: true | ||
|
||
# Optional: if set to true then the action don't cache or restore ~/go/pkg. | ||
# skip-pkg-cache: true | ||
|
||
# Optional: if set to true then the action don't cache or restore ~/.cache/go-build. | ||
# skip-build-cache: true |
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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
run: | ||
timeout: 5m | ||
modules-download-mode: readonly | ||
|
||
issues: | ||
exclude-dirs: | ||
- docs | ||
- ui | ||
- .git | ||
|
||
exclude-files: | ||
- pkg/utils/terminal.go | ||
|
||
linters: | ||
enable: | ||
- govet | ||
- staticcheck | ||
|
||
output: | ||
format: colored-line-number |
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 |
---|---|---|
@@ -0,0 +1,70 @@ | ||
# yaml-language-server: $schema=https://goreleaser.com/static/schema.json | ||
version: 2 | ||
|
||
project_name: lion | ||
|
||
before: | ||
hooks: | ||
- go mod tidy | ||
- go generate ./... | ||
|
||
snapshot: | ||
version_template: "{{ .Tag }}-next" | ||
|
||
builds: | ||
- id: lion | ||
main: main.go | ||
binary: lion | ||
goos: | ||
- linux | ||
- darwin | ||
- freebsd | ||
- netbsd | ||
goarch: | ||
- amd64 | ||
- arm64 | ||
- mips64le | ||
- ppc64le | ||
- s390x | ||
- riscv64 | ||
- loong64 | ||
env: | ||
- CGO_ENABLED=0 | ||
ldflags: | ||
- -w -s | ||
- -X 'main.Buildstamp={{ .Date }}' | ||
- -X 'main.Githash={{ .ShortCommit }}' | ||
- -X 'main.Goversion={{ .Env.GOVERSION }}' | ||
- -X 'main.Version={{ .Tag }}' | ||
|
||
archives: | ||
- format: tar.gz | ||
wrap_in_directory: true | ||
files: | ||
- LICENSE | ||
- README.md | ||
- config_example.yml | ||
- ui/dist/** | ||
|
||
format_overrides: | ||
- goos: windows | ||
format: zip | ||
name_template: "{{ .ProjectName }}-{{ .Tag }}-{{ .Os }}-{{ .Arch }}{{- if .Arm }}v{{ .Arm }}{{ end }}" | ||
|
||
checksum: | ||
name_template: "{{ .ProjectName }}_checksums.txt" | ||
|
||
release: | ||
draft: true | ||
mode: append | ||
extra_files: | ||
- glob: dist/*.tar.gz | ||
- glob: dist/*.txt | ||
name_template: "Release {{.Tag}}" | ||
|
||
changelog: | ||
sort: asc | ||
filters: | ||
exclude: | ||
- "^docs:" | ||
- "^test:" |
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