* Detect version of sed in Makefile
It's possible to install GNU sed on Darwin or FreeBSD so it's better to
not assume BSD sed on those platforms but to instead perform version
detection for the `GNU` string and only use BSD syntax if absent.
* silence stderr
Co-authored-by: Lauris BH <lauris@nix.lv>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* Add 'watch-backend'
This leverages `air` to watch the backend files and trigger `make
backend` automatically when they change. It seems to work rather well
together with `watch-frontend`.
Fixes: https://github.com/go-gitea/gitea/issues/12318
* rework docs to a new section for continuous build
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* Rework 'make generate-images'
- Remove external dependencies and replace it with a node script that
does does the same.
- Move detail removal from gitea-sm.png to favicon.png
- Remove favicon.ico and its generation, it is unused and we already serve
favicon.png in its place.
Fixes: https://github.com/go-gitea/gitea/issues/12314
* use proper centering value for preserveAspectRatio
* fix lint
* use fabric
* better linting fix
* fix typo
* mention detail-remove class in docs
* merge docker makefile into main one
* add readme for docker folder
* don't include a file that doesn't exist anymore
Co-authored-by: Lauris BH <lauris@nix.lv>
It is ok to use go modules at this point as release-source make target has already been run. Otherwise hugo fails to build. Example of failed build: https://drone.gitea.io/go-gitea/gitea/27976/5/3
Co-authored-by: Lauris BH <lauris@nix.lv>
Introduce 'make svg' which calls a node script that compiles svg files
to `public/img/svg`. These files are vendored to not create a dependency
on Node for the backend build.
On the frontend side, configure webpack using `raw-loader` so SVGs can
be imported as string.
Also moved our existing SVGs to web_src/svg for consistency.
Fixes: https://github.com/go-gitea/gitea/issues/11618
This prevents a potential make errors like "No rule to make sticky.js"
that happens when a file is present from a previous build but is not
generated in the current build. We don't use these module files from
fomantic so it's safe to not depend on them.
Related to: 7761245d08
This saves around 3 MB binary size by not including useless fomantic
files in the build. Also, this allows us to move jQuery into the main
bundle as well which eliminates a few HTTP requests.
Also included are webpack config changes:
- split less and css loaders to speed up compliation
- enable css sourcemaps
- switch css minfier plugin to cssnano-webpack-plugin which works better
for sourcemaps than the previous plugin
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* 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
* 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>
* 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>
* 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>
* 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>
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>
* 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>
* 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>
* 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>
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>
* 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>
- 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
* 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>
- 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>
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>
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>
* 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>
* 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
- 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>
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>
* 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>
- 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>
* Check if go exists before generating the GOPATH
* Move export PATH into Go protected section
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* 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>