|
| 1 | +#@ load("@ytt:data", "data") |
| 2 | +#@ load("ytt-helpers.star", "helpers") |
| 3 | +name: unit-integration-tests |
| 4 | + |
| 5 | +on: |
| 6 | + pull_request: |
| 7 | + types: [opened, synchronize, reopened, labeled] |
| 8 | + branches: |
| 9 | + - develop |
| 10 | + paths: |
| 11 | + - 'src/**' |
| 12 | + - 'packages/**' |
| 13 | + - 'jobs/**' |
| 14 | + - 'config/**' |
| 15 | + - 'scripts/**' |
| 16 | + - '.github/workflows/**' |
| 17 | + - '.github/helpers/**' |
| 18 | + |
| 19 | +env: |
| 20 | + MAPPING: | |
| 21 | + build_nats_server=src/code.cloudfoundry.org/vendor/github.com/nats-io/nats-server/v2 |
| 22 | + FLAGS: | |
| 23 | + --keep-going |
| 24 | + --trace |
| 25 | + -r |
| 26 | + --fail-on-pending |
| 27 | + --randomize-all |
| 28 | + --nodes=7 |
| 29 | + --race |
| 30 | + --timeout 30m |
| 31 | + --flake-attempts 2 |
| 32 | + RUN_AS: root |
| 33 | + VERIFICATIONS: | |
| 34 | + verify_go repo/$DIR |
| 35 | + verify_gofmt repo/$DIR |
| 36 | + verify_govet repo/$DIR |
| 37 | + verify_staticcheck repo/$DIR |
| 38 | + FUNCTIONS: ci/diego-release/helpers/build-binaries.bash |
| 39 | + DB: "" |
| 40 | + |
| 41 | +jobs: |
| 42 | + repo-clone: |
| 43 | + runs-on: ubuntu-latest |
| 44 | + steps: |
| 45 | + - name: diego-release-repo |
| 46 | + uses: actions/checkout@v4.3.1 |
| 47 | + with: |
| 48 | + repository: ${{ github.event.pull_request.head.repo.full_name }} |
| 49 | + ref: ${{ github.event.pull_request.head.ref }} |
| 50 | + submodules: recursive |
| 51 | + path: repo |
| 52 | + - name: Check out wg-appruntime code |
| 53 | + uses: actions/checkout@v4.3.1 |
| 54 | + with: |
| 55 | + repository: cloudfoundry/wg-app-platform-runtime-ci |
| 56 | + path: ci |
| 57 | + - name: zip repo artifacts |
| 58 | + run: | |
| 59 | + tar -czf repo-artifact.tar.gz repo |
| 60 | + tar -czf ci-artifact.tar.gz ci |
| 61 | + - name: upload artifact |
| 62 | + uses: actions/upload-artifact@v4 |
| 63 | + with: |
| 64 | + name: repo |
| 65 | + path: | |
| 66 | + repo-artifact.tar.gz |
| 67 | + ci-artifact.tar.gz |
| 68 | + determine-image-tag: |
| 69 | + if: contains(github.event.pull_request.labels.*.name, 'ready-to-run') |
| 70 | + runs-on: ubuntu-latest |
| 71 | + outputs: |
| 72 | + go_version: ${{ steps.get-version.outputs.go_version }} |
| 73 | + steps: |
| 74 | + - name: checkout ci repo |
| 75 | + uses: actions/checkout@v4.3.1 |
| 76 | + with: |
| 77 | + repository: cloudfoundry/wg-app-platform-runtime-ci |
| 78 | + sparse-checkout: go-version.json |
| 79 | + sparse-checkout-cone-mode: false |
| 80 | + - name: get-version |
| 81 | + id: get-version |
| 82 | + run: | |
| 83 | + version=$(jq -r '.releases["diego"] // .default' go-version.json) |
| 84 | + echo "go_version=${version}" >> "$GITHUB_OUTPUT" |
| 85 | + template-tests: |
| 86 | + runs-on: ubuntu-latest |
| 87 | + needs: [repo-clone] |
| 88 | + container: cloudfoundry/tas-runtime-build:latest |
| 89 | + steps: |
| 90 | + - name: Download artifact |
| 91 | + uses: actions/download-artifact@v4 |
| 92 | + with: |
| 93 | + name: repo |
| 94 | + - run: | |
| 95 | + tar -xzvf repo-artifact.tar.gz |
| 96 | + tar -xzvf ci-artifact.tar.gz |
| 97 | + - name: template-tests |
| 98 | + run: | |
| 99 | + "${GITHUB_WORKSPACE}"/ci/shared/tasks/run-tests-templates/task.bash |
| 100 | + lint-repo: |
| 101 | + runs-on: ubuntu-latest |
| 102 | + needs: [repo-clone] |
| 103 | + container: cloudfoundry/tas-runtime-build:latest |
| 104 | + env: |
| 105 | + LINTERS: | |
| 106 | + sync-package-specs.bash |
| 107 | + sync-submodule-config.bash |
| 108 | + match-golang-os-package-versions.bash |
| 109 | + check-envoy-versions.bash |
| 110 | + check-for-windows-drift.bash |
| 111 | + check-proto-files.bash |
| 112 | + check-metrics-documentation.bash |
| 113 | + check-expiring-certs.bash |
| 114 | + steps: |
| 115 | + - name: Download artifact |
| 116 | + uses: actions/download-artifact@v4 |
| 117 | + with: |
| 118 | + name: repo |
| 119 | + - run: | |
| 120 | + tar -xzvf repo-artifact.tar.gz |
| 121 | + tar -xzvf ci-artifact.tar.gz |
| 122 | + - name: lint-repo |
| 123 | + run: | |
| 124 | + "${GITHUB_WORKSPACE}"/ci/shared/tasks/lint-repo/task.bash |
| 125 | + test-on-mysql-5-7: |
| 126 | + if: contains(github.event.pull_request.labels.*.name, 'ready-to-run') |
| 127 | + runs-on: ubuntu-latest |
| 128 | + needs: [repo-clone, determine-image-tag] |
| 129 | + env: |
| 130 | + BUILD_IMAGE: cloudfoundry/tas-runtime-mysql-5.7:${{ needs.determine-image-tag.outputs.go_version }} |
| 131 | + DB_USER: root |
| 132 | + DB_PASSWORD: password |
| 133 | + steps: |
| 134 | + - name: Download artifact |
| 135 | + uses: actions/download-artifact@v4 |
| 136 | + with: |
| 137 | + name: repo |
| 138 | + - run: | |
| 139 | + tar -xzvf repo-artifact.tar.gz |
| 140 | + tar -xzvf ci-artifact.tar.gz |
| 141 | + - name: pull image |
| 142 | + run: docker pull "$BUILD_IMAGE" |
| 143 | + - name: build binaries |
| 144 | + run: | |
| 145 | + repo/.github/helpers/build.bash ${{ github.workspace }} "$BUILD_IMAGE" |
| 146 | +#@ for package in helpers.packages_with_configure_db(data.values.internal_repos): |
| 147 | + - name: #@ "{}-mysql".format(package.name) |
| 148 | + env: |
| 149 | + DIR: #@ "src/code.cloudfoundry.org/{}".format(package.name) |
| 150 | + DB: mysql |
| 151 | + run: | |
| 152 | + repo/.github/helpers/test.bash ${{ github.workspace }} "$BUILD_IMAGE" |
| 153 | +#@ end |
| 154 | + test-repos-withoutdb: |
| 155 | + if: contains(github.event.pull_request.labels.*.name, 'ready-to-run') |
| 156 | + runs-on: ubuntu-latest |
| 157 | + needs: [repo-clone, determine-image-tag] |
| 158 | + env: |
| 159 | + BUILD_IMAGE: cloudfoundry/tas-runtime-build:${{ needs.determine-image-tag.outputs.go_version }} |
| 160 | + steps: |
| 161 | + - name: Download artifact |
| 162 | + uses: actions/download-artifact@v4 |
| 163 | + with: |
| 164 | + name: repo |
| 165 | + - run: | |
| 166 | + tar -xzvf repo-artifact.tar.gz |
| 167 | + tar -xzvf ci-artifact.tar.gz |
| 168 | + - name: pull image |
| 169 | + run: docker pull "$BUILD_IMAGE" |
| 170 | + - name: build binaries |
| 171 | + run: | |
| 172 | + repo/.github/helpers/build.bash ${{ github.workspace }} "$BUILD_IMAGE" |
| 173 | +#@ for package in helpers.packages_without_configure_db(data.values.internal_repos): |
| 174 | + - name: #@ package.name |
| 175 | + env: |
| 176 | + DIR: #@ "src/code.cloudfoundry.org/{}".format(package.name) |
| 177 | + run: | |
| 178 | + repo/.github/helpers/test.bash ${{ github.workspace }} "$BUILD_IMAGE" |
| 179 | +#@ end |
| 180 | + test-on-postgres: |
| 181 | + if: contains(github.event.pull_request.labels.*.name, 'ready-to-run') |
| 182 | + runs-on: ubuntu-latest |
| 183 | + needs: [repo-clone, determine-image-tag] |
| 184 | + env: |
| 185 | + BUILD_IMAGE: cloudfoundry/tas-runtime-postgres:${{ needs.determine-image-tag.outputs.go_version }} |
| 186 | + DB_USER: postgres |
| 187 | + DB_PASSWORD: "" |
| 188 | + steps: |
| 189 | + - name: Download artifact |
| 190 | + uses: actions/download-artifact@v4 |
| 191 | + with: |
| 192 | + name: repo |
| 193 | + - run: | |
| 194 | + tar -xzvf repo-artifact.tar.gz |
| 195 | + tar -xzvf ci-artifact.tar.gz |
| 196 | + - name: pull image |
| 197 | + run: docker pull "$BUILD_IMAGE" |
| 198 | + - name: build binaries |
| 199 | + run: | |
| 200 | + repo/.github/helpers/build.bash ${{ github.workspace }} "$BUILD_IMAGE" |
| 201 | +#@ for package in helpers.packages_with_configure_db(data.values.internal_repos): |
| 202 | + - name: #@ "{}-postgres".format(package.name) |
| 203 | + env: |
| 204 | + DIR: #@ "src/code.cloudfoundry.org/{}".format(package.name) |
| 205 | + DB: postgres |
| 206 | + run: | |
| 207 | + repo/.github/helpers/test.bash ${{ github.workspace }} "$BUILD_IMAGE" |
| 208 | +#@ end |
| 209 | + test-on-mysql-8-0: |
| 210 | + if: contains(github.event.pull_request.labels.*.name, 'ready-to-run') |
| 211 | + runs-on: ubuntu-latest |
| 212 | + needs: [repo-clone, determine-image-tag] |
| 213 | + env: |
| 214 | + BUILD_IMAGE: cloudfoundry/tas-runtime-mysql-8.0:${{ needs.determine-image-tag.outputs.go_version }} |
| 215 | + DB_USER: root |
| 216 | + DB_PASSWORD: password |
| 217 | + steps: |
| 218 | + - name: Download artifact |
| 219 | + uses: actions/download-artifact@v4 |
| 220 | + with: |
| 221 | + name: repo |
| 222 | + - run: | |
| 223 | + tar -xzvf repo-artifact.tar.gz |
| 224 | + tar -xzvf ci-artifact.tar.gz |
| 225 | + - name: pull image |
| 226 | + run: docker pull "$BUILD_IMAGE" |
| 227 | + - name: build binaries |
| 228 | + run: | |
| 229 | + repo/.github/helpers/build.bash ${{ github.workspace }} "$BUILD_IMAGE" |
| 230 | +#@ for package in helpers.packages_with_configure_db(data.values.internal_repos): |
| 231 | + - name: #@ "{}-mysql".format(package.name) |
| 232 | + env: |
| 233 | + DIR: #@ "src/code.cloudfoundry.org/{}".format(package.name) |
| 234 | + DB: mysql |
| 235 | + run: | |
| 236 | + repo/.github/helpers/test.bash ${{ github.workspace }} "$BUILD_IMAGE" |
| 237 | +#@ end |
| 238 | +#! test |
0 commit comments