code.gitea.io/gitea@v1.22.3/.github/workflows/pull-db-tests.yml (about) 1 name: db-tests 2 3 on: 4 pull_request: 5 6 concurrency: 7 group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} 8 cancel-in-progress: true 9 10 jobs: 11 files-changed: 12 uses: ./.github/workflows/files-changed.yml 13 14 test-pgsql: 15 if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.actions == 'true' 16 needs: files-changed 17 runs-on: ubuntu-latest 18 services: 19 pgsql: 20 image: postgres:12 21 env: 22 POSTGRES_DB: test 23 POSTGRES_PASSWORD: postgres 24 ports: 25 - "5432:5432" 26 ldap: 27 image: gitea/test-openldap:latest 28 ports: 29 - "389:389" 30 - "636:636" 31 minio: 32 # as github actions doesn't support "entrypoint", we need to use a non-official image 33 # that has a custom entrypoint set to "minio server /data" 34 image: bitnami/minio:2023.8.31 35 env: 36 MINIO_ROOT_USER: 123456 37 MINIO_ROOT_PASSWORD: 12345678 38 ports: 39 - "9000:9000" 40 steps: 41 - uses: actions/checkout@v4 42 - uses: actions/setup-go@v5 43 with: 44 go-version-file: go.mod 45 check-latest: true 46 - name: Add hosts to /etc/hosts 47 run: '[ -e "/.dockerenv" ] || [ -e "/run/.containerenv" ] || echo "127.0.0.1 pgsql ldap minio" | sudo tee -a /etc/hosts' 48 - run: make deps-backend 49 - run: make backend 50 env: 51 TAGS: bindata 52 - name: run migration tests 53 run: make test-pgsql-migration 54 - name: run tests 55 run: make test-pgsql 56 timeout-minutes: 50 57 env: 58 TAGS: bindata gogit 59 RACE_ENABLED: true 60 TEST_TAGS: gogit 61 TEST_LDAP: 1 62 USE_REPO_TEST_DIR: 1 63 64 test-sqlite: 65 if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.actions == 'true' 66 needs: files-changed 67 runs-on: ubuntu-latest 68 steps: 69 - uses: actions/checkout@v4 70 - uses: actions/setup-go@v5 71 with: 72 go-version-file: go.mod 73 check-latest: true 74 - run: make deps-backend 75 - run: make backend 76 env: 77 TAGS: bindata gogit sqlite sqlite_unlock_notify 78 - name: run migration tests 79 run: make test-sqlite-migration 80 - name: run tests 81 run: make test-sqlite 82 timeout-minutes: 50 83 env: 84 TAGS: bindata gogit sqlite sqlite_unlock_notify 85 RACE_ENABLED: true 86 TEST_TAGS: gogit sqlite sqlite_unlock_notify 87 USE_REPO_TEST_DIR: 1 88 89 test-unit: 90 if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.actions == 'true' 91 needs: files-changed 92 runs-on: ubuntu-latest 93 services: 94 elasticsearch: 95 image: elasticsearch:7.5.0 96 env: 97 discovery.type: single-node 98 ports: 99 - "9200:9200" 100 meilisearch: 101 image: getmeili/meilisearch:v1.2.0 102 env: 103 MEILI_ENV: development # disable auth 104 ports: 105 - "7700:7700" 106 redis: 107 image: redis 108 options: >- # wait until redis has started 109 --health-cmd "redis-cli ping" 110 --health-interval 5s 111 --health-timeout 3s 112 --health-retries 10 113 ports: 114 - 6379:6379 115 minio: 116 image: bitnami/minio:2021.3.17 117 env: 118 MINIO_ACCESS_KEY: 123456 119 MINIO_SECRET_KEY: 12345678 120 ports: 121 - "9000:9000" 122 steps: 123 - uses: actions/checkout@v4 124 - uses: actions/setup-go@v5 125 with: 126 go-version-file: go.mod 127 check-latest: true 128 - name: Add hosts to /etc/hosts 129 run: '[ -e "/.dockerenv" ] || [ -e "/run/.containerenv" ] || echo "127.0.0.1 mysql elasticsearch meilisearch smtpimap" | sudo tee -a /etc/hosts' 130 - run: make deps-backend 131 - run: make backend 132 env: 133 TAGS: bindata 134 - name: unit-tests 135 run: make unit-test-coverage test-check 136 env: 137 TAGS: bindata 138 RACE_ENABLED: true 139 GITHUB_READ_TOKEN: ${{ secrets.GITHUB_READ_TOKEN }} 140 - name: unit-tests-gogit 141 run: make unit-test-coverage test-check 142 env: 143 TAGS: bindata gogit 144 RACE_ENABLED: true 145 GITHUB_READ_TOKEN: ${{ secrets.GITHUB_READ_TOKEN }} 146 147 test-mysql: 148 if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.actions == 'true' 149 needs: files-changed 150 runs-on: ubuntu-latest 151 services: 152 mysql: 153 image: mysql:8.0 154 env: 155 MYSQL_ALLOW_EMPTY_PASSWORD: true 156 MYSQL_DATABASE: testgitea 157 ports: 158 - "3306:3306" 159 elasticsearch: 160 image: elasticsearch:7.5.0 161 env: 162 discovery.type: single-node 163 ports: 164 - "9200:9200" 165 smtpimap: 166 image: tabascoterrier/docker-imap-devel:latest 167 ports: 168 - "25:25" 169 - "143:143" 170 - "587:587" 171 - "993:993" 172 steps: 173 - uses: actions/checkout@v4 174 - uses: actions/setup-go@v5 175 with: 176 go-version-file: go.mod 177 check-latest: true 178 - name: Add hosts to /etc/hosts 179 run: '[ -e "/.dockerenv" ] || [ -e "/run/.containerenv" ] || echo "127.0.0.1 mysql elasticsearch smtpimap" | sudo tee -a /etc/hosts' 180 - run: make deps-backend 181 - run: make backend 182 env: 183 TAGS: bindata 184 - name: run migration tests 185 run: make test-mysql-migration 186 - name: run tests 187 run: make integration-test-coverage 188 env: 189 TAGS: bindata 190 RACE_ENABLED: true 191 USE_REPO_TEST_DIR: 1 192 TEST_INDEXER_CODE_ES_URL: "http://elastic:changeme@elasticsearch:9200" 193 194 test-mssql: 195 if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.actions == 'true' 196 needs: files-changed 197 # specifying the version of ubuntu in use as mssql fails on newer kernels 198 # pending resolution from vendor 199 runs-on: ubuntu-20.04 200 services: 201 mssql: 202 image: mcr.microsoft.com/mssql/server:2017-latest 203 env: 204 ACCEPT_EULA: Y 205 MSSQL_PID: Standard 206 SA_PASSWORD: MwantsaSecurePassword1 207 ports: 208 - "1433:1433" 209 steps: 210 - uses: actions/checkout@v4 211 - uses: actions/setup-go@v5 212 with: 213 go-version-file: go.mod 214 check-latest: true 215 - name: Add hosts to /etc/hosts 216 run: '[ -e "/.dockerenv" ] || [ -e "/run/.containerenv" ] || echo "127.0.0.1 mssql" | sudo tee -a /etc/hosts' 217 - run: make deps-backend 218 - run: make backend 219 env: 220 TAGS: bindata 221 - run: make test-mssql-migration 222 - name: run tests 223 run: make test-mssql 224 timeout-minutes: 50 225 env: 226 TAGS: bindata 227 USE_REPO_TEST_DIR: 1