390 Commits (forgejo)

Author SHA1 Message Date
silverwind 2b9df564b8
Lock gofumpt to v0.3.0 and run it (#18866)
We can't depend on `latest` version of gofumpt because the output will
not be stable across versions. Lock it down to the latest version
released yesterday and run it again.
2 years ago
KN4CK3R 159c3f48af
Generate coverage with sqlite. (#18813) 2 years ago
silverwind 6767798eef
Move editorconfig-checker to lint-backend and remove JS wrapper (#18793)
* Move editorconfig-checker to lint-backend

It makes more sense there as templates are considered backend code.

* User golang version of the tool

* remove dependency
2 years ago
zeripath 32599bf060
Increase the size of the webauthn_credential credential_id field (#18739)
Unfortunately credentialIDs in u2f are 255 bytes long which with base32 encoding
becomes 408 bytes. The default size of a xorm string field is only a VARCHAR(255)

This problem is not apparent on SQLite because strings get mapped to TEXT there.

Fix #18727

Signed-off-by: Andrew Thornton <art27@cantab.net>
2 years ago
silverwind 2ddff74a54
Reduce CI go module downloads, add make targets (#18708)
The CI currently downloads all go modules in each pipeline step because
go modules reside outside the project directory. Fix this by introducing
a volume for the `/go` directory [1] so modules are only downloaded once per
pipeline using a new `deps-backend` make target.

For completeness, I also included new `deps` and `deps-frontend` targets
and the frontend one is also triggered explicitly on CI where needed.

[1] https://docs.drone.io/pipeline/kubernetes/examples/language/golang/#dependencies
2 years ago
silverwind 37ead26e36
Fix `make fmt` and `make fmt-check` (#18633)
* Run 'make fmt'

'make fmt' currently produces this change, I'm not sure how CI did not
fail on it, I made sure I have `mvdan.cc/gofumpt@latest`.

* Fix 'make fmt-check'

`make fmt-check` did not run all commands that `make fmt` did, resulting
in missed diffs. Fix that by just depending on the `fmt` target.

Includes: https://github.com/go-gitea/gitea/pull/18633

* Make gitea-fmt work with -l and -d and integrate gofumpt

This implements -l, -w and -d with gitea-fmt and merges gofumpt.

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

* as per silverwind

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

* Apply suggestions from code review

* use -l instead of -d for fmt-check

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

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Andrew Thornton <art27@cantab.net>
2 years ago
Kyle D a51d2114c7
quote MAKE to prevent path expansion with space error (#18622)
Pretty minor change to prevent error when `$(MAKE)` path is expanded with a space in the path. 

```bash
$ TAGS="bindata sqlite sqlite_unlock_notify" make build
/usr/bin/sh: -c: line 0: syntax error near unexpected token `('
/usr/bin/sh: -c: line 0: `C:/Program Files (x86)/GnuWin32/bin/make -v | head -n 1'
```

I believe Program Files (x86) is the default path for GNU make on windows
2 years ago
6543 6f6b8491da
add gitea-fmt back (#18526) 2 years ago
Gusted b53fd5ff90
Bump golangci-lint version (#18411)
- Bump golangci-lint version to v1.44.0 (no new linter errors detected)
2 years ago
6543 54e9ee37a7
format with gofumpt (#18184)
* gofumpt -w -l .

* gofumpt -w -l -extra .

* Add linter

* manual fix

* change make fmt
2 years ago
a1012112796 8581e2f4ec
update description about vendoring in CONTRIBUTING.md (#18280)
* update description about vendoring in CONTRIBUTING.md

follow #18277

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

* Update CONTRIBUTING.md

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>

* fix and readd test-vendor step

* remove vendor from .gitattributes @silverwind

* simplify go mod check

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

* Revert "remove vendor from .gitattributes @silverwind"

This reverts commit 4789e704cb7a2c80934e4a4cd31efb161e6c8666.

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: 6543 <6543@obermui.de>
2 years ago
silverwind 0ed9b006e8
Add lockfile-check (#18285)
* Add lockfile-check

This check runs `npm install` which will rewrite the lockfile in case it
is inconsistent with package.json. This check detects this and will fail
the CI in such a case.
2 years ago
techknowlogick 84145e45c5
Remove golang vendored directory (#18277)
* rm go vendor

* fix drone yaml

* add to gitignore
2 years ago
wxiaoguang eaf09a5368
Fix documents for development and bug report (#18249) 2 years ago
Bo-Yi Wu 948949f429
chore(lint): use golangci-lint to call revive and misspell checker. (#18145)
replace revive and misspell with golangci-lint

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2 years ago
Gusted 7be82f4af8
Avoid running go vet twice (#18059) 2 years ago
silverwind a159c3175f
Add new JS linter rules (#17699)
* Add new JS linter rules

Adds a few useful rules from eslint-plugin-github. Notable changes:

- Forbid dataset usage, its camel-casing behaviour makes it hard to
  grep for attributes.
- Forbid .then() and .catch(), we should generally prefer await for new
  code. For rare cases where they are useful, a eslint-disable-line
  directive can be set.
- Add docs js to linting

* also enable github/array-foreach

* small tweak

Co-authored-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
3 years ago
wxiaoguang 750a8465f5
A better go code formatter, and now `make fmt` can run in Windows (#17684)
* go build / format tools
* re-format imports
3 years ago
Gusted 21f6c0be08
Update golangci-lint in Makefile (#17647)
* Update golangci-lint in Makefile

- Partially resolvess #17596
- Download specific version(v1.43.0) by default.
- If current installed version is older than the minium version, it will
download the mininium required version.
- Update the install script to avoid deprecated error
`golangci/golangci-lint err this script is deprecated, please do not use
it anymore. check https://github.com/goreleaser/godownloader/issues/207`

* Simplify golangci-lint version check

* Fix version conversion

* Add version that's downloading

Co-authored-by: zeripath <art27@cantab.net>

* Consistency

Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
3 years ago
Lunny Xiao 42670e6b1c
Set unit test timeout to 20 minutes (#17664)
* Set unit test timeout to 15 minutes

* Update Makefile

Co-authored-by: silverwind <me@silverwind.io>

Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
3 years ago
silverwind de61816623
Rename .air.conf to .air.toml (#17360)
As of https://github.com/cosmtrek/air/pull/90, the preferred file
extension is .toml. The file format was always toml itself.
3 years ago
techknowlogick db895040dd
Use go1.16+ way of installing binaries (#17342) 3 years ago
zeripath 83640a595b
Workaround coverage bug part 2 (#16906)
* Workaround coverage bug part 2

Just grep away bad lines from coverage files.

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

* try again

Signed-off-by: Andrew Thornton <art27@cantab.net>
3 years ago
zeripath c0f5da3e1a
Prevent coverage break (#16887)
* Prevent coverage break

There are repeated failures of our CI due to an intermittent issue with coverage.out
finishing with a spurious `0` on a single line.

This problem is very annoying and very hard to understand where it is coming from,
therefore as the problem appears random and without clear cause we should just strip
this line from our coverage.

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: 6543 <6543@obermui.de>
3 years ago
silverwind 360d8e7c23
Remove unused Fomantic sidebar module (#16853)
* Remove unused Fomantic sidebar module

The [Sidebar](https://fomantic-ui.com/modules/sidebar.html) module seems
currently unused (at least I can't find any reference to it in templates
or js), so remove it from the Fomantic build.

* remove useless minified fomantic build files

* mark fomantic build files as being generated
3 years ago
Mura Li b60e814055
Enable race detector for CI (#1441)
* Enable race detector by default

Set RACE_ENABLED=0 to disable it when release

* Disable race detector for release builds

* use `true`

* fix

* debug issue

* fix

* verbose

* clean

* Fix wrong merge

* Fix coverage merge

Co-authored-by: Mura Li <typeless@users.noreply.github.com>
Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
3 years ago
techknowlogick 274aeb3a9e
build with go1.17 (#16707)
Co-authored-by: Lauris BH <lauris@nix.lv>
3 years ago
zeripath 6e6f23b315
Restore Accessibility for Dropdown (#16576)
* Restore #10096/#8638 and re-fix #15172

This PR restores the vendored and patched dropdow from #8638. It
however, abandons the calls to `click()` using instead the default
dropdown click calls instead. This prevents the issue of the dropdown
grabbing focus permanently however, this may have negative effects on
the effect of focus on the dropdowns.

Of note, the behaviour of the template selector dropdown on the repo
creation page is slightly odd - I don't believe that this odd behaviour
is caused by this PR but rather by the feed source for this. I suspect
that the dropdown should be adding a delete button to its selection.

Fix #15172
References: #7057

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

* leverage fomantic-build instead

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

* as per jookia

Signed-off-by: Andrew Thornton <art27@cantab.net>
3 years ago
zeripath 35735bbef9
Upgrade to golang-jwt 3.2.2 (#16590)
* Upgrade to golang-jwt 3.2.2

Upgrade to the latest version of golang-jwt

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

* Forcibly replace the 3.2.1 version of golang-jwt/jwt and increase minimum Go version

Using go.mod we can forcibly replace the 3.2.1 version used by goth to 3.2.2.

Further given golang-jwt/jwts stated policy of only supporting supported go versions
we should just raise our minimal version of go to 1.16 for 1.16 as by time of release
1.15 will be out of support.

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

* update minimal go required

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

* update config.yaml

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

Co-authored-by: 6543 <6543@obermui.de>
3 years ago
zeripath e83abfc289
Prevent race in TestPersistableChannelQueue (#16468)
* Prevent race in TestPersistableChannelQueue

A slight race has become apparent in the TestPersistableChannelQueue.

This PR simply adds locking to prevent the race.

* make print value of "$(GOTESTFLAGS)" on test-backend and unit-test-coverage


Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: 6543 <6543@obermui.de>
3 years ago
luzpaz fc1607b368
Fix source typos (#16374)
* Fix source typos

Follow up to e0296b6a6  
Found via `codespell -q 3 -S ./options/locale,./vendor -L ba,pullrequest,pullrequests,readby`

* rm "ignore destory on `make misspell-check`"

Co-authored-by: 6543 <6543@obermui.de>
3 years ago
6543 c1ff59c1cd
use "true" for RACE_ENABLED (#15261) 3 years ago
BoYanZh fb6c6895fa
fix get OS on some of the windows computers (#16007) 3 years ago
silverwind 05fb1f61d5
Add jest rootDir and test-frontend dependency (#15860)
- Define jest rootDir to limit where it looks for test files
- Add missing dependency on test-frontend target so it can be ran from a
  clean checkout
3 years ago
silverwind c3802dcc0f
Use binary version of revive linter (#15739)
Use the common `go get` method to install and run the revive linter,
removing the useless build/lint.go and related vendor libraries.
3 years ago
6543 272bbb200d
Make let target "clean-all" remove node_modules folder too (#15780)
* Make let target "clean-all" remove node_modules folder too
3 years ago
techknowlogick ab77a24f18
update branch in CI and docs (#15631) 3 years ago
Kyle D 9b8ffa1c7a
Output node min version variable (#15562) 3 years ago
silverwind f7830041f4
Make build scripts compatible with node 12 (#15479)
* Make build scripts compatible with node 12

"fs/promises" is not in node 12, use a more compatible way to import it.
Also, lock major down versions of the image build dependencies to
prevent future surprises.

* add node_modules dependency
3 years ago
zeripath 61bae620c1
Build go-git variants for windows (#15482)
It appears that there are significant performance problems with the pure git backend
on windows.

Therefore until we can sort this out - provide go-git backend builds.

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

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
3 years ago
silverwind d848098f60
Enforce tab indentation in templates (#15289)
* Enforce tab indendation in templates

This adds editorconfig-checker [1] to lint the template files so they
conform the editorconfig files. I fixed all current identation issues
using the fix mode of eclint [2] and some manual corrections.

We can extend this linting to other files later, for now I'd like this
PR to focus on HTML template files only.

[1] https://github.com/editorconfig-checker/editorconfig-checker
[2] https://github.com/jedmao/eclint

* fix indendation

Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
3 years ago
silverwind 0991f9aa42
Stop packaging node_modules in release tarballs (#15273)
- Don't package node_modules in tarballs, they are not cross-platform
  anymore and npm cache should not be messed with directly. Instead,
  require an internet connection to rebuild the UI, which is not necessary
  in the general use case because prebuilt UI files are shipped in the
  public directory.
- Simplify the fomantic build and make the target phony. We don't need
  anything more for something that is rarely ran.
- Use regular tar again to build tarballs and add variable for excludes
- Disable annoying npm update notifications

Fixes: https://github.com/go-gitea/gitea/pull/14578
Fixes: https://github.com/go-gitea/gitea/pull/15256
Fixes: https://github.com/go-gitea/gitea/pull/15262

Co-authored-by: 6543 <6543@obermui.de>
3 years ago
silverwind 0d1a5e0ffc
Add frontend testing, require node 12 (#15315)
- Add basic frontend unit testing infrastructure using jest in ESM mode
- Rename 'make test' to 'make test-backend'
- Introduce 'make test-frontend' and 'make test' that runs both
- Bump Node.js requirement to v12. v10 will be EOL in less than a month.
- Convert all build-related JS files to ESM.

I opted to run frontend tests run as part of the compliance pipeline because
they complete fast and are not platform-specific like the golang tests.
3 years ago
zeripath cc2d540092
Fix release expansion issue (#15251)
* Fix release expansion issue

Fix #14578

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

* fix cache statement too

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

* and update the npmrcs

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

* as per @silverwind

Co-authored-by: silverwind <me@silverwind.io>

Co-authored-by: silverwind <me@silverwind.io>
3 years ago
Lunny Xiao 42efa14f51
Introduce esbuild on webpack (#14578)
* Vendor node mods as cache; fix esbuild/fomantic offline build

* Fix --exclude; use bsdtar for consistent globbing

* Fall back to GNU tar; forward-compatible for APT 2.0

* Avoid having extd. attrs with bsdtar

* Dependency and misc. optimizations

* Remove extra code after esbuild-loader update

Co-authored-by: Mike L <cl.jeremy@qq.com>
3 years ago
zeripath 39ef6f83d5
Create Proper Migration Tests (#15116)
* Create Proper Migration tests

Unfortunately our testing regime has so far meant that migrations do not
get proper testing.

This PR begins the process of creating migration tests for this.

* Add test for v176

* fix mssql drop db

Signed-off-by: Andrew Thornton <art27@cantab.net>
3 years ago
zeripath 91ee3be588
Prevent incorrect HTML escaping in swagger.json (#14957)
* Prevent incorrect HTML escaping in swagger.json

Fix #14706

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

* oops add it to the helper

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

* try again

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

Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
3 years ago
techknowlogick b175791665
build darwin on arm64 platforms (#14951)
fix #14945
3 years ago
techknowlogick d801a158c5
use gomod support w/ xgo (#14836) 3 years ago
techknowlogick 47f6a4ec3f
go1.16 (#14783) 3 years ago
6543 5cc1a49b19
Generate man pages (#13901)
* extend gitignore

* first working draft

* use docs subcomand

* rm config-sheet-sheet-2-man
3 years ago
techknowlogick 1f570f2208
build for only available darwin target (#14771) 3 years ago
Lunny Xiao 00fffdf5df
Make release-linux archtectures via envs (#14184) 3 years ago
6543 25fe60d12f
Update golangci-lint v1.35.2 -> v1.37.0 (#14747) 3 years ago
techknowlogick ce0346448f
remove outdated notice in makefile (#14720)
Co-authored-by: 6543 <6543@obermui.de>
3 years ago
uli-heller 758627cf8f
Fixed irritating error message related to go version (#14611)
I do have go-1.13.8 installed and get the error message

```
Gitea requires Go 1.13 or greater to build. You can get it at https://golang.org/dl/
```

I do thing that Go 1.14 or greater is actually required
3 years ago
techknowlogick d2ea21d0d8
Use caddy's certmagic library for extensible/robust ACME handling (#14177)
* use certmagic for more extensible/robust ACME cert handling

* accept TOS based on config option

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

Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: Lauris BH <lauris@nix.lv>
3 years ago
techknowlogick 62643d94a3
Update golangci-lint to 1.35.2 (#14418) 3 years ago
Lunny Xiao b4dc080c96
It seems vet on windows is unnecessary (#14302)
* It seems vet on windows is unnecessary

* add vet back to drone but remove GOOS and GOARCH when build vet
3 years ago
techknowlogick 4f2f08bd80
deprecate building for mips (#14174)
Co-authored-by: zeripath <art27@cantab.net>
3 years ago
silverwind 50a2dd52ba
Update JS dependencies and webpack (#14118)
* Update JS dependencies

- Update all JS dependencies
- Adapt webpack config for version 5
- Update to Less 4.0, adapting usage of removed mixin syntax
- Enable new ESLint rules and fix discovered issues

* update license-webpack-plugin to fix missing licenses

* update license-webpack-plugin once more to get webpack into the license output

* switch to license-checker-webpack-plugin again for performance

* update deps again

Co-authored-by: Lauris BH <lauris@nix.lv>
3 years ago
Kyle D 4ef751215c
put ${CURDIR} in quotes to prevent make from splitting paths with spaces into separate strings (#14056) 3 years ago
Kyle D 4cd94e3689
gitea png to logo (#13974)
* gitea png to logo.svg

* gitea safari svg to logo

* minify svgs

* Update english docs

* Update missing section on customizing logo
3 years ago
silverwind e9cc613c24
Makefile cleanup & double golangci-lint timeout (#14044)
* Makefile cleanup

The xmldom dependency is no longer required since #13680. Also,
whitespace cleanup.

* double the golangci-lint timeout
3 years ago
zeripath 511f6138d4
Use native git variants by default with go-git variants as build tag (#13673)
* Move last commit cache back into modules/git

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

* Remove go-git from the interface for last commit cache

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

* move cacheref to last_commit_cache

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

* Remove go-git from routers/private/hook

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

* Move FindLFSFiles to pipeline

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

* Make no-go-git variants

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

* Submodule RefID

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

* fix issue with GetCommitsInfo

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

* fix GetLastCommitForPaths

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

* Improve efficiency

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

* More efficiency

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

* even faster

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

* Reduce duplication

* As per @lunny

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

* attempt to fix drone

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

* fix test-tags

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

* default to use no-go-git variants and add gogit build tag

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

* placate lint

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

* as per @6543

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

Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
3 years ago
AdamKorcz 94415f7517
Added 2 fuzzers (#13818)
* Added fuzzer

Signed-off-by: AdamKorcz <adam@adalogics.com>

* Added better fuzzer names

Signed-off-by: AdamKorcz <adam@adalogics.com>

* Moved fuzzer to /tools

* Update tools/fuzz.go

Co-authored-by: 6543 <6543@obermui.de>

* Update tools/fuzz.go

* Update tools/fuzz.go

Co-authored-by: silverwind <me@silverwind.io>

* Added tools to Makefile

Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: zeripath <art27@cantab.net>
3 years ago
silverwind 18712eab79
Reduce make verbosity (#13803)
Various make targets log huge lists of files to the terminal which are
generally useless to read. Replace those cases with short replacement
messages.

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
4 years ago
silverwind 63aeb0a859
Fix webpack build warnings (#13752)
Turns out some of the dependencies make use of optional dependencies
like the vue-template-compiler. Install them again and install
fomantic-ui only when it's being build to fix webpack warnings.
4 years ago
silverwind e81edc02b9
Update JS dependencies and misc tweaks (#13741)
* Update JS dependencies and misc tweaks

- Update all JS dependencies minus webpack
- Adapt CodeMirrors styling to new CSS parent introduced by EasyMDE
- Set eslint parser to latest and add new eslint 7.14 rule
- Speed up npm install by disabling audit and fund checks
- Move fomantic-ui to optional dependencies to further speed up npm
- Enable syntax highlighting on GH for .eslintrc and .stylelintrc
- Makefile cleanups

* disable audit in npmrc

* add missing dash

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
4 years ago
6543 e7b47c5215
Format files (#13698)
* align "make help"

* format

* untouch build/generate-svg.js

* untouch .eslintrc

* combine editorconfig's

* rm editorconfig

Co-authored-by: Lauris BH <lauris@nix.lv>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
4 years ago
silverwind 7ab3633598
Enable linting of JS inside templates (#13708)
Indentation-related rules are disabled because indent templates with
tabs but our lint rules expect spaces.

Also had to exclude a few files where using template variables in the JS
is causing syntax errors for the JS parser. I don't think there's a way
to solve this otherwise.

Co-authored-by: Lauris BH <lauris@nix.lv>
4 years ago
silverwind 949e3f53f6
Fix Fomatic Build (#13595)
Port of #13593 to 1.14
4 years ago
silverwind 7c47e24093
Add Vue linting (#13447)
* Add Vue linting

Turns out the .vue files were not linted at all, so I added that as well
as re-indented the file to 2-space and fixed all reasonable issues that
cam up except one case of a unintended side effect for which I have no
idea how to fix it, so the rule was disabled.

* misc tweaks

* update lockfile

* use overrides to include .vue files

* treat warnings as errors on lint-frontend

* also treat stylelint warnings as errors

* use equal sign syntax

Co-authored-by: Lauris BH <lauris@nix.lv>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
4 years ago
silverwind b64978d0bc
Fully remove fomantic-ui from frontend build dependencies (#13340)
Followup to https://github.com/go-gitea/gitea/pull/13332. Turns out I
missed this dependency which resulted in fomantic-ui being uselessly
rebuild on CI. This fully removes it from the chain so it's not
attempted to be build as part of the main build process.
4 years ago
silverwind 946bbbe9b5
Precompile fomantic-ui files (#13332)
We rarely change fomantic-ui or its configuration so it's kind of a
waste to have it rebuild on every CI run. These changes remove the
fomantic files from the build and instead add the relevant output files
to the git index, which should shave of 2-3 minutes on every CI run.

`make fomantic` should still work and should be ran whenever fomantic is
updated or its configuration is changed.

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
4 years ago
E14 c962518cc2
Use GO variable in go-check target (#13146) (#13147) 4 years ago
6543 49b1948cb1
Gitea 2 Gitea migration (#12657)
* first draft

* update gitea sdk to 9e280adb4da

* adapt feat of updated sdk

* releases now works

* break the Reactions loop

* use convertGiteaLabel

* fix endless loop because paggination is not supported there !!!

* rename gitea local uploader files

* pagination can bite you in the ass

* Version Checks

* lint

* docs

* rename gitea sdk import to miss future conficts

* go-swagger: dont scan the sdk structs

* make sure gitea can shutdown gracefully

* make GetPullRequests and GetIssues similar

* rm useles

* Add Test: started ...

* ... add tests ...

* Add tests and Fixing things

* Workaround missing SHA

* Adapt: Ensure that all migration requests are cancellable
(714ab71ddc)

* LINT: fix misspells in test set

* adapt ListMergeRequestAwardEmoji

* update sdk

* Return error when creating giteadownloader failed

* update sdk

* adapt new sdk

* adopt new features

* check version before err

* adapt: 'migrate service type switch page'

* optimize

* Fix DefaultBranch

* impruve

* handle subPath

* fix test

* Fix ReviewCommentPosition

* test GetReviews

* add DefaultBranch int test set

* rm unused

* Update SDK to v0.13.0

* addopt sdk changes

* found better link

* format template

* Update Docs

* Update Gitea SDK (v0.13.1)
4 years ago
kolaente 64133126cd
Update golangci-lint to version 1.31.0 (#13102)
This PR updates golangci-lint to the latest version 1.31.0.

The upgrade introduced a new check for which I've fixed or disabled most cases.

Signed-off-by: kolaente <k@knt.li>
4 years ago
zeripath 772b5e0f54
Add migration for password algorithm change (#12784)
* Add migration for password algorithm change

#12688 changed the default for the user table leading to sync2 warnings

Unfortunately changing defaults requires a complete table rewrite in general.

However, just dropping columns could be bad - so this PR leverages the
techniques used in recreate table to recreate from the inferred schema
and recreates the user table.

This is not necessarily the correct thing to do - but code sometimes speaks
louder than words.

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

* oops

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

* ok lets use the shorter bits for other dbs

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

* Update models/migrations/v150.go

* Update models/migrations/v150.go

* fix migration

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

* mv v150 to v151.go

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

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Lauris BH <lauris@nix.lv>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
4 years ago
techknowlogick bab1204db4
Use pre-built hugo binary in release step (#12725)
* Use pre-built hugo binary in release step

* decrease verbosity of tar
4 years ago
silverwind e1535c74cc
Add 'make watch' (#12636)
* Add 'make watch'

This combines frontend and backend watch into a single command that runs
them in parallel on on SIGINT terminates both.

Termination is not super-clean but I guess it does not have to.

* move to tools/, trap more signals, remove gnu-specific flag

* simplify

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
4 years ago
techknowlogick 482b0e6d47
Bump min required golang to 1.13 (#12717)
* Bump min required golang to 1.13

* Update config.yaml

* Update Makefile

* per silverwind feedback

* per silverwind

Co-authored-by: zeripath <art27@cantab.net>
4 years ago
6543 84eac6ed6c
Add make targed generate-license & generate-gitignore + Update (#12682)
* Add make targed generate-license & generate-gitignore

* Update Gitignores & Licenses

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
4 years ago
techknowlogick e90e122b39
update to latest golangci-lint (v1.30.0) (#12597) 4 years ago
techknowlogick 125ffb87f0
go1.15 on windows (#12589)
* go1.15 on windows

* update xgo to use node14
4 years ago
silverwind 51463a0a09
Fix 'make help' (#12509)
These targets are actually using plural names, fix help output for them.

Ref: https://github.com/go-gitea/gitea/pull/12352
4 years ago
silverwind d285b5d35a
Add 'checks' Make and CI tasks (#12352)
* Add 'checks' Make and CI tasks

Introduce new "checks" targets that perform tasks that we've been piling
onto the linting tasks. This will make the linter tasks faster and
hopefully encourage some users to use them locally.

* add checks to --help

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
4 years ago
6543 ee97e6a66a
Update gitea-vet to v0.2.1 (#12282)
* change to new code location

* vendor

* tagged version v0.2.0

* gitea-vet v0.2.1

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
4 years ago
techknowlogick b37c7dd384
Build windows using golang 1.14 (#12489) 4 years ago
techknowlogick bd7d6a3d73
go1.15 (#12475)
* go1.15

* update makefile xgo version

* fix vet issue

* update docs to version of go in use

* add TODO for asyncpreemptoff

Co-authored-by: Lauris BH <lauris@nix.lv>
4 years ago
silverwind 2fd78c151e
Move jquery-minicolors to npm/webpack (#12305)
* Move jquery-minicolors to npm/webpack

- Unvendor and add as npm dependency
- Removed unneeded backend variable
- Fixed existing bug where picker would previously initizalize to the
  same green color when editing a label.

There was probably a version bump because the previous version was
over 3 years old but it seems to be compatible.

* use file-loader

* trailing comma and comment update

* misc tweaks

Co-authored-by: Lauris BH <lauris@nix.lv>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
4 years ago
silverwind 78cbd0ca72
Update JS deps and linting config (#12295)
- update js deps to latest versions
- remove eslint-plugin-sonarjs to prevent a warning on install. can be
  added again once it's updated to support eslint 7.x
- enable new linting rules from eslint-plugin-unicorn

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
4 years ago
silverwind 8d6fa00da0
Detect version of sed in Makefile (#12319)
* 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>
4 years ago
silverwind e67c042511
Add 'watch-backend' (#12330)
* 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>
4 years ago
silverwind 7cf23399a0
Rework 'make generate-images' (#12316)
* 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
4 years ago
silverwind a3afb88f1b
Remove unused svg and improve 'make svg-check' (#12311)
- Remove unused source SVG gitea-settings (it was changed to ociticon)
- Improve 'make svg-check' to also detect added files
4 years ago
techknowlogick 366ca88eea
merge docker makefile into main one (#12289)
* 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>
4 years ago
techknowlogick 6ea2701cd9
Release docs as archive (#12253)
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>
4 years ago
Antoine GIRARD b92a5d8d64
release docs as an archive (#12243)
* release docs along sources

* use a custom offline version

Co-authored-by: Gitea <gitea@fake.local>
4 years ago
silverwind 8188176b58
Direct SVG rendering (#12157)
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
4 years ago