Commit graph

228 commits

Author SHA1 Message Date
silverwind
cc4da79fb6
add 'make watch-frontend' and expand docs (#10931)
* add 'make watch-frontend' and expand docs

* add bindata note

* add .PHONY

Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com>
2020-04-12 00:50:59 -03:00
Mura Li
514e269b1d
Support running subtests manually (#10988)
Since GNU Make does not allow '/' in the target patterns,
we tranlate the subsequent '.' into '/' for "go test -run".

Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com>
2020-04-07 01:31:11 -03:00
John Olheiser
1648bf2b60
Turn off go modules for xgo and gxz (#10963)
* Turn off go modules for xgo and gxz

Signed-off-by: jolheiser <john.olheiser@gmail.com>

* Add test release for PR

Signed-off-by: jolheiser <john.olheiser@gmail.com>

* Try with go modules off

Signed-off-by: jolheiser <john.olheiser@gmail.com>

* Revert Makefile, force a release test

Signed-off-by: jolheiser <john.olheiser@gmail.com>

* Turn on GOPROXY for release

Signed-off-by: jolheiser <john.olheiser@gmail.com>

* CI

Signed-off-by: jolheiser <john.olheiser@gmail.com>

* CI

Signed-off-by: jolheiser <john.olheiser@gmail.com>

* Final commit

Signed-off-by: jolheiser <john.olheiser@gmail.com>
2020-04-06 12:48:55 +08:00
Lunny Xiao
686850e21f
Fix cross compile (#10952)
* Fix cross compile

* Add test for cross compile

* Fix drone

* Fix drone

* Also prevent CC environment not to generate

Co-authored-by: zeripath <art27@cantab.net>
2020-04-05 20:28:18 +08:00
John Olheiser
baadb51445
Add gitea-vet (#10948)
* Add copyright

Signed-off-by: jolheiser <john.olheiser@gmail.com>

* Add gitea-vet and fix non-compliance

Signed-off-by: jolheiser <john.olheiser@gmail.com>

* Combine tools.go into build.go and clean up

Signed-off-by: jolheiser <john.olheiser@gmail.com>

* Remove extra GO111MODULE=on

Signed-off-by: jolheiser <john.olheiser@gmail.com>
2020-04-05 07:20:50 +01:00
guillep2k
b74d30ae27
Prevent support libraries from compiling into Gitea (#10964)
* Prevent support libraries from compiling into Gitea

* Fix tag position

* Fix golangci-lint errors

* Refactor to make it work

Co-authored-by: Guillermo Prandi <guillep2k@users.noreply.github.com>
2020-04-05 11:35:02 +08:00
mrsdizzie
2a06d3a590
Enable GO111MODULE=on globally in Makefile (#10939)
Now that our minimum required go version is 1.12 we can remove code that disables GO111MODULE globally and turn it on, so each command doesn't need it set specifically.

Also fixes a small bug with make pr that didn't work because GO111MODULE=on wasn't set

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2020-04-04 19:41:00 +08:00
Lunny Xiao
b264c30394
Move gocovmerge as vendor (#10947)
* Move gocovmerge as vendor

* Update Makefile

Co-Authored-By: guillep2k <18600385+guillep2k@users.noreply.github.com>

Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com>
2020-04-04 11:45:26 +03:00
Lunny Xiao
4f63f283c4
Rename scripts to build and add revive command as a new build tool command (#10942)
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2020-04-03 22:29:12 +03:00
zeripath
bf847b9397
Upgrade golangci-lint to 1.24.0 (#10894)
* upgrade golangci-lint to 1.24.0 to allow go 1.14 compatibility
* fix golangci-lint errors
* make make golangci-lint work when out of go-path

Signed-off-by: Andrew Thornton <art27@cantab.net>
2020-03-30 21:52:45 +03:00
silverwind
ad4026431b
Add 'make lint', restructure 'compliance' pipeline (#10861)
- Added 'lint', 'lint-frontend', 'lint-backend' targets
- Added 'lint-frontend', 'lint-backend' ci steps and restructure the
  'compliance' pipeline to have a clear separation between frontend and
  backend and use parallelism where possible. Also, the main build
  pipelines now depend on 'compliance' so they will skip if it fails.
- Added dependencies on ci steps so they skip when 'compliance' fails
- Moved JS linters to devDependencies
- Removed deprecated 'js' and 'css' targets
2020-03-29 12:56:58 +01:00
Stefan Bethke
e72c5cb02a
Simplify grep regexp to be more compatible (#10765)
* Simplify grep regexp to be more compatible

The new expression also works with the BSD implementation of grep. Also,
I believe the expression did not work consistently for all possible
version numers, for example a two digit patch version would not have
been matched.

* Fix quote

* Allow for two and three part version numbers

* Select one, two and three part version numbers, reject amd64

* Also allow one to three parts for node version

* Use JS code to print node verion in correct format

* Avoid grep altogether

* Handle go1.14beta1 as well.

Co-authored-by: Antoine GIRARD <sapk@users.noreply.github.com>
2020-03-26 00:21:33 +02:00
techknowlogick
2fa1078911
go 1.14 (#10467) 2020-03-20 10:29:31 -04:00
guillep2k
10e8da1f1a
Change PACKAGES to GO_PACKAGES for FreeBSD compatibility (#10747)
Co-authored-by: Guillermo Prandi <guillep2k@users.noreply.github.com>
2020-03-17 07:37:10 +02:00
silverwind
11f7fc5621
Use whitelist to find go files, run find only once (#10594)
- Use a whitelist-based approach to find *.go files so we can use
  standard find syntax. Also included is a change that files no
  longer pass a leading './' which should help performance further.

- Instead of running `find` multiple times in make because of the
  lazy evaluation, run it only once and add the bindata files when
  the bindata tag is present

This is another huge speedup on my machine of around 2000%.

Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com>
2020-03-08 21:11:39 -03:00
silverwind
334f09d934
Fix makefile syntax error (#10622)
Fix error found via checkmake. It was the only worthwhile issue it reported.
2020-03-06 06:47:40 +00:00
John Olheiser
f5a20250ae
Add node version variable to docs (#10620)
Also adjusted other version mentions so go version is always mentioned
as major.minor and node only as major.

Co-authored-by: silverwind <me@silverwind.io>
2020-03-05 16:36:22 -06:00
silverwind
fa6ea60c55
Frontend build improvements, fix Fomantic build (#10576)
- add package-lock.json to webpack/fomantic prereqs making them always rebuild when dependencies change.
- remove FOMANTIC_EVIDENCE. It seemed better to just track a few output files instead.
- delete fomantic output files before build to prevent possible bugs in fomantic's build.
- resolve WEBPACK_SOURCES only once for performance
- reorder variables for clarity
- use clean-all in Dockerfile
- detect busybox for find syntax

Fixes: https://github.com/go-gitea/gitea/issues/10569
Fixes: https://github.com/go-gitea/gitea/issues/10565
Fixes: https://github.com/go-gitea/gitea/issues/10570
Fixes: https://github.com/go-gitea/gitea/issues/10568
2020-03-03 13:51:11 -06:00
silverwind
ac4f952f73
Fix make find command (#10580)
Continuation of https://github.com/go-gitea/gitea/pull/10577

This version also includes an additional fix for Darwin and FreeBSD
which do not accept the `-regextype` option, but only `-E` and the
argument order is specifically required like this for `-E` to work.

Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com>
2020-03-02 20:55:12 +00:00
silverwind
e9afd74bbe
Speed up make (#10560)
* Speed up make

- stop `find` from venturing into node_modules and other directories
  that do not contain *.go files
- only run `find` once for *.go files
- move image tempdir generation to that task
- rename GOFILES to GO_SOURCES_OWN for consistency and to indicate that
  vendor files are not included
- pre-resolve FOMANTIC_SOURCES

* exclude more

Co-authored-by: Lauris BH <lauris@nix.lv>
2020-03-02 00:45:08 +02:00
zeripath
858aebc2d8
Use [:space:] instead of \s (#10508) 2020-02-27 18:03:21 +00:00
silverwind
2ed9ead6de
Add frontend/backend make targets, fix source release (#10325)
* Add frontend/backend make targets, fix source release

- Add 'make backend' and 'make frontend' make targets which are used to
  build go and js/css/svg files respectively.

- The 'backend' target can be invoked without requiring Node.js to be
  present on the system if pre-built frontend assets are present like
  in the release source tarballs.

- Fix source releases missing 'dist' folders inside 'node_modules' which
  were erronously excluded from tar.

- Store VERSION in file VERSION for the release tarballs and prefer that
  file over git-derived version.

* fix release task

* fix typo

* fix another typo
2020-02-22 17:15:11 +08:00
silverwind
17445bbbfa
remove release-dirs make target (#10350)
- only `mkdir`the dist dirs when they are absent
- add the dist dirs as prereqs so targets like `make release-sources`
  can run standalone

Co-authored-by: Antoine GIRARD <sapk@users.noreply.github.com>
2020-02-18 21:10:24 -06:00
Antoine GIRARD
9bada628f2
make: add release-sources (#10295)
* make: add release-sources

* make: release-sources exclude .git and make_evidence
2020-02-16 12:53:02 -05:00
silverwind
d9c79986ea
add TAGS variable prereq on make targets that use it (#10219)
Write out TAGS to .make_evidence/tags and compare it to the previous
invocation. If they differ, insert the evidence file into the prereqs
of targets that use TAGS. I made it .PHONY so it always builds.

I did not include the prereq on release tasks, asssuming the will always
do a clean build.

Fixes: https://github.com/go-gitea/gitea/issues/10196

Co-authored-by: techknowlogick <matti@mdranta.net>
Co-authored-by: Antoine GIRARD <sapk@users.noreply.github.com>
2020-02-11 20:42:03 +01:00
Antoine GIRARD
632df9b996
Improve make PR (force build and help message) (#10178)
* Force build of assets

* Add make pr to make help

* apply @jolheiser suggestion

Co-Authored-By: John Olheiser <42128690+jolheiser@users.noreply.github.com>

* Run clean-all before make pr

Co-authored-by: John Olheiser <42128690+jolheiser@users.noreply.github.com>
2020-02-08 01:14:43 +01:00
silverwind
fdf6d25915
Reorganize frontend files and tooling (#10168)
- move "vendor" files to js/vendor and less/vendor
- move swagger to js/standalone (meant for standalone pages)
- move gitgraph to features and streamline its loading
- add linting configs to webpack dependencies in make
- set ignored files for eslint/stylelint directly in their configs

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: Antoine GIRARD <sapk@users.noreply.github.com>
2020-02-07 18:09:30 +01:00
Antoine GIRARD
730f026c6e
make: improve make pr (#10165) 2020-02-06 23:40:27 +02:00
zeripath
391e0638cc
Check if go exists before generating the GOPATH (#10100)
* Check if go exists before generating the GOPATH

* Move export PATH into Go protected section

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2020-02-01 21:43:35 -05:00
guillep2k
72f9cfc8f0
Use a file as make evidence for fomantic instead of a directory (#10032)
* Use evidence file as dependency instead of dir

* fix eol

* Update .gitignore

Co-Authored-By: silverwind <me@silverwind.io>

* Use FOMANTIC_SOURCES to establish dependencies as per @silverwind

Co-authored-by: silverwind <me@silverwind.io>
2020-02-01 20:15:32 +00:00
silverwind
6dcf110628
enable babel-loader cache (#10083)
this speeds up repeated webpack builds by around 20%. It will use the
default cache directory `node_modules/.cache/babel-loader`.

Also added cache invalidation to workaround https://github.com/babel/babel-loader/issues/690
2020-02-01 15:12:41 +00:00
silverwind
d7f4f87aaf
fix apple-touch-icon, regenerate images (#10065)
* fix apple-touch-icon, regenerate images

Fixed semi-transparent pixels of apple-touch-icon.png.

I had to manually exclude public/img/loading.png from the commit because
it's an APNG and one of the tools destroys the animation.

* exclude loading.png

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2020-01-30 08:05:40 +02:00
Lunny Xiao
e2c505f5ce
Add RACE_ENABLED=1 envs for make test* (#10055) 2020-01-29 15:43:07 +00:00
zeripath
82a979707a
Update documentation for the go module era (#9751)
* Update documentation for the go module era

use go env instead of $GOPATH

Update instructions to just use git clone

Slight update to readme

Signed-off-by: Andrew Thornton <art27@cantab.net>

* fixup

* Apply suggestions from code review

Co-Authored-By: Antoine GIRARD <sapk@users.noreply.github.com>
Co-Authored-By: Bagas Sanjaya <bagasdotme@gmail.com>

* Apply suggestions from code review

* Fix GOPATH settings

Co-authored-by: Antoine GIRARD <sapk@users.noreply.github.com>
Co-authored-by: Bagas Sanjaya <bagasdotme@gmail.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2020-01-28 21:30:02 -05:00
NiTRoeSE
db42a15fa0
add touch-icon with background (#10022)
* add touch-icon with background

...to prevent ugly glitch while minimize app to homescreen

* add / generate apple-touch-icon

* run make command

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2020-01-28 21:03:39 -05:00
silverwind
1019913eab move CSS build to webpack (#9983)
- added new 'make webpack' target
- deprecated 'make js' and 'make css'
- extend webpack config to load the less files
- updated docs

I had to rename the source file of `arc-green.less` to avoid generating
a useless JS entrypoint via webpack-fix-style-only-entries which would
not work with different source/destination filenames. I hear that there
should be cleaner solutions possible once we upgrade to Webpack 5.

Co-authored-by: zeripath <art27@cantab.net>
2020-01-28 07:30:39 +00:00
zeripath
48abe41ea8
Generate Bindata iff TAGS="bindata" and not up-to-date (#10004)
* Only generate bindata if necessary

* Only generate bindata if they are not up-to-date

* generate a hash of the fileinfo and use that to keep up-to-date

* Newer test is redundant

* handle missing bindata and clean

* Only update hash after successful write

* switch to sha1 hash

* Apply suggestions from code review

Co-Authored-By: guillep2k <18600385+guillep2k@users.noreply.github.com>

Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com>
2020-01-27 01:05:38 +00:00
zeripath
20d637a0f8
Enforce tests do not change files in source tree (#9625) 2020-01-26 20:07:12 +00:00
silverwind
87e1438005 avoid useless fomantic rebuilds (#9999)
the `fomantic` target for some reason does sometimes not update the
timestamp on the directory, leading to useless rebuild. Manually update
the timestamp at the end of the build to avoid this and also added the
same to js/css targets.
2020-01-26 11:31:12 +00:00
Lauris BH
59510d6227
Change font to Roboto to support more charsets (#9803) 2020-01-25 23:47:42 +02:00
silverwind
8ca07305fb make node_modules a order-only prerequisite (#9923)
* make node_modules a order-only prerequisite

Package installations and our fomantic step results in changes inside
node_modules which lead to make triggering that target unnecessarily.

Moved all node_modules prerequisites to order-only which will make skip
the timestamp check on in and eliminate useless npm calls.

Changes in package-lock.json will still result in reinstallation so
node_modules should stay consistent.

* revert change to clean-all
2020-01-25 11:44:36 +00:00
silverwind
bfdfa9a8b3 move fomantic target, update 'make help' (#9945)
I'd like to run webpack without fomantic in the prereqs so move it to
the `generate` target.

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2020-01-23 00:53:57 -05:00
silverwind
c7fe028db4 misc webpack tweaks (#9924)
- reduce verbosity during build
- use array form `use` to allow easier extension
- disable uninteresting source maps
- disable symlink resolution for a speedup

Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: techknowlogick <matti@mdranta.net>
2020-01-22 14:35:29 +08:00
Lunny Xiao
5cf241b312
Use npm to manage fomantic and only build needed components (#9561)
* Use npm to manage fomantic

* Only build needed semantic components

* Fix make

* Don't import fonts from google sites since we have loaded

* [misc] devendor fomantic-ui and rebuild upon src or config changes only

Signed-off-by: Jakob Ackermann <das7pad@outlook.com>

* Change sort alphabetically of semantic components

* Fix trailing slash

* fix makefile

* Remove dependency to gulp from package.json

* Fix something

* Simplife the makefile

* add missed fomantic compnent

Co-authored-by: Jakob Ackermann <das7pad@outlook.com>
2020-01-21 13:17:58 +08:00
guillep2k
ad1b6d439f Add support for database schema in PostgreSQL (#8819)
* Add support for database schema

* Require setting search_path for the db user

* Add schema setting to admin/config.tmpl

* Use a schema different from default for psql tests

* Update postgres scripts to use custom schema

* Update to xorm/core 0.7.3 and xorm/xorm c37aff9b3a

* Fix migration test

Co-authored-by: Antoine GIRARD <sapk@users.noreply.github.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2020-01-20 16:45:14 +01:00
Antoine GIRARD
8dd5ab2a14 ci: simplify tag/release by always running coverage (#9774)
* ci: simplify tag/release by always running coverage

* use mod and vendor for unit test coverage

* remove not needed lfs for unit test
2020-01-16 19:21:35 +00:00
silverwind
f00961abe7 move swagger-ui to webpack/npm (#9714)
Created a second webpack output file for swagger-ui which is loaded on
the /api/swagger route. One notable difference is the absence of the
swagger favicon that was previously used which is now the gitea icon. I
see no easy way to restore that favicon, so I decided to not keep it.
2020-01-14 13:02:08 -05:00
guillep2k
565eb1811c Add test for git + git lfs (#9753) 2020-01-14 00:06:54 +00:00
Antoine GIRARD
dfe4564072
ci: go back to golangci-lint 1.20.0 (#9742)
Revert https://github.com/go-gitea/gitea/pull/9711
2020-01-13 15:06:49 +01:00
silverwind
74e35aae11 remove deprecated targets from Makefile (#9729)
- remove deprecated targets
- ensure 1 empty line between targets

Co-authored-by: Antoine GIRARD <sapk@users.noreply.github.com>
2020-01-12 18:22:26 +01:00