mirror of
https://github.com/go-gitea/gitea.git
synced 2026-08-02 02:46:44 +02:00
ci: rename test-unit-bindata, simplify and address review comments
Rename: - test-unit-bindata -> test-unit-nogogit. Both jobs run with the bindata tag; the meaningful difference is the gogit codepath, and the codebase already uses the nogogit/gogit suffix on its build-tagged source files. test-unit-gogit cleanup: - The gogit-affected package set (modules/git/gitrepo/lfs and direct importers) doesn't touch elasticsearch/meilisearch/redis/minio/ azurite, so drop those services and the matching /etc/hosts step. Shard runner robustness (Copilot review feedback): - Validate TEST_SHARD/TEST_TOTAL_SHARDS are positive ints with shard in [1, total]; exit 2 on bad input. - Tighten the test-name grep to require `*testing.T` or `*testing.TB` arg, dropping the TestMain false-positive. - Force LC_ALL=C sort so the partition is deterministic regardless of the runner's locale. - Empty assignment now exits 1 instead of silently passing. find-gogit-test-pkgs.sh: - Mirror the Makefile's GO_TEST_PACKAGES exclusions (drop models/migrations/..., tests/integration, tests/integration/migration-test). - Tighten the comment header — the script returns packages WITH TESTS, not all callers. - Drop dead alternatives from the import-match regex. Makefile test-backend-gogit: - Fail when the script fails or returns no packages instead of silently running `go test` with no args. Co-Authored-By: Claude (Opus 4.7) <noreply@anthropic.com>
This commit is contained in:
@@ -127,7 +127,7 @@ jobs:
|
||||
steps:
|
||||
- run: '[ "${{ needs.test-sqlite-shards.result }}" = "success" ]'
|
||||
|
||||
test-unit-bindata:
|
||||
test-unit-nogogit:
|
||||
if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.actions == 'true'
|
||||
needs: files-changed
|
||||
runs-on: ubuntu-latest
|
||||
@@ -193,40 +193,9 @@ jobs:
|
||||
if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.actions == 'true'
|
||||
needs: files-changed
|
||||
runs-on: ubuntu-latest
|
||||
services:
|
||||
elasticsearch:
|
||||
image: docker.elastic.co/elasticsearch/elasticsearch:8.19.15
|
||||
env:
|
||||
discovery.type: single-node
|
||||
xpack.security.enabled: false
|
||||
ports:
|
||||
- "9200:9200"
|
||||
meilisearch:
|
||||
image: getmeili/meilisearch:v1
|
||||
env:
|
||||
MEILI_ENV: development # disable auth
|
||||
ports:
|
||||
- "7700:7700"
|
||||
redis:
|
||||
image: redis
|
||||
options: >- # wait until redis has started
|
||||
--health-cmd "redis-cli ping"
|
||||
--health-interval 5s
|
||||
--health-timeout 3s
|
||||
--health-retries 10
|
||||
ports:
|
||||
- 6379:6379
|
||||
minio:
|
||||
image: bitnamilegacy/minio:2021.12.29
|
||||
env:
|
||||
MINIO_ACCESS_KEY: 123456
|
||||
MINIO_SECRET_KEY: 12345678
|
||||
ports:
|
||||
- "9000:9000"
|
||||
devstoreaccount1.azurite.local: # https://github.com/Azure/Azurite/issues/1583
|
||||
image: mcr.microsoft.com/azure-storage/azurite:latest
|
||||
ports:
|
||||
- 10000:10000
|
||||
# the gogit-affected package set (modules/git, modules/gitrepo, modules/lfs and
|
||||
# their direct importers) doesn't touch elasticsearch/meilisearch/redis/minio/
|
||||
# azurite — no services needed.
|
||||
steps:
|
||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
- uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
|
||||
@@ -238,8 +207,6 @@ jobs:
|
||||
with:
|
||||
cache-name: unit-gogit
|
||||
build-cache-rotate: "true"
|
||||
- name: Add hosts to /etc/hosts
|
||||
run: '[ -e "/.dockerenv" ] || [ -e "/run/.containerenv" ] || echo "127.0.0.1 minio devstoreaccount1.azurite.local mysql elasticsearch meilisearch smtpimap" | sudo tee -a /etc/hosts'
|
||||
- run: make deps-backend
|
||||
- run: make backend
|
||||
env:
|
||||
@@ -254,11 +221,11 @@ jobs:
|
||||
GITHUB_READ_TOKEN: ${{ secrets.GITHUB_READ_TOKEN }}
|
||||
|
||||
test-unit:
|
||||
needs: [files-changed, test-unit-bindata, test-unit-gogit]
|
||||
needs: [files-changed, test-unit-nogogit, test-unit-gogit]
|
||||
if: always() && (needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.actions == 'true')
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- run: '[ "${{ needs.test-unit-bindata.result }}" = "success" ] && [ "${{ needs.test-unit-gogit.result }}" = "success" ]'
|
||||
- run: '[ "${{ needs.test-unit-nogogit.result }}" = "success" ] && [ "${{ needs.test-unit-gogit.result }}" = "success" ]'
|
||||
|
||||
test-mysql-shards:
|
||||
if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.actions == 'true'
|
||||
|
||||
Reference in New Issue
Block a user