diff --git a/.github/workflows/pull-db-tests.yml b/.github/workflows/pull-db-tests.yml index f21cdf8135..9c78245ef6 100644 --- a/.github/workflows/pull-db-tests.yml +++ b/.github/workflows/pull-db-tests.yml @@ -21,7 +21,7 @@ jobs: strategy: fail-fast: false matrix: - shard: [1, 2] + shard: [1, 2, 3] services: pgsql: image: postgres:14 @@ -72,7 +72,7 @@ jobs: TAGS: bindata gogit TEST_LDAP: 1 TEST_SHARD: ${{ matrix.shard }} - TEST_TOTAL_SHARDS: 2 + TEST_TOTAL_SHARDS: 3 test-pgsql: needs: [files-changed, test-pgsql-shards] @@ -88,7 +88,7 @@ jobs: strategy: fail-fast: false matrix: - shard: [1, 2] + shard: [1, 2, 3] steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0 @@ -118,7 +118,7 @@ jobs: TAGS: bindata gogit GOEXPERIMENT: TEST_SHARD: ${{ matrix.shard }} - TEST_TOTAL_SHARDS: 2 + TEST_TOTAL_SHARDS: 3 test-sqlite: needs: [files-changed, test-sqlite-shards] @@ -127,7 +127,7 @@ jobs: steps: - run: '[ "${{ needs.test-sqlite-shards.result }}" = "success" ]' - test-unit: + test-unit-bindata: if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.actions == 'true' needs: files-changed runs-on: ubuntu-latest @@ -188,6 +188,63 @@ jobs: GOTEST_FLAGS: -race -timeout=20m TAGS: bindata GITHUB_READ_TOKEN: ${{ secrets.GITHUB_READ_TOKEN }} + + test-unit-gogit: + 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 + steps: + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + - uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0 + with: + go-version-file: go.mod + check-latest: true + cache: false + - uses: ./.github/actions/go-cache + 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: + TAGS: bindata gogit + GOEXPERIMENT: - name: unit-tests-gogit run: make test-backend-gogit test-check env: @@ -196,6 +253,13 @@ jobs: GOEXPERIMENT: GITHUB_READ_TOKEN: ${{ secrets.GITHUB_READ_TOKEN }} + test-unit: + needs: [files-changed, test-unit-bindata, 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" ]' + test-mysql-shards: if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.actions == 'true' needs: files-changed @@ -203,7 +267,7 @@ jobs: strategy: fail-fast: false matrix: - shard: [1, 2] + shard: [1, 2, 3] services: mysql: # the bitnami mysql image has more options than the official one, it's easier to customize @@ -254,7 +318,7 @@ jobs: TAGS: bindata TEST_INDEXER_CODE_ES_URL: "http://elastic:changeme@elasticsearch:9200" TEST_SHARD: ${{ matrix.shard }} - TEST_TOTAL_SHARDS: 2 + TEST_TOTAL_SHARDS: 3 test-mysql: needs: [files-changed, test-mysql-shards] @@ -270,7 +334,7 @@ jobs: strategy: fail-fast: false matrix: - shard: [1, 2] + shard: [1, 2, 3] services: mssql: image: mcr.microsoft.com/mssql/server:2019-latest @@ -308,7 +372,7 @@ jobs: env: TAGS: bindata TEST_SHARD: ${{ matrix.shard }} - TEST_TOTAL_SHARDS: 2 + TEST_TOTAL_SHARDS: 3 test-mssql: needs: [files-changed, test-mssql-shards]