From 75f99c9435971a3ab79489f26e9b99f3be52bbb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=B4=8A=E1=B4=8F=E1=B4=87=20=E1=B4=84=CA=9C=E1=B4=87?= =?UTF-8?q?=C9=B4?= Date: Wed, 20 May 2026 19:22:50 -0400 Subject: [PATCH] chore: remove Taskfile usage (#8280) --- .dockerignore | 2 - .github/CONTRIBUTING.md | 1 - .../dev_release_minor_version.md | 2 +- .../dev_release_patch_version.md | 2 +- .github/workflows/go.yml | 8 +- .gitignore | 1 - .moon/workspace.yml | 2 +- Dockerfile | 5 +- Dockerfile.next | 5 +- Taskfile.yml | 99 ------------------- docker/build/install-task.sh | 20 ---- docs/dev/import_locale.md | 2 +- docs/dev/local_development.md | 11 ++- moon.yml | 11 ++- 14 files changed, 26 insertions(+), 145 deletions(-) delete mode 100644 Taskfile.yml delete mode 100755 docker/build/install-task.sh diff --git a/.dockerignore b/.dockerignore index a1b0c57fc..d7bd88cf7 100644 --- a/.dockerignore +++ b/.dockerignore @@ -16,5 +16,3 @@ node_modules public/dist **/*.tsbuildinfo **/.vite - -!Taskfile.yml diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index a02529428..742dc6410 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -71,7 +71,6 @@ Contributing to another codebase is not as simple as code changes, it is also ab ### Coding guidelines 1. Please read the Sourcegraph's [Go style guide](https://github.com/sourcegraph/sourcegraph-public-snapshot/blob/main/doc/dev/background-information/languages/go.md). -1. **NO** direct modifications to `.css` files, `.css` files are all generated by `.less` files. You can regenerate `.css` files by executing `task less`. ## Your PR is merged! diff --git a/.github/ISSUE_TEMPLATE/dev_release_minor_version.md b/.github/ISSUE_TEMPLATE/dev_release_minor_version.md index dc036c838..5bf57d1dc 100644 --- a/.github/ISSUE_TEMPLATE/dev_release_minor_version.md +++ b/.github/ISSUE_TEMPLATE/dev_release_minor_version.md @@ -42,5 +42,5 @@ On the `main` branch: - [ ] Send a tweet on the [official Twitter account](https://twitter.com/GogsHQ) for the minor release. - [ ] Close the milestone for the minor release. - [ ] [Bump the hard-coded version](https://github.com/gogs/gogs/commit/a98968436cd5841cf691bb0b80c54c81470d1676) to the new develop version, e.g. `0.14.0+dev` -> `0.15.0+dev`. -- [ ] Run `task legacy` to identify deprecated code that is aimed to be removed in current develop version. +- [ ] Run `grep -rnw "\(LEGACY\|Deprecated\)" internal` to identify deprecated code that is aimed to be removed in current develop version. - [ ] **After 14 days**, publish [GitHub security advisories](https://github.com/gogs/gogs/security) for security patches included in the release. diff --git a/.github/ISSUE_TEMPLATE/dev_release_patch_version.md b/.github/ISSUE_TEMPLATE/dev_release_patch_version.md index d0f252221..d76e9babf 100644 --- a/.github/ISSUE_TEMPLATE/dev_release_patch_version.md +++ b/.github/ISSUE_TEMPLATE/dev_release_patch_version.md @@ -13,7 +13,7 @@ _This is generated from the [patch release template](https://github.com/gogs/gog On the release branch: - [ ] Make sure all commits are cherry-picked from the `main` branch by checking the patch milestone. - - Run `task build` for every cherry-picked commit to make sure there is no compilation error. + - Run `moon run gogs:build-prod --force` for every cherry-picked commit to make sure there is no compilation error. - [ ] [Update CHANGELOG on the `main` branch](https://github.com/gogs/gogs/commit/f1102a7a7c545ec221d2906f02fa19170d96f96d) to include entries for the current patch release. ## During release diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index a40088d06..46b6ba22f 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -35,20 +35,16 @@ jobs: uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0 with: go-version: 1.26.x - - name: Install Task - uses: arduino/setup-task@b91d5d2c96a56797b48ac1e0e89220bf64044611 # v2.0.0 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - name: Check Go module tidiness and generated files shell: bash run: | go mod tidy - task generate + go generate ./... STATUS=$(git status --porcelain) if [ ! -z "$STATUS" ]; then echo "Unstaged files:" echo $STATUS - echo "Run 'go mod tidy' or 'task generate' commit them" + echo "Run 'go mod tidy' or 'go generate ./...' and commit them" exit 1 fi - name: Run golangci-lint diff --git a/.gitignore b/.gitignore index a708fc5dd..745f0a441 100644 --- a/.gitignore +++ b/.gitignore @@ -2,7 +2,6 @@ .bin/ dist/ .moon/cache/ -.task/ node_modules/ # Runtime data diff --git a/.moon/workspace.yml b/.moon/workspace.yml index 11d50b620..01c79131e 100644 --- a/.moon/workspace.yml +++ b/.moon/workspace.yml @@ -5,5 +5,5 @@ projects: web: "web" vcs: - manager: "git" + client: "git" defaultBranch: "main" diff --git a/Dockerfile b/Dockerfile index 78256a2ea..821d89f1a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -18,8 +18,9 @@ WORKDIR /gogs.io/gogs COPY . . COPY --from=webbuilder /src/public/dist ./public/dist -RUN ./docker/build/install-task.sh -RUN TAGS="pam prod" task build +RUN go build -v -trimpath -tags "pam prod" \ + -ldflags "-X 'gogs.io/gogs/internal/conf.BuildTime=$(date -u '+%Y-%m-%d %I:%M:%S %Z')' -X 'gogs.io/gogs/internal/conf.BuildCommit=$(git rev-parse HEAD)'" \ + -o .bin/gogs ./cmd/gogs FROM alpine:3.23 RUN apk --no-cache --no-progress add \ diff --git a/Dockerfile.next b/Dockerfile.next index 94318e6ba..e2f969493 100644 --- a/Dockerfile.next +++ b/Dockerfile.next @@ -18,8 +18,9 @@ WORKDIR /gogs.io/gogs COPY . . COPY --from=webbuilder /src/public/dist ./public/dist -RUN ./docker/build/install-task.sh -RUN TAGS="pam prod" task build +RUN go build -v -trimpath -tags "pam prod" \ + -ldflags "-X 'gogs.io/gogs/internal/conf.BuildTime=$(date -u '+%Y-%m-%d %I:%M:%S %Z')' -X 'gogs.io/gogs/internal/conf.BuildCommit=$(git rev-parse HEAD)'" \ + -o .bin/gogs ./cmd/gogs FROM alpine:3.23 diff --git a/Taskfile.yml b/Taskfile.yml deleted file mode 100644 index 5dafb48a3..000000000 --- a/Taskfile.yml +++ /dev/null @@ -1,99 +0,0 @@ -version: '3' - -vars: - BINARY_EXT: - sh: echo '{{if eq OS "windows"}}.exe{{end}}' - -tasks: - default: - deps: [build] - web: - desc: Build the binary and start the web server - deps: [build] - cmds: - - .bin/gogs web - - build: - desc: Build the binary - cmds: - - go build -v - -ldflags ' - -X "{{.PKG_PATH}}.BuildTime={{.BUILD_TIME}}" - -X "{{.PKG_PATH}}.BuildCommit={{.BUILD_COMMIT}}" - ' - -tags '{{.TAGS}}' - -trimpath -o .bin/gogs{{.BINARY_EXT}} ./cmd/gogs - vars: - PKG_PATH: gogs.io/gogs/internal/conf - BUILD_TIME: - sh: date -u '+%Y-%m-%d %I:%M:%S %Z' - BUILD_COMMIT: - sh: git rev-parse HEAD - sources: - - go.mod - - cmd/gogs/*.go - - internal/**/*.go - - conf/**/* - - public/**/* - - templates/**/* - - custom/**/* - method: timestamp - - generate-schemadoc: - desc: Generate database schema documentation - cmds: - - go generate ./internal/database/schemadoc - - generate: - desc: Run all go:generate commands - cmds: - - go generate ./... - - test: - desc: Run all tests. - cmds: - - go test -cover -race ./... - - clean: - desc: Cleans up system meta files - cmds: - - find . -name "*.DS_Store" -type f -delete - - less: - desc: Generate CSS from LESS files - cmds: - - lessc --clean-css --source-map "public/less/gogs.less" public/css/gogs.min.css - - fixme: - desc: Show all occurrences of "FIXME" - cmds: - - grep -rnw "FIXME" internal - - todo: - desc: Show all occurrences of "TODO" - cmds: - - grep -rnw "TODO" internal - - legacy: - desc: Identify legacy and deprecated lines - cmds: - - grep -rnw "\(LEGACY\|Deprecated\)" internal - - drop-test-db: - desc: Drop the test database - cmds: - - | - for dbname in $(psql -Xc "copy (select datname from pg_database where datname like 'gogs-%') to stdout"); do - dropdb "$dbname" - echo "dropped $dbname" - done - - lint: - desc: Run all linters - cmds: - - golangci-lint run - - docs: - desc: Start docs server - cmds: - - cd docs && mint dev --port 3333 diff --git a/docker/build/install-task.sh b/docker/build/install-task.sh deleted file mode 100755 index d4a9bf96a..000000000 --- a/docker/build/install-task.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/sh - -set -xe - -if [ "$(uname -m)" = "aarch64" ]; then - export arch='arm64' - export checksum='17f325293d08f6f964e0530842e9ef1410dd5f83ee6475b493087391032b0cfd' -elif [ "$(uname -m)" = "armv7l" ]; then - export arch='arm' - export checksum='e5b0261e9f6563ce3ace9e038520eb59d2c77c8d85f2b47ab41e1fe7cf321528' -else - export arch='amd64' - export checksum='a35462ec71410cccfc428072de830e4478bc57a919d0131ef7897759270dff8f' -fi - -wget --quiet https://github.com/go-task/task/releases/download/v3.40.1/task_linux_${arch}.tar.gz -O task_linux_${arch}.tar.gz -echo "${checksum} task_linux_${arch}.tar.gz" | sha256sum -cs - -tar -xzf task_linux_${arch}.tar.gz -mv task /usr/local/bin/task diff --git a/docs/dev/import_locale.md b/docs/dev/import_locale.md index ddc853cbe..93d420c77 100644 --- a/docs/dev/import_locale.md +++ b/docs/dev/import_locale.md @@ -10,7 +10,7 @@ Locale files has been successfully imported! ``` -1. Run `task web` to start the web server, then visit the site in the browser to make sure nothing blows up. +1. Run `moon run gogs:dev` to start the web server, then visit the site in the browser to make sure nothing blows up. 1. Check out a new branch using `git checkout -b update-locales`. 1. Stage changes 1. Run `git commit -m "locale: sync from Crowdin"`. diff --git a/docs/dev/local_development.md b/docs/dev/local_development.md index dac33ba1d..4e0ec7d43 100644 --- a/docs/dev/local_development.md +++ b/docs/dev/local_development.md @@ -23,7 +23,7 @@ Gogs has the following dependencies: - [Git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git) (v1.8.3 or higher) - [Go](https://golang.org/doc/install) (v1.20 or higher) - [Less.js](http://lesscss.org/usage/#command-line-usage-installing) -- [Task](https://github.com/go-task/task) (v3) +- [Moon](https://moonrepo.dev/docs/install) - [goimports](https://pkg.go.dev/golang.org/x/tools/cmd/goimports) - [go-mockgen](https://github.com/derision-test/go-mockgen) - Database upon your choice (pick one, we choose PostgreSQL in this document): @@ -38,7 +38,7 @@ Gogs has the following dependencies: 1. Install dependencies: ```bash - brew install go postgresql git npm go-task/tap/go-task + brew install go postgresql git npm moon npm install -g less npm install -g less-plugin-clean-css go install github.com/derision-test/go-mockgen/cmd/go-mockgen@v1.3.3 @@ -78,11 +78,12 @@ Gogs has the following dependencies: ```bash sudo apt install -y make git-all postgresql postgresql-contrib golang-go nodejs npm install -g less - go install github.com/go-task/task/v3/cmd/task@latest go install github.com/derision-test/go-mockgen/cmd/go-mockgen@v1.3.3 go install golang.org/x/tools/cmd/goimports@latest ``` +1. Install [Moon](https://moonrepo.dev/docs/install). + 1. Configure startup services: ```bash @@ -146,10 +147,10 @@ SSL_MODE = disable The following command will start the web server and automatically recompile and restart the server if any Go files changed: ```bash -task web --watch +moon run gogs:dev ``` -**NOTE** If you changed any file under `conf/`, `template/` or `public/` directory, be sure to run `task generate` afterwards! +**NOTE** If you changed any file under `conf/`, `templates/` or `public/` directory, be sure to rerun `moon run gogs:dev` afterwards! ## Other nice things diff --git a/moon.yml b/moon.yml index 0a43c65f7..09645f8a7 100644 --- a/moon.yml +++ b/moon.yml @@ -24,9 +24,14 @@ fileGroups: tasks: install: - command: "go mod tidy" + script: | + go mod tidy + go generate ./... inputs: + - "@group(sources)" - "@group(configs)" + - "mockgen.go" + - "mockgen.yaml" format: command: "golangci-lint fmt" @@ -56,7 +61,7 @@ tasks: build: script: | - go build -trimpath \ + go build -v -trimpath \ -ldflags "-X 'gogs.io/gogs/internal/conf.BuildTime=$(date -u '+%Y-%m-%d %I:%M:%S %Z')' -X 'gogs.io/gogs/internal/conf.BuildCommit=$(git rev-parse HEAD)'" \ -o .bin/gogs ./cmd/gogs inputs: @@ -70,7 +75,7 @@ tasks: build-prod: script: | - go build -trimpath -tags prod \ + go build -v -trimpath -tags prod \ -ldflags "-X 'gogs.io/gogs/internal/conf.BuildTime=$(date -u '+%Y-%m-%d %I:%M:%S %Z')' -X 'gogs.io/gogs/internal/conf.BuildCommit=$(git rev-parse HEAD)'" \ -o .bin/gogs ./cmd/gogs inputs: