fix: make lint&ci happy

This commit is contained in:
源文雨 2025-10-01 00:03:23 +08:00
parent aa67d09ee1
commit 06b8b518f8
5 changed files with 6 additions and 44 deletions

View File

@ -1,42 +0,0 @@
name: 打包最新版为 Docker Image
on: [push]
jobs:
docker-builder:
name: build docker
runs-on: ubuntu-23.04
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@master
- run: sudo apt-get install -y qemu-user-static
- name: Set up nix
uses: cachix/install-nix-action@v27
with:
nix_path: nixpkgs=channel:nixos-unstable
extra_nix_config: |
sandbox = true
- name: Speed Up nix
uses: DeterminateSystems/magic-nix-cache-action@main
- name: build docker
run: |
mkdir output/
# https://discourse.nixos.org/t/nix-github-actions-aarch64/11034
nix build .#packages.aarch64-linux.docker_builder -o aarch64-linux.docker --print-out-paths --option system aarch64-linux --extra-platforms aarch64-linux
cp $(readlink aarch64-linux.docker) ./output/aarch64-linux.docker.tar.gz
nix build .#packages.x86_64-linux.docker_builder -o x86_64-linux.docker --print-out-paths --option system x86_64-linux --extra-platforms x86_64-linux
cp $(readlink x86_64-linux.docker) ./output/x86_64-linux.docker.tar.gz
# gomod2nix did not provide this
# nix build .#packages.i686-linux.docker_builder -o i686-linux.docker --print-out-paths --option system i686-linux --extra-platforms i686-linux
# cp $(readlink i686-linux.docker) ./output/i686-linux.docker.tar.gz
- name: Upload artifact
uses: actions/upload-artifact@master
if: ${{ !github.head_ref }}
with:
path: output/

View File

@ -6,7 +6,7 @@ env:
BINARY_PREFIX: "zbp_" BINARY_PREFIX: "zbp_"
BINARY_SUFFIX: "" BINARY_SUFFIX: ""
PR_PROMPT: "::warning:: Build artifact will not be uploaded due to the workflow is trigged by pull request." PR_PROMPT: "::warning:: Build artifact will not be uploaded due to the workflow is trigged by pull request."
LD_FLAGS: "-w -s" LD_FLAGS: "-w -s -checklinkname=0"
jobs: jobs:
build: build:
@ -45,6 +45,7 @@ jobs:
GOARCH: ${{ matrix.goarch }} GOARCH: ${{ matrix.goarch }}
IS_PR: ${{ !!github.head_ref }} IS_PR: ${{ !!github.head_ref }}
run: | run: |
if [ ! -f custom/register.go ]; then touch custom/register.go; fi
go generate ./... go generate ./...
if [ $GOOS = "windows" ]; then export BINARY_SUFFIX="$BINARY_SUFFIX.exe"; fi if [ $GOOS = "windows" ]; then export BINARY_SUFFIX="$BINARY_SUFFIX.exe"; fi
if $IS_PR ; then echo $PR_PROMPT; fi if $IS_PR ; then echo $PR_PROMPT; fi

View File

@ -36,6 +36,7 @@ jobs:
- name: Tidy Modules - name: Tidy Modules
run: | run: |
go mod tidy go mod tidy
if [ ! -f custom/register.go ]; then touch custom/register.go; fi
go generate ./... go generate ./...
- name: golangci-lint - name: golangci-lint

View File

@ -16,6 +16,7 @@ jobs:
- name: Tidy Modules - name: Tidy Modules
run: | run: |
go mod tidy go mod tidy
if [ ! -f custom/register.go ]; then touch custom/register.go; fi
go generate ./... go generate ./...
- name: Run Lint - name: Run Lint

View File

@ -4,6 +4,7 @@ env:
before: before:
hooks: hooks:
- go mod tidy - go mod tidy
- if [ ! -f custom/register.go ]; then touch custom/register.go; fi
- go generate ./... - go generate ./...
- go install github.com/tc-hib/go-winres@latest - go install github.com/tc-hib/go-winres@latest
- go-winres make - go-winres make
@ -26,7 +27,7 @@ builds:
flags: flags:
- -trimpath - -trimpath
ldflags: ldflags:
- -s -w - -s -w -checklinkname=0
- id: win - id: win
env: env:
- CGO_ENABLED=0 - CGO_ENABLED=0