mirror of
https://github.com/gogs/gogs.git
synced 2026-05-28 21:30:36 +00:00
chore: remove Taskfile usage (#8280)
This commit is contained in:
@@ -16,5 +16,3 @@ node_modules
|
|||||||
public/dist
|
public/dist
|
||||||
**/*.tsbuildinfo
|
**/*.tsbuildinfo
|
||||||
**/.vite
|
**/.vite
|
||||||
|
|
||||||
!Taskfile.yml
|
|
||||||
|
|||||||
@@ -71,7 +71,6 @@ Contributing to another codebase is not as simple as code changes, it is also ab
|
|||||||
### Coding guidelines
|
### 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. 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!
|
## Your PR is merged!
|
||||||
|
|
||||||
|
|||||||
@@ -42,5 +42,5 @@ On the `main` branch:
|
|||||||
- [ ] Send a tweet on the [official Twitter account](https://twitter.com/GogsHQ) for the minor release.
|
- [ ] Send a tweet on the [official Twitter account](https://twitter.com/GogsHQ) for the minor release.
|
||||||
- [ ] Close the milestone 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`.
|
- [ ] [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.
|
- [ ] **After 14 days**, publish [GitHub security advisories](https://github.com/gogs/gogs/security) for security patches included in the release.
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ _This is generated from the [patch release template](https://github.com/gogs/gog
|
|||||||
On the release branch:
|
On the release branch:
|
||||||
|
|
||||||
- [ ] Make sure all commits are cherry-picked from the `main` branch by checking the patch milestone.
|
- [ ] 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.
|
- [ ] [Update CHANGELOG on the `main` branch](https://github.com/gogs/gogs/commit/f1102a7a7c545ec221d2906f02fa19170d96f96d) to include entries for the current patch release.
|
||||||
|
|
||||||
## During release
|
## During release
|
||||||
|
|||||||
@@ -35,20 +35,16 @@ jobs:
|
|||||||
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
|
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
|
||||||
with:
|
with:
|
||||||
go-version: 1.26.x
|
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
|
- name: Check Go module tidiness and generated files
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
go mod tidy
|
go mod tidy
|
||||||
task generate
|
go generate ./...
|
||||||
STATUS=$(git status --porcelain)
|
STATUS=$(git status --porcelain)
|
||||||
if [ ! -z "$STATUS" ]; then
|
if [ ! -z "$STATUS" ]; then
|
||||||
echo "Unstaged files:"
|
echo "Unstaged files:"
|
||||||
echo $STATUS
|
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
|
exit 1
|
||||||
fi
|
fi
|
||||||
- name: Run golangci-lint
|
- name: Run golangci-lint
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
.bin/
|
.bin/
|
||||||
dist/
|
dist/
|
||||||
.moon/cache/
|
.moon/cache/
|
||||||
.task/
|
|
||||||
node_modules/
|
node_modules/
|
||||||
|
|
||||||
# Runtime data
|
# Runtime data
|
||||||
|
|||||||
+1
-1
@@ -5,5 +5,5 @@ projects:
|
|||||||
web: "web"
|
web: "web"
|
||||||
|
|
||||||
vcs:
|
vcs:
|
||||||
manager: "git"
|
client: "git"
|
||||||
defaultBranch: "main"
|
defaultBranch: "main"
|
||||||
|
|||||||
+3
-2
@@ -18,8 +18,9 @@ WORKDIR /gogs.io/gogs
|
|||||||
COPY . .
|
COPY . .
|
||||||
COPY --from=webbuilder /src/public/dist ./public/dist
|
COPY --from=webbuilder /src/public/dist ./public/dist
|
||||||
|
|
||||||
RUN ./docker/build/install-task.sh
|
RUN go build -v -trimpath -tags "pam prod" \
|
||||||
RUN TAGS="pam prod" task build
|
-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
|
FROM alpine:3.23
|
||||||
RUN apk --no-cache --no-progress add \
|
RUN apk --no-cache --no-progress add \
|
||||||
|
|||||||
+3
-2
@@ -18,8 +18,9 @@ WORKDIR /gogs.io/gogs
|
|||||||
COPY . .
|
COPY . .
|
||||||
COPY --from=webbuilder /src/public/dist ./public/dist
|
COPY --from=webbuilder /src/public/dist ./public/dist
|
||||||
|
|
||||||
RUN ./docker/build/install-task.sh
|
RUN go build -v -trimpath -tags "pam prod" \
|
||||||
RUN TAGS="pam prod" task build
|
-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
|
FROM alpine:3.23
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
|
||||||
@@ -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
|
|
||||||
@@ -10,7 +10,7 @@
|
|||||||
Locale files has been successfully imported!
|
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. Check out a new branch using `git checkout -b update-locales`.
|
||||||
1. Stage changes
|
1. Stage changes
|
||||||
1. Run `git commit -m "locale: sync from Crowdin"`.
|
1. Run `git commit -m "locale: sync from Crowdin"`.
|
||||||
|
|||||||
@@ -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)
|
- [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)
|
- [Go](https://golang.org/doc/install) (v1.20 or higher)
|
||||||
- [Less.js](http://lesscss.org/usage/#command-line-usage-installing)
|
- [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)
|
- [goimports](https://pkg.go.dev/golang.org/x/tools/cmd/goimports)
|
||||||
- [go-mockgen](https://github.com/derision-test/go-mockgen)
|
- [go-mockgen](https://github.com/derision-test/go-mockgen)
|
||||||
- Database upon your choice (pick one, we choose PostgreSQL in this document):
|
- Database upon your choice (pick one, we choose PostgreSQL in this document):
|
||||||
@@ -38,7 +38,7 @@ Gogs has the following dependencies:
|
|||||||
1. Install dependencies:
|
1. Install dependencies:
|
||||||
|
|
||||||
```bash
|
```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
|
||||||
npm install -g less-plugin-clean-css
|
npm install -g less-plugin-clean-css
|
||||||
go install github.com/derision-test/go-mockgen/cmd/go-mockgen@v1.3.3
|
go install github.com/derision-test/go-mockgen/cmd/go-mockgen@v1.3.3
|
||||||
@@ -78,11 +78,12 @@ Gogs has the following dependencies:
|
|||||||
```bash
|
```bash
|
||||||
sudo apt install -y make git-all postgresql postgresql-contrib golang-go nodejs
|
sudo apt install -y make git-all postgresql postgresql-contrib golang-go nodejs
|
||||||
npm install -g less
|
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 github.com/derision-test/go-mockgen/cmd/go-mockgen@v1.3.3
|
||||||
go install golang.org/x/tools/cmd/goimports@latest
|
go install golang.org/x/tools/cmd/goimports@latest
|
||||||
```
|
```
|
||||||
|
|
||||||
|
1. Install [Moon](https://moonrepo.dev/docs/install).
|
||||||
|
|
||||||
1. Configure startup services:
|
1. Configure startup services:
|
||||||
|
|
||||||
```bash
|
```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:
|
The following command will start the web server and automatically recompile and restart the server if any Go files changed:
|
||||||
|
|
||||||
```bash
|
```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
|
## Other nice things
|
||||||
|
|
||||||
|
|||||||
@@ -24,9 +24,14 @@ fileGroups:
|
|||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
install:
|
install:
|
||||||
command: "go mod tidy"
|
script: |
|
||||||
|
go mod tidy
|
||||||
|
go generate ./...
|
||||||
inputs:
|
inputs:
|
||||||
|
- "@group(sources)"
|
||||||
- "@group(configs)"
|
- "@group(configs)"
|
||||||
|
- "mockgen.go"
|
||||||
|
- "mockgen.yaml"
|
||||||
|
|
||||||
format:
|
format:
|
||||||
command: "golangci-lint fmt"
|
command: "golangci-lint fmt"
|
||||||
@@ -56,7 +61,7 @@ tasks:
|
|||||||
|
|
||||||
build:
|
build:
|
||||||
script: |
|
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)'" \
|
-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
|
-o .bin/gogs ./cmd/gogs
|
||||||
inputs:
|
inputs:
|
||||||
@@ -70,7 +75,7 @@ tasks:
|
|||||||
|
|
||||||
build-prod:
|
build-prod:
|
||||||
script: |
|
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)'" \
|
-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
|
-o .bin/gogs ./cmd/gogs
|
||||||
inputs:
|
inputs:
|
||||||
|
|||||||
Reference in New Issue
Block a user