|
14 | 14 | test-go-pg:
|
15 | 15 | # make sure to adjust NUM_PARALLEL_PACKAGES and NUM_PARALLEL_TESTS below
|
16 | 16 | # when changing runner sizes
|
17 |
| - runs-on: ${{ matrix.os == 'ubuntu-latest' && github.repository_owner == 'coder' && 'depot-ubuntu-22.04-8' || matrix.os && matrix.os == 'macos-latest' && github.repository_owner == 'coder' && 'depot-macos-latest' || matrix.os == 'windows-2022' && github.repository_owner == 'coder' && 'depot-windows-2022-16' || matrix.os }} |
18 |
| - needs: changes |
19 |
| - if: needs.changes.outputs.go == 'true' || needs.changes.outputs.ci == 'true' || github.ref == 'refs/heads/main' |
| 17 | + runs-on: ${{ matrix.os == 'macos-latest' && github.repository_owner == 'coder' && 'depot-macos-latest' || matrix.os == 'windows-2022' && github.repository_owner == 'coder' && 'depot-windows-2022-16' || matrix.os }} |
20 | 18 | # This timeout must be greater than the timeout set by `go test` in
|
21 | 19 | # `make test-postgres` to ensure we receive a trace of running
|
22 | 20 | # goroutines. Setting this to the timeout +5m should work quite well
|
|
25 | 23 | strategy:
|
26 | 24 | matrix:
|
27 | 25 | os:
|
28 |
| - - ubuntu-latest |
29 | 26 | - macos-latest
|
30 | 27 | - windows-2022
|
31 | 28 | steps:
|
@@ -55,36 +52,17 @@ jobs:
|
55 | 52 | with:
|
56 | 53 | fetch-depth: 1
|
57 | 54 |
|
58 |
| - - name: Setup Go Paths |
59 |
| - id: go-paths |
60 |
| - uses: ./.github/actions/setup-go-paths |
61 |
| - |
62 |
| - - name: Download Go Build Cache |
63 |
| - id: download-go-build-cache |
64 |
| - uses: ./.github/actions/test-cache/download |
65 |
| - with: |
66 |
| - key-prefix: test-go-build-${{ runner.os }}-${{ runner.arch }} |
67 |
| - cache-path: ${{ steps.go-paths.outputs.cached-dirs }} |
68 |
| - |
69 | 55 | - name: Setup Go
|
70 | 56 | uses: ./.github/actions/setup-go
|
71 | 57 | with:
|
72 | 58 | # Runners have Go baked-in and Go will automatically
|
73 | 59 | # download the toolchain configured in go.mod, so we don't
|
74 | 60 | # need to reinstall it. It's faster on Windows runners.
|
75 | 61 | use-preinstalled-go: ${{ runner.os == 'Windows' }}
|
76 |
| - # Cache is already downloaded above |
77 |
| - use-cache: false |
78 | 62 |
|
79 | 63 | - name: Setup Terraform
|
80 | 64 | uses: ./.github/actions/setup-tf
|
81 | 65 |
|
82 |
| - - name: Download Test Cache |
83 |
| - id: download-cache |
84 |
| - uses: ./.github/actions/test-cache/download |
85 |
| - with: |
86 |
| - key-prefix: test-go-pg-${{ runner.os }}-${{ runner.arch }} |
87 |
| - |
88 | 66 | - name: Setup Embedded Postgres Cache Paths
|
89 | 67 | id: embedded-pg-cache
|
90 | 68 | uses: ./.github/actions/setup-embedded-pg-cache-paths
|
|
96 | 74 | key-prefix: embedded-pg-${{ runner.os }}-${{ runner.arch }}
|
97 | 75 | cache-path: ${{ steps.embedded-pg-cache.outputs.cached-dirs }}
|
98 | 76 |
|
99 |
| - - name: Normalize File and Directory Timestamps |
100 |
| - shell: bash |
101 |
| - # Normalize file modification timestamps so that go test can use the |
102 |
| - # cache from the previous CI run. See https://github.com/golang/go/issues/58571 |
103 |
| - # for more details. |
104 |
| - run: | |
105 |
| - find . -type f ! -path ./.git/\*\* | mtimehash |
106 |
| - find . -type d ! -path ./.git/\*\* -exec touch -t 200601010000 {} + |
107 |
| -
|
108 | 77 | - name: Test with PostgreSQL Database
|
109 | 78 | env:
|
110 | 79 | POSTGRES_VERSION: "13"
|
@@ -163,41 +132,13 @@ jobs:
|
163 | 132 | NUM_PARALLEL_TESTS=8
|
164 | 133 | fi
|
165 | 134 |
|
166 |
| - # by default, run tests with cache |
167 |
| - TESTCOUNT="" |
168 |
| - if [ "${{ github.ref }}" == "refs/heads/main" ]; then |
169 |
| - # on main, run tests without cache |
170 |
| - TESTCOUNT="-count=1" |
171 |
| - fi |
172 |
| -
|
173 |
| - TEST_RETRIES="--rerun-fails=2 --rerun-fails-max-failures=50" |
174 |
| - if [ "${{ github.ref }}" == "refs/heads/hugodutka/disable-test-retries-on-main" ]; then |
175 |
| - # on main, run tests without retries |
176 |
| - TEST_RETRIES="" |
177 |
| - fi |
178 |
| -
|
179 |
| - mkdir -p "$RUNNER_TEMP/sym" |
180 |
| - source scripts/normalize_path.sh |
181 |
| - # terraform gets installed in a random directory, so we need to normalize |
182 |
| - # the path to the terraform binary or a bunch of cached tests will be |
183 |
| - # invalidated. See scripts/normalize_path.sh for more details. |
184 |
| - normalize_path_with_symlinks "$RUNNER_TEMP/sym" "$(dirname $(which terraform))" |
| 135 | + # run tests without cache |
| 136 | + TESTCOUNT="-count=1" |
185 | 137 |
|
186 |
| - DB=ci gotestsum $TEST_RETRIES \ |
| 138 | + DB=ci gotestsum \ |
187 | 139 | --format standard-quiet --packages "./..." \
|
188 | 140 | -- -timeout=20m -v -p $NUM_PARALLEL_PACKAGES -parallel=$NUM_PARALLEL_TESTS $TESTCOUNT
|
189 | 141 |
|
190 |
| - - name: Upload Go Build Cache |
191 |
| - uses: ./.github/actions/test-cache/upload |
192 |
| - with: |
193 |
| - cache-key: ${{ steps.download-go-build-cache.outputs.cache-key }} |
194 |
| - cache-path: ${{ steps.go-paths.outputs.cached-dirs }} |
195 |
| - |
196 |
| - - name: Upload Test Cache |
197 |
| - uses: ./.github/actions/test-cache/upload |
198 |
| - with: |
199 |
| - cache-key: ${{ steps.download-cache.outputs.cache-key }} |
200 |
| - |
201 | 142 | - name: Upload Embedded Postgres Cache
|
202 | 143 | uses: ./.github/actions/embedded-pg-cache/upload
|
203 | 144 | # We only use the embedded Postgres cache on macOS and Windows runners.
|
|
0 commit comments