390 Commits (forgejo)

Author SHA1 Message Date
silverwind e3b719863b
Fix potential make error related to fomantic files (#12079)
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
4 years ago
silverwind 7761245d08
Move fomantic and jQuery to main webpack bundle (#11997)
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>
4 years ago
silverwind 772df93671
Disable go module when downloading global binaries (#12030)
Prevent `go get` from touching `go.mod` and `go.sum` when executing
global binaries during the build process. Once
https://github.com/golang/go/issues/30515 is fixed, we should is
whatever solution is provided there.

Fixes: https://github.com/go-gitea/gitea/pull/12010

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
4 years ago
silverwind d31a9c544f
Add public/img/svg to WEBPACK_DEST_ENTRIES (#11993)
Webpack outputs to this directory so it should be removed during
cleanup. No backport needed.

Co-authored-by: zeripath <art27@cantab.net>
4 years ago
Cirno the Strongest a5aa5c58c1
Increase maximum SQLite variables count to 32766 (#11696)
per https://www.sqlite.org/limits.html

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
4 years ago
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>
4 years ago
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
4 years ago
赵智超 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>
4 years ago
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>
4 years ago
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
4 years ago
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>
4 years ago
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>
4 years ago
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>
4 years ago
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>
4 years ago
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>
4 years ago
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>
4 years ago
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>
4 years ago
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>
4 years ago
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>
4 years ago
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>
4 years ago
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>
4 years ago
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>
4 years ago
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
4 years ago
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>
4 years ago
techknowlogick 2fa1078911
go 1.14 (#10467) 4 years ago
guillep2k 10e8da1f1a
Change PACKAGES to GO_PACKAGES for FreeBSD compatibility (#10747)
Co-authored-by: Guillermo Prandi <guillep2k@users.noreply.github.com>
4 years ago
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>
4 years ago
silverwind 334f09d934
Fix makefile syntax error (#10622)
Fix error found via checkmake. It was the only worthwhile issue it reported.
4 years ago
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>
4 years ago
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
4 years ago
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>
4 years ago
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>
4 years ago
zeripath 858aebc2d8
Use [:space:] instead of \s (#10508) 4 years ago
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
4 years ago
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>
4 years ago
Antoine GIRARD 9bada628f2
make: add release-sources (#10295)
* make: add release-sources

* make: release-sources exclude .git and make_evidence
4 years ago
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>
4 years ago
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>
4 years ago
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>
4 years ago
Antoine GIRARD 730f026c6e
make: improve make pr (#10165) 4 years ago
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>
4 years ago
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>
4 years ago
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
4 years ago
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>
4 years ago
Lunny Xiao e2c505f5ce
Add RACE_ENABLED=1 envs for make test* (#10055) 4 years ago
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>
4 years ago
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>
4 years ago
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>
4 years ago
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>
4 years ago
zeripath 20d637a0f8
Enforce tests do not change files in source tree (#9625) 4 years ago
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.
4 years ago
Lauris BH 59510d6227
Change font to Roboto to support more charsets (#9803) 4 years ago
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
4 years ago
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>
4 years ago
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>
4 years ago
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>
4 years ago
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>
4 years ago
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
4 years ago
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.
4 years ago
guillep2k 565eb1811c Add test for git + git lfs (#9753) 4 years ago
Antoine GIRARD dfe4564072
ci: go back to golangci-lint 1.20.0 (#9742)
Revert https://github.com/go-gitea/gitea/pull/9711
4 years ago
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>
4 years ago
techknowlogick fef49f5e2e golangci-lint 1.22.2 (#9711) 4 years ago
6543 7e4f490482 [Docs] introduce "make help" (#9604)
* introduce "make help"

* fix + add more routienes

* Update Makefile

* add make vet

Co-authored-by: techknowlogick <matti@mdranta.net>
4 years ago
dankm d66ae50fd5 Address minor portability issues (#9414)
* Add os specific sed for FreeBSD.

* Replace hardcoded "make" with $(MAKE)

Some systems don't use GNU make by default, and use something like
gnumake or gmake. Respect that when determining the make version.
4 years ago
silverwind 7217b703e9 Combine Drone release steps (#9338)
* Combine Drone release steps

Fixes missing JS/CSS because drone did unwanted parallelization of the
js/css task and the generate task. Combined the tasks into one and made
'make release' work standalone.

Fixes: https://github.com/go-gitea/gitea/issues/9324
Fixes: https://github.com/go-gitea/gitea/issues/9362

* move js/css to generate dependencies

* remove unneccessary go-all target

* remove go target as well
4 years ago
techknowlogick c34fdf7e33
prebuild CSS/JS before xgo release binaries (#9293)
* prebuild CSS/JS before xgo release binaries

* Update .drone.yml

* Update Makefile

* update per @lafriks feedback
5 years ago
silverwind 3f42934b9a Remove explicit 'generate' calls, fix release task (#9288)
* Remove more explicit 'generate' calls

`generate` is now implicit during `build` since #9114, it is no longer
necessary or desired to specify it explicitely.

* add js,css,generate dependencies to release task

* remove generate warning as per @lunny
5 years ago
silverwind 9ff5b75559 Switch CSS minifier to cssnano (#9260)
This results in around 4kB saving in CSS size and also resolves with a
particular issue on git bash which had issues with the format of the
lessc arguments.
5 years ago
silverwind d9c67a8c90 Add Node.js build dep, remove built js/css files (#9114)
- Added Node.js as build dependency and removes build files from git.
- Added version checks for both Go and Node.js.
- Overhauled the js/css make target to only run when needed.
- Merged the `generate` make target into `build` as per suggestion.

Fixes: https://github.com/go-gitea/gitea/issues/6782
Fixes: https://github.com/go-gitea/gitea/issues/9216
5 years ago
Gary Kim 9feab29405 Check compiled files during build (#9042)
Signed-off-by: Gary Kim <gary@garykim.dev>
5 years ago
Lunny Xiao afe50873a5 Move index.js to web_src and use webpack to pack them (#8598)
* Move index.js to web_src and use webpack

* Fix initHeatMap

* update eslint and move webpack to devDependencies

* update index.js

* add eslint env node
5 years ago
Lunny Xiao e4e6d48e30 Move less from public/ to web_src/ so that it will not be packe… (#8908) 5 years ago
6543 5a187f4bcc Add API for Issue set Subscription (#8729)
* add issue subscriber API

* subscribers return []user.APIFormat

* add comments

* more meaningfull description

* without "reqToken()" api works ...
 * should be still secure beause ctx.user has to be there or nothing will hapen

* FIX: getIssueWatchers() get only aktive suscriber

* add return avter error on right position

* Revert "FIX: getIssueWatchers() get only aktive suscriber"

This reverts commit 5eca9291858a821981992b0aaa38cef610d84bca.

* Update routers/api/v1/repo/issue.go

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

* test go linter again

* update swagger

* GetIssueWatchers -> GetIssueSubscribers

part one

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

* GetIssueWatchers -> GetIssueSubscribers
part two

* Revert "test go linter again"

This reverts commit bab12356227e44334de113b76f12099de0b8aaa6.

* change description for unsubscribe too

* golangci-lint timeout avter 5min

* move issueSubscription to seperate file

* dont create black entitys

* use IsWatching until refactoring

* Update License Info

* better swagger description

* Update .golangci.yml

because functions moved from issue.go to issue_subscription.go

* add IssueWatchList type

* batch tasks

* use e Engien

* add error handling

* error should be the last type when returning multiple items

* short version

* reurn empy UserList instead of nil
5 years ago
zeripath fcb535c5c3
Sign merges, CRUD, Wiki and Repository initialisation with gpg key (#7631)
This PR fixes #7598 by providing a configurable way of signing commits across the Gitea instance. Per repository configurability and import/generation of trusted secure keys is not provided by this PR - from a security PoV that's probably impossible to do properly. Similarly web-signing, that is asking the user to sign something, is not implemented - this could be done at a later stage however.

## Features
- [x] If commit.gpgsign is set in .gitconfig sign commits and files created through repofiles. (merges should already have been signed.)
- [x] Verify commits signed with the default gpg as valid
- [x] Signer, Committer and Author can all be different
    - [x] Allow signer to be arbitrarily different - We still require the key to have an activated email on Gitea. A more complete implementation would be to use a keyserver and mark external-or-unactivated with an "unknown" trust level icon.
- [x] Add a signing-key.gpg endpoint to get the default gpg pub key if available
    - Rather than add a fake web-flow user I've added this as an endpoint on /api/v1/signing-key.gpg
    - [x] Try to match the default key with a user on gitea - this is done at verification time
- [x] Make things configurable?
    - app.ini configuration done
    - [x] when checking commits are signed need to check if they're actually verifiable too
- [x] Add documentation

I have decided that adjusting the docker to create a default gpg key is not the correct thing to do and therefore have not implemented this.
5 years ago
kolaente 7408942c80 Update golangci to v1.20 (#8432)
* Update golangci to v1.20

Signed-off-by: kolaente <k@knt.li>

* Use the timeout flag instead of deadline, move it to config

Signed-off-by: kolaente <k@knt.li>
5 years ago
kolaente 249dbbe0bc Update golangci to v1.19.1 (#8414)
Signed-off-by: kolaente <k@knt.li>
5 years ago
Lunny Xiao a8c024043c Improve integration tests (#8276)
* improve integration tests

* fix Makefile

* improve makefile and integration docs
5 years ago
techknowlogick 3f5cdfe359 use go 1.13 (#8088)
* use go 1.13

* use go 1.13 in gomod file

* Update Makefile

* update swagger deps
5 years ago
Antoine GIRARD 9fe4437bda Use vendored go-swagger (#8087)
* Use vendored go-swagger

* vendor go-swagger

* revert un wanteed change

* remove un-needed GO111MODULE

* Update Makefile

Co-Authored-By: techknowlogick <matti@mdranta.net>
5 years ago
Mura Li dd3ba9bb6b Fix make-generate using non-vendor packages (#8008) 5 years ago
Antoine GIRARD 256b178176
Update swagger to 0.20.1 (#8010)
* update swagger to 0.20.1

* fiw swagger version for validate
5 years ago
techknowlogick 99a004c343
Update golangci-lint to v1.17.1 (#7848) 5 years ago
Lars Kistner 714dcf9dad remove `-i` flag from GOFLAGS (#7778)
this flag is not needed for Go versions >=1.10 and creates problems
while building. see https://github.com/golang/go/issues/27285#issuecomment-424382413
5 years ago
Lunny Xiao 87404d7c0b Use vendors when go generate (#7340)
* use vendors when go generate

* update docs about golang minimal requirement from 1.9 to 1.11

* fix build
5 years ago
Cherrg 86750325c7 workaround broken drone build (#7362)
* workaround broken swagger

only master brach is not working, latest release seems to work

Signed-off-by: Michael Gnehr <michael@gnehr.de>

* make vendor

Signed-off-by: Michael Gnehr <michael@gnehr.de>

* Don't export GO111MODULE

* set go-swagger to fixed release version

mentioned here: https://github.com/go-gitea/gitea/pull/7362#discussion_r300831537

Signed-off-by: Michael Gnehr <michael@gnehr.de>
5 years ago
silverwind c37ec66ee2 replace lesshint with stylelint (#7305)
New CSS linter which is much more powerfull than the previous one.
Configuration is default but I had to remove a few rules that were
throwing too many or weird errors.

More importantly, the linter will exit with code 1 on errors so now our
build will fail if the CSS linter fails which should eliminate linter
errors being introduced without notice.
5 years ago
silverwind a71cabbd53 add 'npm' and 'npm-update' make targets and lockfile (#7246)
* add 'npm' and 'npm-update' make targets and lockfile

- `make npm` installs and updates node_modules, triggered automatically
   on `make css` and `make js` as it completes reasonably fast and
   ensures consistent modules.
- `make npm-update` updates all dependencies to their latest version,
   regenerates `node_modules` from scratch and updates
   `package-lock.json`. It uses npm modules `updates` written by yours
   truly to find the latest version of each dependency.

* add suggested make dependencies

* remove package-lock.json during npm-update

* regenerate package-lock.json
5 years ago
silverwind 9ce4d89e99 UI: Fix overflow issues in repo (#7190)
- Fix layout overflow in repo file list.
- Fix invisible status icon in file view and commit list. In file view,
  the icon was moved to the left because I could not figure out a proper
  fix because of HTML tables.
- Added title attribute to commit messages.
- Fixed two CSS linter warnings in existing CSS.
- Fixed CI variable check in 'make css'.

Fixes: https://github.com/go-gitea/gitea/issues/7180
5 years ago
Cherrg 2f39fc7bb6 fix drone build bug (#7192) 5 years ago
kolaente f9ec2f89f2 Add golangci (#6418) 5 years ago
Lunny Xiao 83b90e4199 Use vfsgen instead of go-bindata (#7080)
* use vfsgen instead of go-bindata

* fix templates

* fix fmt

* vendor vsfgen
5 years ago
techknowlogick a83c80a000 Disable arm7 builds (#7037)
* Disable arm7 builds

As arm6 works on arm7 platforms with no noticeable performance difference

* 386
5 years ago
silverwind d9dcd09340 add make targets for js and css, add js linter (#6952)
* add make targets for js,css, add javascript linter

- add `make js`, deprecating `make javascripts`
- add `make css`, deprecating `make generate-stylesheets` and
  `make stylesheets-check`
- changed the unclean css check to only run on CI
- add JS linting via eslint with basic configuration and fixed
  discovered issues
- changed autoprefixer to use official `postcss-cli` avoiding the need
  to loop in the makefile
- moved browserslist to package.json so other future tools can use it
  too.
- update documentation for new make targets and added JS section

* fix indentation

* move functions used in html to 'exported' list

* Run lessc binary without having to install anything to node_modules

* use relative paths to node bin scripts, removing npx

* Revert "use relative paths to node bin scripts, removing npx"

This reverts commit 119b725525a8430b32ee7a6e6009b4ece544e39b.

* fix lessc and postcss plugins

* check for node_modules and use actual bin names
5 years ago
Xaver Maierhofer 3957b40021 Add less linter via npx (#6936) 5 years ago
Xaver Maierhofer 06ae9a3a96 Use single line per selector & don't strip license comments (#6919) 5 years ago
Antoine GIRARD 650df0bd4e Enforce osusergo build tag for releases (#6862) 5 years ago
zeripath 8d0d7bc28d Make CustomPath, CustomConf and AppWorkPath configurable at build (#6631) 5 years ago
zeripath b33f7f792b
Prevent creating empty sessions (#6677)
* Prevent creating empty sessions

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

* Update modules/setting/session.go

* Remove unnecessary option

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

* Add destory to list of ignored misspellings

* rename cookie.go -> virtual.go

* Delete old file

* Add test to ensure that sessions are not created without being logged in

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

* fix tests

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

* Update integrations/create_no_session_test.go
5 years ago
techknowlogick 77ffb1563b
remove bash requirement in makefile (#6617) 5 years ago
techknowlogick 38889f09cb
Fix cross-compile builds (#6609) 5 years ago
Mura Li d8802b1298 Add a new Make target for running single integration test (#6500)
* Add a new Make target for running single integration test

* Use # instead of - as the delimiter
5 years ago
Lunny Xiao 0a8e63c682 add make version on gitea version (#6485) 5 years ago
Richard Mahn 4e3ce71ac9 Fies #6468 - Uses space match and adds newline for all sed flavors (#6473) 5 years ago
Mura Li d77176912b Use Go1.11 module (#5743)
* Migrate to go modules

* make vendor

* Update mvdan.cc/xurls

* make vendor

* Update code.gitea.io/git

* make fmt-check

* Update github.com/go-sql-driver/mysql

* make vendor
5 years ago
silverwind d86f878b3e optimize all images in public/img (#6427)
Fixes: https://github.com/go-gitea/gitea/pull/6357
5 years ago
techknowlogick d10a668ffc
Make the version within makefile overwriteable (#6080)
Fix #1173
5 years ago
Lunny Xiao 4a6b011b15 Add test environment for Mysql8 (#5234) 5 years ago
techknowlogick e558f83407
use updated reference of xgo in makefile (#6339) 5 years ago
Antoine GIRARD 9d3732dfd5 [Contrib] Checkout a PR (#6021) 5 years ago
silverwind 28fcbf33dc UI: Make document body a flexbox (#6139)
* UI: Make document body a flexbox

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

* ie11 fixes

* increase padding to 80px

* add flex-grow
5 years ago
Bo-Yi Wu 05143768d0 Refactor coverage profile with multiple packages (#6167) 5 years ago
John Olheiser eaf9ded182 Makefile changes for Windows and easier development (#6103)
* Added Go Path and node_modules to PATH
* Uses npx now for generate-stylesheets
* Uses `go env GOPATH` to calculate adding GOPATH/bin to PATH
* Added note about installing Node 8.0+ to generate stylesheets
* Added preferred Node version to CONTRIBUTING.md
5 years ago
Antoine GIRARD 9eb00fed13 Run benchmark at tag to track performances (#6035) 5 years ago
silverwind 353282e658 Add autoprefixer to css build (#6029)
* Add autoprefixer to css build

* also use autoprefixer on theme files
5 years ago
zeripath 8917d66571 Add migration test (#5773)
* Add migration test

This commit adds a simple migration test for v1.5.3, v1.6.4 and v1.7.0-rc3

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

* Automigrate based on available dbs

* remove old ini file

* Standardise the dialect names
5 years ago
Jonas Franz 94c3963da0
Fix makefile generate buildstep (#5556)
Signed-off-by: Jonas Franz <info@jonasfranz.software>
5 years ago
kolaente 6db7dbd333 Added test environment for mssql (#4282)
* Added test environment for m$sql

* Added template for test environment for m$sql

* Fix password

* Fix password (again)

* Fix password (again again)

* Fix db

* Ci trigger (Looking at you drone....)

* Ci trigger (Looking at you drone....)

* Ci trigger (Looking at you drone....)

* Ci trigger (Looking at you drone....)

* Create master database for mssql integration tests

Signed-off-by: Jonas Franz <info@jonasfranz.software>

* Create database only if master do not exist

Signed-off-by: Jonas Franz <info@jonasfranz.software>

* Fix mssql integration tests by using custom database "gitea"

Signed-off-by: Jonas Franz <info@jonasfranz.software>

* Moved defer

* bump xorm

* updated xorm

* Fixed build
6 years ago
Bo-Yi Wu 20c54f88b2 refactor: replace lint to revive (#5422)
* refactor: replace lint to revive

* make changes.

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
6 years ago
SohnyBohny 294904321c Create Progressive Web App (#4730)
* Create manifest and serviceworker

* Create templates and add AppSubUrl

* Add JSRenderer

* fix ctx type

* Add JSRenderer to static.go

* Complete adding {{AppSubUrl}}

* Add more fonts to urlsToCache

* Add 512px and 192px icons

* Hardcode font MD5

* Default theme doesn't have a specific CSS file
6 years ago
Mura Li 25c49cf930 Update build tags for sqlite_unlock_notify (#5144) 6 years ago
Lauris BH c42b366f0e
Fix golint to new URL (#5079) 6 years ago
Piotr Orzechowski a74426d631 Swagger.v1.json template (#3572)
* Turn swagger.v1.json into template

* Rename ENABLE_SWAGGER_ENDPOINT option to ENABLE_SWAGGER
6 years ago
Lauris BH a7f90905df
Fix drone git@next plugin Gitea version display when building tag (#4380) 6 years ago
techknowlogick f1d6a1fffc
Add the ability to have built in themes in Gitea (#4198)
This makes it easier for user who want to theme but
don't have the ability to know how to customize templates
all that is required is a change in a config option

The reason why I chose the DEFAULT_THEME as variable,
as perhaps in the future we will allow users to chose their
theme whon logged in just like we do with languages
6 years ago
Fluf 28fb255d91 Add make command to validate swagger file (#4096)
Partial fix for #4088
6 years ago
Antoine GIRARD 08c9617caa Provide compressed releases (#3991)
* Add release-compress to provide compressed releases

* check after compress
6 years ago
Antoine GIRARD 3f3383dc0a Migrate to dep (#3972)
* Update makefile to use dep

* Migrate to dep

* Fix some deps

* Try to find a better version for golang.org/x/net

* Try to find a better version for golang.org/x/oauth2
6 years ago
Lauris BH abff697f31 Update less.js to latest version (#3932) 6 years ago
Antoine GIRARD 3506717e9c Add swagger check (#3811) 6 years ago
Antoine GIRARD cc7b8e3379 Add more bench (#3161)
* Improve makefile + Add benchs

* Apply recommendations of @ethantkoenig
6 years ago
Ethan Koenig c082c3bce3 Restore make test target (#3139)
* Restore make test target

* make build -> go build
7 years ago
Lunny Xiao 41d6afe0e7 Fix compile failed without gcc (#3130)
* fix comile failed without gcc

* add sqlite tag for unit test
7 years ago
Ethan Koenig f148a4a1ed Fix coverage reports (#2974) 7 years ago
Antoine GIRARD d23a3e96f1 Fix bench deps since #2916 (#2971) 7 years ago
Ethan Koenig 061f65ff29 Restore build as the default make rule (#2935) 7 years ago
Ethan Koenig 6ee65757c7 Combine identical Makefile rules (#2916) 7 years ago
Antoine GIRARD dac0f14f34 Docker multi-arch base (#1985)
* Create docker/manifest/base.yml

serve as base for build docker image for most platform (386,amd64,arm,arm64)

* Add make task docker-multi-arch-push-manifest

To update references of a multi-arch image on docker registry.

* Use SED_INPLACE generic sed command

* Delete Dockerfile.aarch64

Delete Dockerfile.rpi

* Use gitea/gitea-base as base

and replace deprecated MAINTAINER by LABEL (https://docs.docker.com/engine/reference/builder/#maintainer-deprecated)

* Fix rebase

* Use sapk/gitea-base as base

* Split makefile for docker

* Fix version to v3.6

Could use in later version edge of alpine official library that support multi-arch for armhf.

* Remove sapk/gitea-base and use directly new official alpine multi-arch
7 years ago
Ethan Koenig f26f4a7e01 Update swagger documentation (#2899)
* Update swagger documentation

Add docs for missing endpoints
Add documentation for request parameters
Make parameter naming consistent
Fix response documentation

* Restore delete comments
7 years ago
Antoine GIRARD 619b9b5547 Move swagger-ui under /api/v1 (#2746)
* Move swagger interface under /api/v1

* Update swagger-ui

* Add /api/swagger and prepare for multiple api version

* Update test links

* Fix footer link
7 years ago
Morlinest 086eb62691 Compress css with nodejs (#2580) 7 years ago
silverwind 1fbfccb4fc Use standard lessc and minify CSS using Node.js (#2337)
* Use standard lessc and minify CSS using Node.js

This changes the previous nonstandard `lessc` to the official one and
enables CSS minification via the clean-css module.

To build CSS, Node.js is required along with a `npm install` to get the
tools installed locally in node_modules so there is no dependency on
binaries in PATH. Benefits include:

- Allows one to have a standard lessc in PATH.
- Can now use command line switches on lessc.
- Minified CSS brings faster page load times and also has the benefit
  of discouraging contributors from editing CSS directly.

To build CSS, Node.js is required along with a `npm install` to get the
tools installed locally based on the information in `package.json`.

The 'make stylesheet' task was modified to run without condition. This
makes it easier to work on the make task itself without having to delete
files.

Also fixes: https://github.com/go-gitea/gitea/issues/2198

* install node, npm and modules on drone

* .PHONY

* use 'minify' to minify CSS
7 years ago
Ethan Koenig fa1cbc2896 Always run fmt check in CI (#2546) 7 years ago
Lauris BH 6f380a22a4 Remove go version check for make fmt (#2558) 7 years ago
Ethan Koenig b0f7457d9e Improve issue search (#2387)
* Improve issue indexer

* Fix new issue sqlite bug

* Different test indexer paths for each db

* Add integration indexer paths to make clean
7 years ago
Bo-Yi Wu 3e89e89670 add codecov.io service. (#2493)
* add codecov.io service.

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>

* update

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>

* only PR or master branch (for coverage badge)

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>

* update

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>

* update init

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
7 years ago
Lauris BH 377cd1ae38 Allow changing integration test database connection using env variables (#2484) 7 years ago
Antoine GIRARD 69dfe43ffc Fix some tests : make coverage -> test (#2492)
* Fix test : make coverage -> test

* Refactor integration tests to be able to run them in parallel

* Add custom local repository temp path
7 years ago
Thomas Boerger 4b8fef143e Changes for latest DroneCI (#2362) 7 years ago
Michael Lustfield a915a09e4f Moved vendored js/css into `public/vendor` and documented sources (#1484) (#2241)
* Cleaning up public/ and documenting js/css libs.

This commit mostly addresses #1484 by moving vendor'ed plugins into a
vendor/ directory and documenting their upstream source and license in
vendor/librejs.html.

This also proves gitea is using only open source js/css libraries which
helps toward reaching #1524.

* Removing unused css file.

The version of this file in use is located at:
  vendor/plugins/highlight/github.css

* Cleaned up librejs.html and added javascript header

A SafeJS function was added to templates/helper.go to allow keeping
comments inside of javascript.

A javascript comment was added in the header of templates/base/head.tmpl
to mark all non-inline source as free.

The librejs.html file was updated to meet the current librejs spec. I
have now verified that the librejs plugin detects most of the scripts
included in gitea and suspect the non-free detections are the result of
a bug in the plugin. I believe this commit is enough to meet the C0.0
requirement of #1534.

* Updating SafeJS function per lint suggestion

* Added VERSIONS file, per request
7 years ago
Bo-Yi Wu be4f6a754c Revert "Changes for latest DroneCI (#2355)" (#2358)
This reverts commit faf4b503b2.
7 years ago
Thomas Boerger faf4b503b2 Changes for latest DroneCI (#2355) 7 years ago
Sandro Santilli 100ec93a65 Remove integration test executables on `make clean` (#2340) 7 years ago
Bo-Yi Wu 722bcefbbf refactor(Makefile): allow overriding default go program (#2310) 7 years ago
Antoine GIRARD a804f0e052 go get github.com/wadey/gocovmerge when needed (#2235) 7 years ago
silverwind d74d8ecc2e Generate small and large logos at 4x resolution (#2233)
To support High-DPI displays, generate images at 4 times their displayed
resolution, which should be enough to support all current devices
according to https://material.io/devices/.
7 years ago
Lunny Xiao a9cc538ab5 remove unused variable on makefile (#2225) 7 years ago
Lauris BH 60d7e56c69 Add task to generate images from SVG and change to new logo (#2194)
* Add makefile task to generate images from SVG and change to new logo

* use absolute path on generate-images
7 years ago
Bo-Yi Wu f011d6d4d7 fix: replace tmp with TMPDIR. (#2152) 7 years ago
Bo-Yi Wu 2c3efd72ce fix typo (#2145)
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
7 years ago
Bo-Yi Wu 2b05b104ef Add verify changed less-file step to Makefile (#1861) 7 years ago
Roy Marples c016d48735 Use POSIX complaint ! operator in find (#2132)
* Use POSIX complaint ! operator in find

-not is a GNU extension and not all find(8) implementations
support it. It's just an alias for ! which is POSIX compliant.

Now gitea compiles on NetBSD at least.

* Revert change in vendor directory as requested
7 years ago
Lunny Xiao dde9a8648e Add make command update-translations for update translations from crodwin (#2097)
* add make command update-translations for update translations from crowdin to options/locale

* use curl & resolve double quote on make file
7 years ago
Mura Li 754482bf5d Add integration test for repository migration (#1983) 7 years ago
Antoine GIRARD 2bcd9471c9 Separate generate swagger + fix sed os specific (#1791)
* Separate generate-swagger

* Remove go generate rules

* Add missing definition replacement + remove use of -i sed flag

for compatibility with mac os default sed version.
This is a little hacky a better solution could be use.

* Use custom SED_INPLACE

depending of platform detection

* Use SED_INPLACE for swagger-ui also
7 years ago
Ethan Koenig 792cde7081 Coverage reports for integration tests (#1960) 7 years ago
Sandro Santilli f6b58964d7 Include formatting check to the `make test` (and thus also `check`) rule (#1366)
* Include formatting check to the `make check` rule

... and give it its own standalone target too (make fmt-check)

Show diff on fmt-check failure
Do not allow running "fmt-check" with incompatible go version
Also simplify the `fmt` rule

* Forbid running "make fmt" with Go version != 1.7 or 1.8

* Ignore bindata.go for spelling and formatting checks

also remove duplicated variable assignment for GOFILES

* Run `make fmt`
7 years ago
Bo-Yi Wu 703d18e50d feat: add check misspelling (#1877) 7 years ago
Bo-Yi Wu e7ae13deef fix: error from mktemp command in MacOS. (#1837)
* fix: error from mktemp command in MacOS.

* [ci skip] udpate temp name.

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
7 years ago
himaaaatti 0f5b399e35 Add variable for docker tag (#1825)
Signed-off-by: Shunsuke Mie <sux2mfgj@gmail.com>
7 years ago
Ethan Koenig cb74f1b84d Remove stale rule from Makefile (#1782) 7 years ago
Ethan Koenig ff96bda138 Only run coverage on merges/pushes to master (#1783) 7 years ago
Lunny Xiao d98a86d2a2 remove sqlite tag when integration test with mysql/postgres AND recreate database when init integration test (#1693) 7 years ago
Thomas Boerger c864ccf9b1 Enforce netgo build tag while cross-compilation (#1690) 7 years ago
Antoine GIRARD 3edb0c5894 Generate swagger json (#1402)
- Generate swagger.json into public/
- Add swagger-ui auto-installation
- Add footer link to local swagger-ui
- Add /swagger url for using app url.
- Fix Swagger-UI version via git tag
7 years ago
Antoine GIRARD bb5f694fc5 Improve govendor testing (#1623)
- Use `govendor list +outside +unused` for finding missing or unused deps and govendor status for catching modified vendor.  
- Remove appengine import
7 years ago
Lauris BH 0144817971 Do not allow commiting to protected branch from online editor (#1502)
* Do not allow commiting to protected branch from online editor

* Add editor integration tests for adding new file and not allowing to add new file to protected branch
7 years ago
Ethan Koenig 66c803fae2 MySQL, Postgres integration tests in drone (#1638)
* MySQL, Postgres integration tests in drone

* Fix .drone.yml

* sign drone

* resign drone
7 years ago
Kim "BKC" Carlbäcker cebe3a6b2f Revert "Set VERSION from git once, in a variable (#1447)"
This reverts commit 410af6971b.
7 years ago
Lunny Xiao fca7ddc6ea improve integration test to resue models/fixtures and store git repos with tests (#1627)
* improve integration test to resue models/fixtures and store git repos with source

* use gitea-integration-meta dir instead .tar.gz and cleanup every before every test

* fix import package name
7 years ago
Ethan Koenig c58708d3ee Integration test framework (#1290)
* Integration test framework

* udpate drone sign

* Formatting fixes and move router.go to routers/

* update sign for drone
7 years ago
Antoine GIRARD eb1075dd4c Check if missing/modified/unused deps in vendor and fix errors (#1468)
* Check if missing deps in vendor

This will catch import from other repos. (maybe by auto-import)

* Remove github.com/smartystreets unused deps

* Remove github.com/boltdb/bolt unused dep

* Fetch github.com/go-xorm/core + sync gopkg.in/ldap.v2/ldap.go

* Auto-install govendor + reinstall github.com/boltdb/bolt needed by vendor/github.com/blevesearch/bleve/index/store/boltdb

* Update go-xorm/xorm to a5cb21 in vendor.json

* Use a custom repo for implementing change to bolt dep.

* Switching bolt to github.com/go-gitea/bolt

* Switching bolt to github.com/go-gitea/bolt (fork version)

* change the drone sign
7 years ago
Sandro Santilli 410af6971b Set VERSION from git once, in a variable (#1447) 7 years ago
Mura Li 2d1efcc270 Add GOFLAGS and EXTRA_GOFLAGS (#1438) 7 years ago
Thomas Boerger 7ed00b6e8d Split the binary build (#985)
As we can not compile darwin binaries with static flags I have split the
build process into different make tasks. Now we get static linked
binaries especially for linux so that it also can run on older versions
of CenOS and so on.

Signed-off-by: Thomas Boerger <thomas@webhippie.de>
7 years ago
Mura Li 848293671b Add basic integration test infrastructure (and new endpoint `/api/v1/version` for testing it) (#741)
* Implement '/api/v1/version'

* Cleanup and various fixes

* Enhance run.sh

* Add install_test.go

* Add parameter utils.Config for testing handlers

* Re-organize TestVersion.go

* Rename functions

* handling process cleanup properly

* Fix missing function renaming

* Cleanup the 'retry' logic

* Cleanup

* Remove unneeded logging code

* Logging messages tweaking

* Logging message tweaking

* Fix logging messages

* Use 'const' instead of hardwired numbers

* We don't really need retries anymore

* Move constant ServerHttpPort to install_test.go

* Restore mistakenly removed constant

* Add required comments to make the linter happy.

* Fix comments and naming to address linter's complaints

* Detect Gitea executale version automatically

* Remove tests/run.sh, `go test` suffices.

* Make `make build` a prerequisite of `make test`

* Do not sleep before trying

* Speedup the server pinging loop

* Use defined const instead of hardwired numbers

* Remove redundant error handling

* Use a dedicated target for running code.gitea.io/tests

* Do not make 'test' depend on 'build' target

* Rectify the excluded package list

* Remove redundant 'exit 1'

* Change the API to allow passing test.T to test handlers

* Make testing.T an embedded field

* Use assert.Equal to comparing results

* Add copyright info

* Parametrized logging output

* Use tmpdir instead

* Eliminate redundant casting

* Remove unneeded variable

* Fix last commit

* Add missing copyright info

* Replace fmt.Fprintf with fmt.Fprint

* rename the xtest to integration-test

* Use Symlink instead of hard-link for cross-device linking

* Turn debugging logs on

* Follow the existing framework for APIs

* Output logs only if test.v is true

* Re-order import statements

* Enhance the error message

* Fix comment which breaks the linter's rule

* Rename 'integration-test' to 'e2e-test' for saving keystrokes

* Add comment to avoid possible confusion

* Rename tests -> integration-tests

Also change back the Makefile to use `make integration-test`.

* Use tests/integration for now

* tests/integration -> integrations

Slightly flattened directory hierarchy is better.

* Update Makefile accordingly

* Fix a missing change in Makefile

* govendor update code.gitea.io/sdk/gitea

* Fix comment of struct fields

* Fix conditional nonsense

* Fix missing updates regarding version string changes

* Make variable naming more consistent

* Check http status code

* Rectify error messages
7 years ago
Jonas a201977590 Fix for #828: Embed build tags (#1051)
* Fix for #828
Add build tags to ldflags and print in version output

Signed-off-by: Jonas Östanbäck <jonas.ostanback@gmail.com>

* Reworked formatBuiltWith function

Signed-off-by: Jonas Östanbäck <jonas.ostanback@gmail.com>

* Add tags to version information in admin panel

Signed-off-by: Jonas Östanbäck <jonas.ostanback@gmail.com>

* Added new variable for use on admin page.

Signed-off-by: Jonas Östanbäck <jonas.ostanback@gmail.com>

* Fixed incorrect indentation
7 years ago
silverwind ab462fb95f Makefile: Use hash over which (#1069)
`hash` is a much faster shell-builtin alternative to `which`.
7 years ago
silverwind 5bd22a2f4a Makefile: Also redirect stderr on which calls (#1068) 7 years ago
Dan Morrill 832477b1bc Tweak docker target to work by default. (#1033)
Fix for #1013: adds "bindata" to tags by default, as without this the
resulting docker image won't start, as it doesn't contain locale files.
Verified to work even if you specify TAGS="bindata" such that it appears
twice.
7 years ago
Andrey Nering e4031b822a Makefile: install on build (#874)
This install Go package on building for caching and faster builds
7 years ago
Thomas Boerger ea8c8cdaf3 Fix master builds on mips* again (#815)
* Use local folder for xgo

* Always do crosscompile and testing to fail early

* Added mips* values for boltdb

In order to get master building again I have applied these 2 additional
files to boltdb. This should get dropped when
https://github.com/boltdb/bolt/issues/656 gets solved.
7 years ago
Thomas Boerger 369972b116 Set the ldflags to static value within makefile (#709) 7 years ago
Thomas Boerger d0ad7921f8 Enforce custom LDFLAGS within makefile (#684) 7 years ago
Andrey Nering b7e1bccc50 Makefile: on Windows, executable should have ".exe" (#550) 7 years ago
Bo-Yi Wu cb18941e63 replcae go fmt with gofmt command.
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
7 years ago
Thomas Boerger 6aacf4d2f0 Properly handle drone tags and release/* branches (#466) 8 years ago
Thomas Boerger b33078fa33 Bindata is optional and over-writable on restart (#354)
* Moved conf assets into options folder

* Dropped old bindata

* Started to integrate options bindata and accessors

* Do not enforce a builtin app.ini

* Replaced bindata calls with options

* Dropped bindata task from makefile, it's the generate task now

* Always embedd app.ini to provide sane config defaults

* Use sane defaults for the configuration

* Defined default value for SSH_KEYGEN_PATH

* Dropped "NEVER EVER MODIFY THIS FILE" header from app.ini

* Fixed new paths in latest test additions

* Drop bindata with make clean task

* Set more proper default values
8 years ago
Thomas Boerger 618407c018 Do not override the binary version name from drone (#436)
Signed-off-by: Thomas Boerger <tboerger@suse.de>
8 years ago
Thomas Boerger c6b6a61bf1 Fixing multiple docker issues (#386)
* Added stupid docker task to makefile

* Dropped unknown option PrintLastLog from docker ssh config

* OpenSSH should log to docker stdout

* Set random pw for docker git user, otherwise it is locked

* Stop using templates and public within docker
8 years ago