Commit Graph

235 Commits

Author SHA1 Message Date
silverwind 3affe9516a
Update fomantic-ui to 2.8.5 (#11736)
Update to [2.8.5](https://github.com/fomantic/Fomantic-UI/releases/tag/2.8.5)
and remove the workaround for the CSS build race condition.

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2020-06-03 22:24:04 -04:00
silverwind 3761bdb640
Fix serviceworker output file and misc improvements (#11562)
* Fix serviceworker output file and misc improvements

- Fix output file location for production build
- Cache more asset types: fonts and worker variants
- Parallelize a few tasks during initalization
- Only invalidate caches starting with our prefix
- Remove public/serviceworker.js before building
- Remove font preloads, they cause strange cors issues
- Misc eslint config adjustments

* remove webpack output files on watch-frontend
2020-05-24 08:36:40 +01:00
赵智超 4159866528
docs: update 'Testing redux' in CONTRIBUTING.md (#11386)
* docs: update 'Testing redux' in CONTRIBUTING.md

try simplfy it to make it more easy for contributor to follow it to
test their work by themselves.

Signed-off-by: a1012112796 <1012112796@qq.com>

* align help message strings

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2020-05-14 19:28:26 -04:00
silverwind 9249c810b8
Switch code editor to Monaco (#11366)
* Switch code editor to Monaco

This switches out CodeMirror for Monaco which is based on the same code
base as VS code and should work pretty similar to it.

It does add a few async chunks, totalling around 10MB to our build. It
currently supports around 65 languages and in the default configuration,
each language would emit one ugly [number].js chunk, so I opted to
combine them all into a single file for now.

CodeMirror is still being used under the hood by SimpleMDE so it can not
be removed yet.

* inline editorconfig, fix diff, use for markdown, remove more dead code

* refactors, remove jquery usage

* use tab_width

* fix intellisense

* rename function for clarity

* misc tweaks, enable webpack progress display

* only use --progress on dev build

* remove useless borders in arc-green

* fix typo

* remove obsolete comment

* small refactor

* fix file creation and various refactors

* unset useTabStops too when no editorconfig

* small refactor

* disable webpack's [big] warnings

* remove useless await

* fix dark theme check

* rename chunk to 'monaco'

* add to .gitignore and delete webpack dest before build

* increase editor height

* support more editorconfig properties

* remove empty element filter

* rename

Co-authored-by: John Olheiser <john.olheiser@gmail.com>
2020-05-14 19:06:01 +03:00
silverwind 606d9d63f6
Update JS dependencies, min Node.js version 10.13 (#11246)
`less-loader` now dictates a minimum Node.js version of 10.13.0,
released 2018-10-30 so I've updated this requirement to match.

https://github.com/webpack-contrib/less-loader/releases/tag/v6.0.0
2020-04-30 11:37:01 +01:00
silverwind 310699bca7
Patch fomantic-ui to workaround build issue (#11244)
* Patch fomantic-ui to workaround build issue

Better workaround than https://github.com/go-gitea/gitea/issues/10653
for https://github.com/fomantic/Fomantic-UI/issues/1356. It does not
seem like we're getting a new Fomantic-UI release anytime soon, so
this patches it after node_modules installation.

Fixes: https://github.com/go-gitea/gitea/issues/11243
Fixes: https://github.com/go-gitea/gitea/issues/10679

* copy instead of patch

* update package-lock.json

* Update Makefile

Co-Authored-By: Sorien <Sorien@users.noreply.github.com>

* Update web_src/fomantic/css.js

Co-Authored-By: zeripath <art27@cantab.net>

Co-authored-by: Sorien <Sorien@users.noreply.github.com>
Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com>
2020-04-30 07:26:37 +01:00
guillep2k 23163e98a3
Use /tmp for test repositories (#11126)
* Add option to use /tmp for test repositories

* Fix exit status

* Add feedback about using tmp repos

Co-authored-by: Guillermo Prandi <guillep2k@users.noreply.github.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2020-04-19 14:17:02 +03:00
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