From 8a072836eecf58e583e91f8387f5fec9ac7c7ea9 Mon Sep 17 00:00:00 2001 From: ysicing Date: Tue, 19 Mar 2024 16:46:43 +0800 Subject: [PATCH] chore: update project configurations and dependencies - Add `.cienv` file with QINIU_DIR and QINIU_DIST_DIR paths - Update `.github/dependabot.yml` to include daily dependency updates for `/ui` and `/client` directories - Update `.github/workflows/test.yml` to use Node.js version 16 instead of 18 - Update `Taskfile.yml` to include environment variables and commands for UI compilation and resource preparation - Remove the `package_gui` task from `Taskfile.yml` - Update `client/package.json` to include new platform-specific package scripts Signed-off-by: ysicing --- .cienv | 2 ++ .github/dependabot.yml | 20 +++++++++++ .github/workflows/test.yml | 2 +- Taskfile.yml | 69 ++++++++++++++++++++++++++++++++++---- client/package.json | 9 ++--- 5 files changed, 91 insertions(+), 11 deletions(-) create mode 100644 .cienv diff --git a/.cienv b/.cienv new file mode 100644 index 000000000..998f40749 --- /dev/null +++ b/.cienv @@ -0,0 +1,2 @@ +QINIU_DIR=.release/qiniu +QINIU_DIST_DIR=.release/qiniu/dist diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 5df34e78f..4cc7641f6 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -20,3 +20,23 @@ updates: rebase-strategy: auto labels: - bot/dependency + + - package-ecosystem: npm + directory: /ui + schedule: + interval: daily + open-pull-requests-limit: 1 + rebase-strategy: auto + labels: + - bot/dependency + - ui + + - package-ecosystem: npm + directory: /client + schedule: + interval: daily + open-pull-requests-limit: 1 + rebase-strategy: auto + labels: + - bot/dependency + - client diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 52502f4b1..994d7c263 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -37,7 +37,7 @@ jobs: check-latest: true - uses: actions/setup-node@v4 with: - node-version: '18' + node-version: '16' - name: install task run: | echo "install task" diff --git a/Taskfile.yml b/Taskfile.yml index c006ab45c..6b2ee6883 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -2,21 +2,73 @@ version: '3' +env: + GOPROXY: 'https://goproxy.cn,direct' + GOSUMDB: sum.golang.google.cn + GO_VERSION: $(go version) + BUILD_VERSION: $(cat VERSION || echo "0.0.1") + BUILD_TIME: $(date "+%Y%m%d%H%M") + GIT_COMMIT: $(git rev-parse --short HEAD || echo "abcdefgh") + ROOT_DIR: $(pwd) + BUILD_DIR: $(pwd)/_output + BIN_DIR: $(pwd)/bin + CLIENT_BIN_DIR: client/bin + CLIENT_OUT_DIR: client/out + LDFLAGS: "-w -s \ + -X 'main.AppVersion={{.BUILD_VERSION}}' \ + -X 'main.GoVersion={{.GO_VERSION}}' \ + -X 'main.BuildTime={{.BUILD_TIME}}' \ + -X 'main.BuildTime={{.BUILD_TIME}}' \ + -X 'main.GitHash=${GIT_COMMIT}'" + tasks: + + clean: + desc: clean + cmds: + - rm -rf res/res.go + + install: + desc: install dep tools + run: once + cmds: + - go install github.com/kevinburke/go-bindata/v4/...@latest + status: + - command -v go-bindata + + compile_ui: + desc: compile client ui + run: once + dir: ui + cmds: + - yarn install + - yarn build --dest ../client/ui + prepare: - desc: Prepare the environment + desc: start prepare res + run: once + deps: + - install + - compile_ui cmds: - - echo "Preparing the environment" + - go-bindata -o=res/res.go -pkg=res res/... + status: + - test -f res/res.go build_server: desc: Build the server + run: once cmds: - - echo "Building the server {{.GOOS}} {{.GOARCH}}" + - GOOS={{.GOOS}} GOARCH={{.GOARCH}} go build -ldflags "{{.LDFLAGS}}" -o {{.BUILD_DIR}}/{{.GOOS}}/{{.GOARCH}}/zt-server{{if eq .GOOS "windows"}}.exe{{end}} cmd/server/main.go + status: + - test -f {{.BUILD_DIR}}/{{.GOOS}}/{{.GOARCH}}/zt-server{{if eq .GOOS "windows"}}.exe{{end}} - package_gui: - desc: Package the GUI + package_gui_client: + desc: start package gui + run: once + dir: client cmds: - - echo "Packaging the GUI for {{.GOOS}} {{.GOARCH}}" + - npm run package-{{.GOOS}}-{{.GOARCH}} build_cli: desc: Build the CLI @@ -31,3 +83,8 @@ tasks: GOOS: darwin, GOARCH: arm64 } + - task: package_gui_client + vars: { + GOOS: darwin, + GOARCH: arm64 + } diff --git a/client/package.json b/client/package.json index d77d0222c..16c2ef1c7 100644 --- a/client/package.json +++ b/client/package.json @@ -7,11 +7,12 @@ "scripts": { "start": "NODE_ENV=development electron-forge start", "package": "electron-forge package", - "package-mac": "npm run package -- --platform=darwin", - "package-linux": "npm run package -- --platform=linux", + "package-darwin-amd64": "npm run package -- --platform=darwin", + "package-darwin-arm64": "npm run package -- --platform=darwin --arch=arm64", + "package-linux-amd64": "npm run package -- --platform=linux", "package-linux-arm64": "npm run package -- --platform=linux --arch=arm64", - "package-win64": "npm run package -- --platform=win32 --arch=x64", - "package-win32": "npm run package -- --platform=win32 --arch=ia32", + "package-windows-amd64": "npm run package -- --platform=win32 --arch=x64", + "package-windows-ia32": "npm run package -- --platform=win32 --arch=ia32", "make": "electron-forge make", "publish": "electron-forge publish", "lint": "echo \"No linting configured\""