0
0
mirror of https://github.com/go-gitea/gitea.git synced 2025-11-05 10:25:30 +01:00
This commit is contained in:
wxiaoguang 2025-10-30 02:36:41 +08:00
parent 19abd3f3dc
commit ab56250b9f
2 changed files with 75 additions and 51 deletions

View File

@ -11,55 +11,79 @@ jobs:
files-changed: files-changed:
uses: ./.github/workflows/files-changed.yml uses: ./.github/workflows/files-changed.yml
test-pgsql: test-mssql1:
if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.actions == 'true' if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.actions == 'true'
needs: files-changed needs: files-changed
runs-on: ubuntu-latest runs-on: ubuntu-latest
services: services:
pgsql: mssql:
image: postgres:14 image: mcr.microsoft.com/mssql/server:2019-latest
env: env:
POSTGRES_DB: test ACCEPT_EULA: Y
POSTGRES_PASSWORD: postgres MSSQL_PID: Standard
ports: SA_PASSWORD: MwantsaSecurePassword1
- "5432:5432" ports:
ldap: - "1433:1433"
image: gitea/test-openldap:latest devstoreaccount1.azurite.local: # https://github.com/Azure/Azurite/issues/1583
ports: image: mcr.microsoft.com/azure-storage/azurite:latest
- "389:389" ports:
- "636:636" - 10000:10000
minio: steps:
# as github actions doesn't support "entrypoint", we need to use a non-official image - uses: actions/checkout@v5
# that has a custom entrypoint set to "minio server /data" - uses: actions/setup-go@v6
image: bitnamilegacy/minio:2023.8.31 with:
env: go-version-file: go.mod
MINIO_ROOT_USER: 123456 check-latest: true
MINIO_ROOT_PASSWORD: 12345678 - name: Add hosts to /etc/hosts
ports: run: '[ -e "/.dockerenv" ] || [ -e "/run/.containerenv" ] || echo "127.0.0.1 mssql devstoreaccount1.azurite.local" | sudo tee -a /etc/hosts'
- "9000:9000" - run: make deps-backend
steps: - run: make backend
- uses: actions/checkout@v5 env:
- uses: actions/setup-go@v6 TAGS: bindata
with: - name: run tests
go-version-file: go.mod run: make test-mssql
check-latest: true timeout-minutes: 50
- name: Add hosts to /etc/hosts env:
run: '[ -e "/.dockerenv" ] || [ -e "/run/.containerenv" ] || echo "127.0.0.1 pgsql ldap minio" | sudo tee -a /etc/hosts' TAGS: bindata
- run: make deps-backend USE_REPO_TEST_DIR: 1
- run: make backend
env: test-mssql2:
TAGS: bindata if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.actions == 'true'
- name: run tests needs: files-changed
run: make test-pgsql runs-on: ubuntu-latest
timeout-minutes: 50 services:
env: mssql:
TAGS: bindata gogit image: mcr.microsoft.com/mssql/server:2019-latest
RACE_ENABLED: true env:
TEST_TAGS: gogit ACCEPT_EULA: Y
TEST_LDAP: 1 MSSQL_PID: Standard
USE_REPO_TEST_DIR: 1 SA_PASSWORD: MwantsaSecurePassword1
ports:
test-mssql: - "1433:1433"
devstoreaccount1.azurite.local: # https://github.com/Azure/Azurite/issues/1583
image: mcr.microsoft.com/azure-storage/azurite:latest
ports:
- 10000:10000
steps:
- uses: actions/checkout@v5
- uses: actions/setup-go@v6
with:
go-version-file: go.mod
check-latest: true
- name: Add hosts to /etc/hosts
run: '[ -e "/.dockerenv" ] || [ -e "/run/.containerenv" ] || echo "127.0.0.1 mssql devstoreaccount1.azurite.local" | sudo tee -a /etc/hosts'
- run: make deps-backend
- run: make backend
env:
TAGS: bindata
- name: run tests
run: make test-mssql
timeout-minutes: 50
env:
TAGS: bindata
USE_REPO_TEST_DIR: 1
test-mssql3:
if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.actions == 'true' if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.actions == 'true'
needs: files-changed needs: files-changed
runs-on: ubuntu-latest runs-on: ubuntu-latest

View File

@ -36,7 +36,7 @@ func (repo *Repository) ResolveReference(name string) (string, error) {
// GetRefCommitID returns the last commit ID string of given reference (branch or tag). // GetRefCommitID returns the last commit ID string of given reference (branch or tag).
func (repo *Repository) GetRefCommitID(name string) (string, error) { func (repo *Repository) GetRefCommitID(name string) (string, error) {
batch, cancel, err := repo.CatFileBatch(repo.Ctx, true) batch, cancel, err := repo.CatFileBatch(repo.Ctx, false) // final test
if err != nil { if err != nil {
return "", err return "", err
} }
@ -151,7 +151,7 @@ func (repo *Repository) ConvertToGitID(commitID string) (ObjectID, error) {
} }
} }
batch, cancel, err := repo.CatFileBatch(repo.Ctx, true) batch, cancel, err := repo.CatFileBatch(repo.Ctx, false) // final test
if err != nil { if err != nil {
return nil, err return nil, err
} }