88 required : false
99env :
1010 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
11+ # Note this needs to match the shard input to the test matrix below as well as pattern in exclude.
12+ # see jobs.test.strategy.matrix.{shard,exclude}
13+ TOTAL_SHARDS : 15
1114
1215jobs :
1316 test :
2124 go-version : [1.22.x, 1.23.x]
2225 platform : [ubuntu-latest, macos-latest, windows-latest]
2326 feature-flags : ["DEFAULT", "PULUMI_TF_BRIDGE_ACCURATE_BRIDGE_PREVIEW"]
27+ # Needs to match TOTAL_SHARDS
28+ shard : [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]
29+ exclude :
30+ # We do not run non-default feature flags on non-ubuntu.
31+ - platform : windows-latest
32+ feature-flags : " PULUMI_TF_BRIDGE_ACCURATE_BRIDGE_PREVIEW"
33+ - platform : macos-latest
34+ feature-flags : " PULUMI_TF_BRIDGE_ACCURATE_BRIDGE_PREVIEW"
35+ # Windows and mac test runs do not need to be sharded as they are fast enough.
36+ # In order to do that we will skip all except the 0-th shard.
37+ - platform : windows-latest
38+ shard : 1
39+ - platform : windows-latest
40+ shard : 2
41+ - platform : windows-latest
42+ shard : 3
43+ - platform : windows-latest
44+ shard : 4
45+ - platform : windows-latest
46+ shard : 5
47+ - platform : windows-latest
48+ shard : 6
49+ - platform : windows-latest
50+ shard : 7
51+ - platform : windows-latest
52+ shard : 8
53+ - platform : windows-latest
54+ shard : 9
55+ - platform : windows-latest
56+ shard : 10
57+ - platform : windows-latest
58+ shard : 11
59+ - platform : windows-latest
60+ shard : 12
61+ - platform : windows-latest
62+ shard : 13
63+ - platform : windows-latest
64+ shard : 14
65+ - platform : macos-latest
66+ shard : 1
67+ - platform : macos-latest
68+ shard : 2
69+ - platform : macos-latest
70+ shard : 3
71+ - platform : macos-latest
72+ shard : 4
73+ - platform : macos-latest
74+ shard : 5
75+ - platform : macos-latest
76+ shard : 6
77+ - platform : macos-latest
78+ shard : 7
79+ - platform : macos-latest
80+ shard : 8
81+ - platform : macos-latest
82+ shard : 9
83+ - platform : macos-latest
84+ shard : 10
85+ - platform : macos-latest
86+ shard : 11
87+ - platform : macos-latest
88+ shard : 12
89+ - platform : macos-latest
90+ shard : 13
91+ - platform : macos-latest
92+ shard : 14
2493 runs-on : ${{ matrix.platform }}
2594 steps :
2695 - name : Install pulumi
@@ -39,16 +108,19 @@ jobs:
39108 go-version : ${{ matrix.go-version }}
40109 cache-dependency-path : |
41110 **/go.sum
111+ # disable caching on windows because it's very slow
112+ # see https://github.com/actions/setup-go/issues/495
113+ cache : ${{ matrix.platform != 'windows-latest' }}
42114 - name : export feature flags
43115 run : echo ${{ matrix.feature-flags }}=true >> $GITHUB_ENV
44116 if : ${{ matrix.platform != 'windows-latest' && matrix.feature-flags != 'DEFAULT' }}
45- - name : export feature flags
46- run : echo ${{ matrix.feature-flags }}=true >> $env:GITHUB_ENV
47- if : ${{ matrix.platform == 'windows-latest' && matrix.feature-flags != 'DEFAULT' }}
48117 - name : Build
49118 run : make build
50119 - name : Build PF
51120 run : cd pkg/pf && make build
121+ - name : Shard tests
122+ run : echo "RUN_TEST_CMD=$(go run github.com/pulumi/shard@5b6297aaffa0c06291fb8231968d7a9f4e6832e6 --total ${{ env.TOTAL_SHARDS }} --index ${{ matrix.shard }} --seed 314)" >> $GITHUB_ENV
123+ if : ${{ matrix.platform == 'ubuntu-latest' }}
52124 - name : Test
53125 run : make test
54126 - name : Upload coverage reports to Codecov
@@ -78,3 +150,25 @@ jobs:
78150 version : v1.62
79151 - name : Lint
80152 run : make lint
153+ sentinel :
154+ name : sentinel
155+ if : github.event_name == 'repository_dispatch' ||
156+ github.event.pull_request.head.repo.full_name == github.repository
157+ permissions :
158+ statuses : write
159+ needs :
160+ - test
161+ - lint
162+ runs-on : ubuntu-latest
163+ steps :
164+ - uses : guibranco/github-status-action-v2@0849440ec82c5fa69b2377725b9b7852a3977e76 # v1.1.13
165+ with :
166+ authToken : ${{secrets.GITHUB_TOKEN}}
167+ # Write an explicit status check called "Sentinel" which will only pass if this code really runs.
168+ # This should always be a required check for PRs.
169+ context : ' Sentinel'
170+ description : ' All required checks passed'
171+ state : ' success'
172+ # Write to the PR commit SHA if it's available as we don't want the merge commit sha,
173+ # otherwise use the current SHA for any other type of build.
174+ sha : ${{ github.event.pull_request.head.sha || github.sha }}
0 commit comments