Skip to content

Commit

Permalink
Improve document for developers: Windows CGO, unit test option (go-gi…
Browse files Browse the repository at this point in the history
  • Loading branch information
wxiaoguang authored and Stelios Malathouras committed Mar 28, 2022
1 parent bd8f8b8 commit d9bf574
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions docs/content/doc/developers/hacking-on-gitea.en-us.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ One of these three distributions of Make will run on Windows:
- MSYS2 is a collection of tools and libraries providing you with an easy-to-use environment for building, installing and running native Windows software, it includes MinGW-w64.
- In MingGW-w64, the binary is called `mingw32-make.exe` instead of `make.exe`. Add the `bin` folder to `PATH`.
- In MSYS2, you can use `make` directly. See [MSYS2 Porting](https://www.msys2.org/wiki/Porting/).
- To compile Gitea with CGO_ENABLED (eg: SQLite3), you might need to use [tdm-gcc](https://jmeubank.github.io/tdm-gcc/) instead of MSYS2 gcc, because MSYS2 gcc headers lack some Windows-only CRT functions like `_beginthread`.
- [Chocolatey package](https://chocolatey.org/packages/make). Run `choco install make`

**Note**: If you are attempting to build using make with Windows Command Prompt, you may run into issues. The above prompts (Git bash, or MinGW) are recommended, however if you only have command prompt (or potentially PowerShell) you can set environment variables using the [set](https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/set_1) command, e.g. `set TAGS=bindata`.
Expand Down Expand Up @@ -273,10 +274,17 @@ make test-sqlite-migration # with SQLite switched for the appropriate database

There are two types of test run by Gitea: Unit tests and Integration Tests.

### Unit Tests

Unit tests are covered by `*_test.go` in `go test` system.
You can set environment variable `GITEA_UNIT_TESTS_VERBOSE=1` to see detail logs during the test.

```bash
TAGS="bindata sqlite sqlite_unlock_notify" make test # Runs the unit tests
```

### Integration Tests

Unit tests will not and cannot completely test Gitea alone. Therefore, we
have written integration tests; however, these are database dependent.

Expand All @@ -288,10 +296,12 @@ will run the integration tests in an SQLite environment. Integration tests
require `git lfs` to be installed. Other database tests are available but
may need adjustment to the local environment.

Look at
[`integrations/README.md`](https://github.com/go-gitea/gitea/blob/main/integrations/README.md)
Take a look at [`integrations/README.md`](https://github.com/go-gitea/gitea/blob/main/integrations/README.md)
for more information and how to run a single test.


### Testing for a PR

Our continuous integration will test the code passes its unit tests and that
all supported databases will pass integration test in a Docker environment.
Migration from several recent versions of Gitea will also be tested.
Expand Down

0 comments on commit d9bf574

Please sign in to comment.