1
1
mirror of https://github.com/go-gitea/gitea synced 2025-09-18 14:48:13 +00:00

516 Commits

Author SHA1 Message Date
silverwind
69e595cdd8 Update eslint to v9 (#35485)
Update eslint and all plugins. Many plugins still do not ship type
definitions so I had to add stubs. Also, I had to put a few typescript
error expectations because if some unknown error in the types.

`eslint-plugin-no-jquery` is disabled because it's not compatible with
eslint 9 flat config
(https://github.com/wikimedia/eslint-plugin-no-jquery/issues/311).
2025-09-14 19:15:06 +03:00
silverwind
e612b9744c Revert the rspack change (#35482)
Partially revert https://github.com/go-gitea/gitea/pull/35460 until
rspack supports RISC-V
(https://github.com/web-infra-dev/rspack/issues/11656).
2025-09-14 08:37:07 +02:00
silverwind
866c636f52 Replace webpack with rspack (#35460)
Given that this bundler is almost a drop-in replacement to webpack, it
might be worth switching. So far it seems everything is working, but
more testing is needed, so I'm setting draft.

- Dev build time is reduced from 10s to 5s
- Prod build time is reduced from 16s to 10s
- JS output size is reduced from 21.3MB to 19.8MB
- CSS output size is increased from 778kB to 818kB
2025-09-12 19:25:59 +00:00
silverwind
bde1f82850 Update gofumpt, add go.mod ignore directive (#35434)
gofumpt now
[supports](https://github.com/mvdan/gofumpt/releases/tag/v0.9.0) the
[ignore](https://tip.golang.org/ref/mod#go-mod-file-ignore) directive
added in go 1.25, make use of it which speeds up `make fmt` by around
30%. Likely this also has similar speed gains in other go-related
commands which use the `./...` pattern.

The change in `build/code-batch-process.go` was introduced by `gofumpt`
because of this change:

> A new rule is introduced to "clothe" naked returns for the sake of
clarity. While there is nothing wrong with naming results in function
signatures, using lone return statements can be confusing to the reader.
2025-09-08 13:40:08 +02:00
silverwind
38ad58575a Support Node.js 22.6 with type stripping (#35427)
This solves the [docker build
failure](https://github.com/go-gitea/gitea/actions/runs/17514788636/job/49750917680)
on `linux/riscv64` by enabling the experimental flag on Node.js before
22.18.
2025-09-07 08:02:06 +00:00
Lunny Xiao
c290682521 Upgrade golang to 1.25.1 and add descriptions for the swagger structs' fields (#35418) 2025-09-06 16:52:41 +00:00
silverwind
b8f1c9f048 Migrate tools and configs to typescript, require node.js >= 22.18.0 (#35421)
Migrate all JS config and tools to TS and fix a number of type issues.
This required Node.js 22.18.0 or greater where [type-stripping was
enabled](https://nodejs.org/en/blog/release/v22.18.0) by default.

Given that Node 22 is the current LTS, I think it's ok to assume that
the user has a recent version of it.

Webpack currently requires the `--disable-interpret` flag to work,
should be fixed eventually with
https://github.com/webpack/webpack-cli/issues/4525.
`fast-glob` is replaced by `fs.globSync`, available in Node 22.0.0 or
greater.
2025-09-06 12:58:25 +00:00
silverwind
89b4be057b Switch to @resvg/resvg-wasm for generate-images (#35415)
Use the WASM module of [`resvg-js`](https://github.com/thx/resvg-js) to
replace `fabric` and the problematic native `canvas` dependency. WASM
works cross-platform so we can include it in the main `package.json`.
2025-09-05 21:06:02 +00:00
techknowlogick
361e59fd53 Switch to pnpm (#35274)
Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: silverwind <me@silverwind.io>
2025-09-04 01:17:14 +00:00
Lunny Xiao
e96ef97989 Upgrade dependencies (#35384)
- ~Upgrade golang to 1.25~ blocked by the issue
https://github.com/go-swagger/go-swagger/issues/3220
- Upgrade minor versions of most dependencies
- Upgrade github.com/google/go-github version to v74
- Fix meilisearch because of sdk interface change
- Use github.com/Necoro/html2text which is a fork instead of html2text
because of https://github.com/jaytaylor/html2text/issues/67 which
resulted in complie failure.
- Fix some deprecated methods of gitlab go client.
2025-09-02 23:13:38 -04:00
silverwind
9790f128cc Update to golangci-lint@v2.4.0 (#35310)
Adds go 1.25 support. No new issues discovered.

https://github.com/golangci/golangci-lint/releases
2025-08-19 17:23:47 +00:00
techknowlogick
1740d36581 go1.25.0 (#35262) 2025-08-15 18:13:24 +08:00
6543
28a7cc4621 Nix flake build static with sqlite support (#35149)
with `nix develop -c $SHELL` you can enter the dev environment.
now with `make clean-all generate build -j1` you will get a static
linked binary that has sqlite support
2025-08-07 04:22:08 +08:00
silverwind
2e8a4a09d5 Update gopls to 0.20.0 (#35180)
Ran `make lint-go-gopls fix` and it did not find any new issues or
introduce any changes.

Release notes: https://go.dev/gopls/release/v0.20.0
2025-07-30 18:31:33 +02:00
silverwind
639ac0026c Run uv run with --frozen (#35097) 2025-07-16 16:53:35 +00:00
silverwind
7413e8583d Replace poetry with uv (#35084) 2025-07-15 21:19:39 +00:00
silverwind
35a8e6f8e9 Update go tool dependencies (#34845)
Tested a few things, everything seems to work.

`editorconfig-checker` is now pinned at v3 to avoid having to maintain
its minor releases.
2025-06-25 09:48:24 +00:00
silverwind
63fb25382b Remove unused variable HUGO_VERSION (#34840)
This variable is unused, occurs nowhere in the codebase. I can't
pinpoint the exact commit when it was last used, but I think it's unused
since the docs were moved out.
2025-06-24 16:54:35 +00:00
silverwind
b18c047d62 Upgrade gopls to v0.19.0, add make fix (#34772)
Upgrade to
[v0.19.0](https://github.com/golang/tools/releases/tag/gopls%2Fv0.19.0)
and fix issues. Runs with new `warning` serverity setting. This likely
does less checks than before. Additionally, add `make fix` which runs
modernize. This is also verified on CI.

For the record, here are the issues discoverd when running with `info`
severity, in case we want to fix these:

```
tests/integration/repo_test.go:95:5-14: could use tagged switch on i
tests/integration/api_packages_generic_test.go:149:4-64: could use tagged switch on setting.Packages.Storage.Type
services/webhook/msteams_test.go:33:4-33: could use tagged switch on fact.Name
services/webhook/msteams_test.go:59:4-33: could use tagged switch on fact.Name
services/webhook/msteams_test.go:85:4-33: could use tagged switch on fact.Name
services/webhook/msteams_test.go:111:4-33: could use tagged switch on fact.Name
services/webhook/msteams_test.go:138:4-33: could use tagged switch on fact.Name
services/webhook/msteams_test.go:161:4-33: could use tagged switch on fact.Name
services/webhook/msteams_test.go:187:4-33: could use tagged switch on fact.Name
services/webhook/msteams_test.go:213:4-33: could use tagged switch on fact.Name
services/webhook/msteams_test.go:239:4-33: could use tagged switch on fact.Name
services/webhook/msteams_test.go:266:4-33: could use tagged switch on fact.Name
services/webhook/msteams_test.go:407:4-33: could use tagged switch on fact.Name
tests/integration/api_packages_conan_test.go:350:6-33: could use tagged switch on pf.Name
models/issues/tracked_time_test.go:98:3-18: could use tagged switch on user.ID
tests/integration/api_token_test.go:505:5-43: could use tagged switch on minRequiredLevel
services/gitdiff/gitdiff.go:220:33-46: method "getLineLegacy" is unused
```

---------

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2025-06-18 19:30:40 +00:00
wxiaoguang
24ce2058e8 Clean bindata (#34728)
Follow #34692
2025-06-16 12:03:51 +00:00
wxiaoguang
65986f423f Refactor embedded assets and drop unnecessary dependencies (#34692)
Benefits:

1. smaller binary size (reduces more than 1MB)
2. better control of the assets details
3. fewer unmaintained dependencies
4. faster startup if the assets are not needed
5. won't hang up editors when open "bindata.go" by accident
2025-06-12 03:59:33 +00:00
Meng Zhuo
921d3a394d feat: add riscv64 support (#34199) 2025-04-14 16:32:54 +00:00
TheFox0x7
5564c39105 update to golangci-lint v2 (#34054)
updates config to v2.
config was generated with migrate command.
disable all newly exposed issues because there are too many.
2025-03-29 22:01:06 +08:00
silverwind
2089401653 Enable color output in govulncheck (#34012)
Make `govulncheck` show color, which by default it doesn't for some
reason.
2025-03-25 18:24:48 +00:00
Rafael de Mattos
20c7392e99 Update Makefile test comments (#34013)
The comments are referring to the wrong project section (backend and
frontend).
2025-03-25 17:54:17 +00:00
silverwind
18bd70054b Update tool dependencies (#33907)
`gopls` is currently excluded because its [new
analyzers](https://github.com/golang/tools/releases/tag/gopls%2Fv0.18.0)
raise many issue, to be fixed before we can upgrade it. And I think the
modernize fixer still has a number of [unresolved/undiscovered
bugs](https://github.com/golang/go/issues/71847).
2025-03-16 18:34:24 +00:00
wxiaoguang
608ccc32e5 Drop fomantic build (#33845)
We would never update or build fomantic again, we have forked it as a
private library long time ago.

So just put the JS and CSS files in "fomantic/build" into git. And use
"import" to use them.

Remove "form.js", rewrite "tab" component.

All source code is from official Fomantic UI build. Will apply patches
in separate PRs.
2025-03-11 12:44:52 +08:00
wxiaoguang
7290bfaccb Only keep popular licenses (#33832)
Fix #33467
2025-03-10 06:40:37 +08:00
silverwind
95efc7b35b Disable vet=off again (#33794)
Ref: https://github.com/go-gitea/gitea/issues/33792

To avoid slowing unit-test down.
2025-03-05 17:15:31 +08:00
silverwind
43c8d85f19 Disable vet as part of go test (#33662)
`go vet` implicitely runs as part of `go test`, but we already have
`make lint-go-vet`, so we were essentially running it twice. This should
hopefully make `go test` slightly faster.

Ref: https://pkg.go.dev/cmd/go#hdr-Test_packages

> As part of building a test binary, go test runs go vet
2025-03-03 06:03:42 +00:00
Lunny Xiao
ae4a3d7708 upgrade go-crypto from 1.1.5 to 1.1.6 (#33745)
Fix #33296

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2025-02-28 14:06:47 +00:00
silverwind
6e475dc7e0 Disable go license generation as part of make tidy (#33747)
It seems something broken `google/go-licenses` (maybe related to go
1.24), and my findings are in
https://github.com/google/go-licenses/issues/128#issuecomment-2689753365.
I think it's best we disable this generation for now until a better
solution is found.

Also, enable showing stderr output so we can actually debug this thing.
For reference, these are the errors that currently apparently break the
tool:

```
E0228 05:15:27.005759   13158 library.go:117] Package text/tabwriter does not have module info. Non go modules projects are no longer supported. For feedback, refer to https://github.com/google/go-licenses/issues/128.
E0228 05:15:27.005776   13158 library.go:117] Package net/http/fcgi does not have module info. Non go modules projects are no longer supported. For feedback, refer to https://github.com/google/go-licenses/issues/128.
F0228 05:15:27.028122   13158 main.go:77] some errors occurred when loading direct and transitive dependency packages
```
2025-02-28 11:26:27 +00:00
wxiaoguang
4adb7cad8b Improve swagger generation (#33664)
Remove most "sed" tricks

---------

Co-authored-by: silverwind <me@silverwind.io>
2025-02-21 00:04:30 -08:00
wxiaoguang
3ee5ee2029 Upgrade golangci-lint to v1.64.5 (#33654)
Use `usetesting` instead of deprecated `tenv`.
1. Follow up #33648
2. Make lint pass and add some comments
2025-02-21 00:05:40 +08:00
wxiaoguang
e6759f356d Update Go dependencies (skip blevesearch, meilisearch) (#33655) 2025-02-20 22:10:54 +08:00
silverwind
f5a81f9636 Run spellcheck on tools directory (#33627)
Add `tools` files to spellcheck and fixed one issue.
2025-02-17 18:39:12 +01:00
techknowlogick
d88b012525 go1.24 (#33562)
update to use go1.24

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2025-02-13 18:00:00 +08:00
silverwind
3e39583bb5 Enable eslint for commonjs (#33575) 2025-02-12 22:47:54 +00:00
silverwind
b3302748fa Run yamllint with strict mode, fix issue (#33551)
Previously yamllint would issue warnings for certain things, while still
exiting with zero. Now warnings are treated like errors and will cause
non-zero exit:

```
  -s, --strict          return non-zero exit code on warnings as well as errors
```
2025-02-10 22:33:40 +00:00
hiifong
26b51aa032 Optimize makefile help information generation (#33390)
Get help information from the target's comments.

![image](https://github.com/user-attachments/assets/ee259545-99b7-4163-a8da-011159f8301b)
2025-01-27 01:44:09 +00:00
silverwind
078ef6db89 Update tool dependencies (#33392)
Update all tool dependencies to latest versions.
2025-01-25 20:14:09 +00:00
techknowlogick
232867cff6 use -s -w ldflags for release artifacts (#33041)
fix #33030
2024-12-30 02:37:59 +00:00
silverwind
626b27bea5 Update go tool dependencies (#32916)
Update all go tool dependencies to latest version. WIP because I think
there are new gopls errors, would like to confirm them on CI first. Here
is from a local run:

```
modules/markup/markdown/goldmark.go:115:37-53: unnecessary type arguments
modules/markup/html.go:45:32-49: unnecessary type arguments
modules/markup/internal/renderinternal.go:20:33-49: unnecessary type arguments
modules/markup/common/linkify.go:27:32-49: unnecessary type arguments
modules/util/time_str.go:28:39-63: unnecessary type arguments
routers/web/repo/pull.go:704:19: impossible condition: non-nil == nil
modules/util/util_test.go:248:14-23: unused parameter: other
```

~~Backport because the `gxz` update might have security benefits.~~
2024-12-19 19:17:55 +01:00
silverwind
c8ea41b049 Fix remaining typescript issues, enable tsc (#32840)
Fixes 79 typescript errors. Discovered at least two bugs in
`notifications.ts`, and I'm pretty sure this feature was at least
partially broken and may still be, I don't really know how to test it.

After this, only like ~10 typescript errors remain in the codebase but
those are harder to solve.

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2024-12-16 05:02:32 +08:00
silverwind
1cfb718976 Update golangci-lint to v1.62.2, fix issues (#32845)
Update it and fix new issues related to `redefines-builtin-id`
2024-12-15 02:31:07 +00:00
silverwind
fa175c1694 Add vue-tsc (#32601)
As per https://vuejs.org/guide/typescript/overview#overview,
typescript's `tsc` does not support importing `.vue` files from `.ts`
files, so we need to use `vue-tsc` which patches in that support. Added
a convenience alias `make tsc` to run it.
2024-11-23 23:02:37 +00:00
sommerf-lf
0b1b4030e6 add {{TEST_MINIO_ENDPOINT}} for local testing "with/without" docker + fix pgsql testing doc (#32105)
while testing i found out that testing locally as documented in the
changed README.md for pgsql isn't working because of the minio
dependency. reworked this to by default be still docker, but allow for
for local with only minio in docker and testing on bare metal.
also depending on this: fixed docs for running pgsql test

Closes: #32168 (by changing documentation for pgsql tests)
Closes: #32169 (by changing documentation, Makefile & pgsql.ini.tmpl:
adding {{TEST_MINIO_ENDPOINT}})

sry for the combined pr, but when testing I ran into this issue and
first thought they were related and now finally address the same
problem: not beeing able to run pgsql integration tests as described in
the according README.md
2024-10-03 01:00:56 +00:00
techknowlogick
d9a7748cdc bump to go 1.23 (#31855) 2024-09-10 02:23:07 +00:00
Jason Song
de2787a493 Add TAGS to TEST_TAGS and fix bugs found with gogit (#31791)
Found at
https://github.com/go-gitea/gitea/pull/31790#issuecomment-2272898915

`unit-tests-gogit` never work since the workflow set `TAGS` with
`gogit`, but the Makefile use `TEST_TAGS`.

This PR adds the values of `TAGS` to `TEST_TAGS`, ensuring that setting
`TAGS` is always acceptable and avoiding confusion about which one
should be set.
2024-08-07 11:29:08 -04:00
silverwind
5f526d7d3d Run go-install in deps-tools in parallel (#31711)
`go install` is far too conservative in regards to parallel HTTP
requests, so we can run the commands in parallel to achieve a speedup.
2024-07-28 17:27:24 +00:00