mirror of https://github.com/gogs/gogs.git
chore: use Task as main build tool (#6297)
parent
cb88caa2d2
commit
23ff182d1f
|
@ -10,6 +10,7 @@ All notable changes to Gogs are documented in this file.
|
||||||
|
|
||||||
- The default branch has been changed to `main`. [#6285](https://github.com/gogs/gogs/pull/6285)
|
- The default branch has been changed to `main`. [#6285](https://github.com/gogs/gogs/pull/6285)
|
||||||
- MSSQL as database backend is deprecated, installation page no longer shows it as an option. Existing installations and manually craft configuration file continue to work. [#6295](https://github.com/gogs/gogs/pull/6295)
|
- MSSQL as database backend is deprecated, installation page no longer shows it as an option. Existing installations and manually craft configuration file continue to work. [#6295](https://github.com/gogs/gogs/pull/6295)
|
||||||
|
- Use [Task](https://github.com/go-task/task) as the default build tool for development. [#6297](https://github.com/gogs/gogs/pull/6297)
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,68 @@
|
||||||
|
version: '3'
|
||||||
|
|
||||||
|
tasks:
|
||||||
|
web:
|
||||||
|
deps: [build]
|
||||||
|
cmds:
|
||||||
|
- ./gogs web
|
||||||
|
sources:
|
||||||
|
- gogs.go
|
||||||
|
- internal/**/*.go
|
||||||
|
|
||||||
|
build:
|
||||||
|
cmds:
|
||||||
|
- go build -v
|
||||||
|
-ldflags '
|
||||||
|
-X "{{.PKG_PATH}}.BuildTime={{.BUILD_TIME}}"
|
||||||
|
-X "{{.PKG_PATH}}.BuildCommit={{.BUILD_COMMIT}}"
|
||||||
|
'
|
||||||
|
-tags '{{.TAGS}}'
|
||||||
|
-trimpath -o 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
|
||||||
|
|
||||||
|
generate:
|
||||||
|
deps: [clean]
|
||||||
|
cmds:
|
||||||
|
- go generate internal/assets/conf/conf.go
|
||||||
|
- go generate internal/assets/templates/templates.go
|
||||||
|
- go generate internal/assets/public/public.go
|
||||||
|
|
||||||
|
test:
|
||||||
|
cmds:
|
||||||
|
- go test -cover -race ./...
|
||||||
|
|
||||||
|
clean:
|
||||||
|
cmds:
|
||||||
|
- find . -name "*.DS_Store" -type f -delete
|
||||||
|
|
||||||
|
release:
|
||||||
|
deps: [build]
|
||||||
|
cmds:
|
||||||
|
- rm -rf {{.RELEASE_GOGS}}
|
||||||
|
- mkdir -p {{.RELEASE_GOGS}}
|
||||||
|
- cp -r gogs LICENSE README.md README_ZH.md scripts {{.RELEASE_GOGS}}
|
||||||
|
- cd {{.RELEASE_ROOT}} && zip -r gogs.$(NOW).zip "gogs"
|
||||||
|
vars:
|
||||||
|
RELEASE_ROOT: release
|
||||||
|
RELEASE_GOGS: release/gogs
|
||||||
|
|
||||||
|
less:
|
||||||
|
cmds:
|
||||||
|
- lessc --clean-css --source-map "public/less/gogs.less" public/css/gogs.min.css
|
||||||
|
|
||||||
|
fixme:
|
||||||
|
cmds:
|
||||||
|
- grep -rnw "FIXME" internal
|
||||||
|
|
||||||
|
todo:
|
||||||
|
cmds:
|
||||||
|
- grep -rnw "TODO" internal
|
||||||
|
|
||||||
|
legacy:
|
||||||
|
cmds:
|
||||||
|
- grep -rnw "\(LEGACY\|Deprecated\)" internal
|
|
@ -25,7 +25,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.14 or higher)
|
- [Go](https://golang.org/doc/install) (v1.14 or higher)
|
||||||
- [Less.js](http://lesscss.org/usage/#command-line-usage-installing)
|
- [Less.js](http://lesscss.org/usage/#command-line-usage-installing)
|
||||||
- [GNU Make](https://www.gnu.org/software/make/)
|
- [Task](https://github.com/go-task/task)
|
||||||
- Database upon your choice (pick one, we choose PostgreSQL in this document):
|
- Database upon your choice (pick one, we choose PostgreSQL in this document):
|
||||||
- [PostgreSQL](https://wiki.postgresql.org/wiki/Detailed_installation_guides) (v9.6 or higher)
|
- [PostgreSQL](https://wiki.postgresql.org/wiki/Detailed_installation_guides) (v9.6 or higher)
|
||||||
- [MySQL](https://dev.mysql.com/downloads/mysql/) with `ENGINE=InnoDB` (v5.7 or higher)
|
- [MySQL](https://dev.mysql.com/downloads/mysql/) with `ENGINE=InnoDB` (v5.7 or higher)
|
||||||
|
@ -38,7 +38,7 @@ Gogs has the following dependencies:
|
||||||
1. Install dependencies:
|
1. Install dependencies:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
brew install go postgresql git go-bindata npm
|
brew install go postgresql git go-bindata npm go-task/tap/go-task
|
||||||
npm install -g less
|
npm install -g less
|
||||||
npm install -g less-plugin-clean-css
|
npm install -g less-plugin-clean-css
|
||||||
```
|
```
|
||||||
|
@ -78,6 +78,7 @@ Gogs has the following dependencies:
|
||||||
npm install -g less
|
npm install -g less
|
||||||
# Watch out, it is NOT github.com/go-bindata/go-bindata!
|
# Watch out, it is NOT github.com/go-bindata/go-bindata!
|
||||||
go get -u github.com/kevinburke/go-bindata/...
|
go get -u github.com/kevinburke/go-bindata/...
|
||||||
|
go get go-task/task/cmd/task
|
||||||
```
|
```
|
||||||
|
|
||||||
1. Configure startup services:
|
1. Configure startup services:
|
||||||
|
@ -130,21 +131,23 @@ Create a `custom/conf/app.ini` file inside the repository and put the following
|
||||||
|
|
||||||
```ini
|
```ini
|
||||||
[database]
|
[database]
|
||||||
DB_TYPE = postgres
|
TYPE = postgres
|
||||||
HOST = 127.0.0.1:5432
|
HOST = 127.0.0.1:5432
|
||||||
NAME = gogs
|
NAME = gogs
|
||||||
USER = gogs
|
USER = gogs
|
||||||
PASSWD = <YOUR PASSWORD HERE>
|
PASSWORD = <YOUR PASSWORD HERE>
|
||||||
SSL_MODE = disable
|
SSL_MODE = disable
|
||||||
```
|
```
|
||||||
|
|
||||||
## Step 5: Start the server
|
## Step 5: Start the server
|
||||||
|
|
||||||
|
The following command will start the web server and automatically recompile and restart the server if any Go files changed:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
make web
|
task web --watch
|
||||||
```
|
```
|
||||||
|
|
||||||
You would have to re-run this command after changing Go files, or any file under `conf/`, `template/` and `public/` directories.
|
**NOTE** If you changed any file under `conf/`, `template/` or `public/` directory, be sure to run `task generate` afterwards!
|
||||||
|
|
||||||
## Other nice things
|
## Other nice things
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue