forgefriends development maintenance guide
The upstream branch is updated from the Gitea main branch. Feature branches must be be rebased, base branches are reset to upstream and the feature branches it contains are merged into it. The order of the following list matters.
- upstream → pulled from Gitea main
- feature-gitlab-ci → rebase onto upstream
- feature-licensing → rebase onto upstream
- feature-development-environment → rebase onto upstream
- base-development → reset to upstream
- merge feature-licensing
- merge feature-gitlab-ci
- merge feature-development-environment
- feature-f3 → rebase onto base-development
- base-f3 → reset to upstream
- merge feature-f3
- feature-projectbase → rebase onto base-f3
- base-activitypub → reset to upstream
- merge Ta180m PRs that are mature Enough and follow the latest evolution from the main branch
- merge base-development
- main → reset to upstream
- merge base-activitypub
- merge feature-projectbase
Publishing a forgefriends release
- Add a tag to the forgefriends repository
- It will build and upload the docker image to hub.docker.com
- Verify the forgefriends installation instructions are working
The credentials to the docker hub are set in the CI/CD part of the project so they can be available from environment variables in the gitlab-ci.yml
jobs.
Gitea documentation
Local development tree checkout
In the following the remotes are setup as follows:
$ git remote -v
gitea https://github.com/go-gitea/gitea (fetch)
gitea https://github.com/go-gitea/gitea (push)
loic ssh://git@lab.forgefriends.org:2222/dachary/forgefriends.git (fetch)
loic ssh://git@lab.forgefriends.org:2222/dachary/forgefriends.git (push)
origin https://lab.forgefriends.org/forgefriends/forgefriends.git (fetch)
origin https://lab.forgefriends.org/forgefriends/forgefriends.git (push)
Show forgefriends commits only (ignore commits originating from Gitea)
git log --oneline --no-merges gitea/main..origin/main
Running tests
- All tests
time drone exec --pipeline testing-amd64 .gitlab-ci-drone.yml
firefox coverage.html - Only integration tests
docker run --rm -ti -e TEST_TAGS='bindata sqlite sqlite_unlock_notify' -e GOPATH=/tmp/cache/go-path -e GOCACHE=/tmp/cache/go-build --volume=$(pwd)/..:/tmp/cache --volume $(pwd):/drone/src --workdir /drone/src --user gitea gitea/test_env:linux-amd64 bash -c 'make integrations.sqlite.test generate-ini-sqlite && GITEA_CONF=integrations/sqlite.ini ./integrations.sqlite.test'
- Only unit tests with SQL statements displayed
docker run --rm -ti -e GOPATH=/tmp/cache/go-path -e GOCACHE=/tmp/cache/go-build --volume=$(pwd)/..:/tmp/cache -e GITEA_UNIT_TESTS_LOG_SQL=1 -e TAGS="bindata sqlite sqlite_unlock_notify" --user gitea -v $(pwd):/drone/src --workdir=/drone/src gitea/test_env:linux-amd64 make unit-test-coverage
- Only unit tests with coverage
docker run --rm -ti -e GOPATH=/tmp/cache/go-path -e GOCACHE=/tmp/cache/go-build --volume=$(pwd)/..:/tmp/cache -e TAGS="bindata sqlite sqlite_unlock_notify" --user gitea -v $(pwd):/drone/src --workdir=/drone/src gitea/test_env:linux-amd64 make unit-test-coverage
docker run --rm -e GOPATH=/tmp/cache/go-path -e GOCACHE=/tmp/cache/go-build --volume=$(pwd)/..:/tmp/cache --volume $(pwd):/drone/src --workdir /drone/src --user gitea gitea/test_env:linux-amd64 go tool cover -html=coverage.out -o coverage.html
firefox coverage.html
- A specific test only
docker run --rm -ti -e GOPATH=/tmp/cache/go-path -e GOCACHE=/tmp/cache/go-build --volume=$(pwd)/..:/tmp/cache -e TAGS="bindata sqlite sqlite_unlock_notify" --user gitea -v $(pwd):/drone/src --workdir=/drone/src gitea/test_env:linux-amd64 make GOTESTFLAGS='-run "^TestGetFeeds1"'' GO_PACKAGES=code.gitea.io/gitea/models unit-test-coverage
- A specific unit test in verbose mode
docker run -ti --rm -e GOTESTFLAGS='-v -run "^TestGetFeeds1"'' -e GO_PACKAGES=code.gitea.io/gitea/modules/foobar -e GOPATH=/tmp/cache/go-path -e GOCACHE=/tmp/cache/go-build --volume=$(pwd)/..:/tmp/cache --volume $(pwd):/drone/src --workdir /drone/src --user gitea gitea/test_env:linux-amd64 make unit-test-coverage
- A specific integration test in verbose mode to see log.Error, fmt.Printnl…
docker run --rm -ti -e TEST_TAGS='bindata sqlite sqlite_unlock_notify' -e GOPATH=/tmp/cache/go-path -e GOCACHE=/tmp/cache/go-build --volume=$(pwd)/..:/tmp/cache --volume $(pwd):/drone/src --workdir /drone/src --user gitea gitea/test_env:linux-amd64 bash -c 'make integrations.sqlite.test generate-ini-sqlite && GITEA_CONF=integrations/sqlite.ini ./integrations.sqlite.test -test.v -test.run TestActivityPubPerson'
- A specific unit test without caching (note the -count=1, that’s what disables caching)
docker run -ti --rm -e GOPATH=/tmp/cache/go-path -e GOCACHE=/tmp/cache/go-build --volume=$(pwd)/..:/tmp/cache --volume $(pwd):/drone/src --workdir /drone/src --user gitea gitea/test_env:linux-amd64 env GOTESTFLAGS=-count=1 GITEA_UNIT_TESTS_VERBOSE=true GO_PACKAGES=code.gitea.io/gitea/models make 'test#TestRepository_HasWiki'
- Rebuild the bindata after migration/schemas is modified
docker run -ti --rm -e TAGS='bindata sqlite sqlite_unlock_notify' -e GOPATH=/tmp/cache/go-path -e GOCACHE=/tmp/cache/go-build --volume=$(pwd)/..:/tmp/cache --volume $(pwd):/drone/src --workdir /drone/src --user gitea gitea/test_env:linux-amd64 make backend
Getting code from a given PR
Creating a branch
PR=16834 ; git fetch gitea pull/$PR/head:pr-$PR
Creating a diff with the content of the PR
PR=16834 ; git diff gitea/main…pr-$PR > /tmp/$PR.patch
GitLab runner pitfalls
Because of this bug it is not possible to cancel a running job and expect it to be terminated. It will run to the end.