Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit5d79aea

Browse files
committed
simplify the required check
1 parentdcfdc07 commit5d79aea

File tree

1 file changed

+71
-61
lines changed

1 file changed

+71
-61
lines changed

‎.github/workflows/ci.yaml‎

Lines changed: 71 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ jobs:
370370
api-key:${{ secrets.DATADOG_API_KEY }}
371371

372372
test-go-pg:
373-
runs-on:${{ matrix.os == 'ubuntu-latest' && github.repository_owner == 'coder' && 'depot-ubuntu-22.04-4' || matrix.os == 'macos-latest' && github.repository_owner == 'coder' && 'macos-latest-xlarge' || matrix.os == 'windows-2022' && github.repository_owner == 'coder' && 'windows-latest-16-cores' || matrix.os}}
373+
runs-on:${{ matrix.os == 'ubuntu-latest' && github.repository_owner == 'coder' && 'depot-ubuntu-22.04-4' || matrix.os == 'macos-latest' && github.repository_owner == 'coder' && 'macos-latest-xlarge'}}
374374
needs:changes
375375
if:needs.changes.outputs.go == 'true' || needs.changes.outputs.ci == 'true' || github.ref == 'refs/heads/main'
376376
# This timeout must be greater than the timeout set by `go test` in
@@ -383,7 +383,6 @@ jobs:
383383
os:
384384
-ubuntu-latest
385385
-macos-latest
386-
-windows-2022
387386
steps:
388387
-name:Harden Runner
389388
uses:step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f# v2.10.2
@@ -430,20 +429,56 @@ jobs:
430429
go run scripts/embedded-pg/main.go
431430
DB=ci gotestsum --format standard-quiet -- -v -short -count=1 ./...
432431
fi
433-
# This is used by the `required` job to determine if the test-go-pg job
434-
# failed or not on the given OS. Matrix jobs don't support `outputs`
435-
# well - the last job to run overwrites them. Instead, we write to
436-
# artifacts.
437-
-if:always()
438-
run:echo "0" > "test-go-pg_result_${{ matrix.os }}"
439-
-if:failure()
440-
run:echo "1" > "test-go-pg_result_${{ matrix.os }}"
441-
-name:Upload result artifact
442-
if:always()
443-
uses:actions/upload-artifact@v4
432+
433+
-name:Upload test stats to Datadog
434+
timeout-minutes:1
435+
continue-on-error:true
436+
uses:./.github/actions/upload-datadog
437+
if:success() || failure()
438+
with:
439+
api-key:${{ secrets.DATADOG_API_KEY }}
440+
441+
# NOTE: this could instead be defined as a matrix strategy, but we want to
442+
# temporarily allow windows tests to fail. Using a matrix strategy here makes
443+
# the check in the `required` job rather complicated.
444+
test-go-pg-windows:
445+
runs-on:${{ github.repository_owner == 'coder' && 'windows-latest-16-cores' }}
446+
needs:changes
447+
if:needs.changes.outputs.go == 'true' || needs.changes.outputs.ci == 'true' || github.ref == 'refs/heads/main'
448+
# This timeout must be greater than the timeout set by `go test` in
449+
# `make test-postgres` to ensure we receive a trace of running
450+
# goroutines. Setting this to the timeout +5m should work quite well
451+
# even if some of the preceding steps are slow.
452+
timeout-minutes:25
453+
steps:
454+
-name:Harden Runner
455+
uses:step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7# v2.10.1
444456
with:
445-
name:"test-go-pg_result_${{ matrix.os }}"
446-
path:"test-go-pg_result_${{ matrix.os }}"
457+
egress-policy:audit
458+
459+
-name:Checkout
460+
uses:actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871# v4.2.1
461+
with:
462+
fetch-depth:1
463+
464+
-name:Setup Go
465+
uses:./.github/actions/setup-go
466+
467+
-name:Setup Terraform
468+
uses:./.github/actions/setup-tf
469+
470+
-name:Test with PostgreSQL Database
471+
env:
472+
POSTGRES_VERSION:"13"
473+
TS_DEBUG_DISCO:"true"
474+
shell:bash
475+
run:|
476+
# By default Go will use the number of logical CPUs, which
477+
# is a fine default.
478+
PARALLEL_FLAG=""
479+
480+
go run scripts/embedded-pg/main.go
481+
DB=ci gotestsum --format standard-quiet -- -v -short -count=1 ./...
447482
448483
-name:Upload test stats to Datadog
449484
timeout-minutes:1
@@ -867,54 +902,29 @@ jobs:
867902
uses:step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f# v2.10.2
868903
with:
869904
egress-policy:audit
870-
-name:Download test-go-pg Artifacts
871-
uses:actions/download-artifact@v4
872-
with:
873-
path:test-go-pg_result
874-
pattern:test-go-pg_result_*
875-
merge-multiple:true
905+
876906
-name:Ensure required checks
877-
shell:python
878907
run:|
879-
import json
880-
import sys
881-
import os
882-
from pathlib import Path
883-
884-
print("Checking required checks")
885-
886-
jobs = json.loads(os.environ["NEEDS"])
887-
job_names = sorted(jobs.keys())
888-
for job_name in job_names:
889-
result = jobs[job_name]["result"]
890-
print(f"- {job_name}: {result}")
891-
print()
892-
893-
failed =False
894-
for job_name in job_names:
895-
result = jobs[job_name]["result"]
896-
897-
# Skip test-go-pg failures on windows
898-
if job_name == "test-go-pg" and result == "failure":
899-
result_artifacts = list(Path("test-go-pg_result").glob("test-go-pg_result_*"))
900-
results = {f.name: int(f.read_text()) for f in result_artifacts}
901-
del results["test-go-pg_result_windows-2022"]
902-
# We should have received 3 result artifacts: linux, macos, and windows
903-
if len(result_artifacts) == 3 and sum(results.values()) == 0:
904-
print("test-go-pg on windows-2022 failed, but we are temporarily skipping it until it's fixed")
905-
continue
906-
907-
if result in ["failure", "cancelled"]:
908-
failed =True
909-
break
910-
911-
if failed:
912-
print("One of the required checks has failed or has been cancelled")
913-
sys.exit(1)
914-
915-
print("Required checks have passed")
916-
env:
917-
NEEDS:${{ toJSON(needs) }}
908+
echo "Checking required checks"
909+
echo "- fmt: ${{ needs.fmt.result }}"
910+
echo "- lint: ${{ needs.lint.result }}"
911+
echo "- gen: ${{ needs.gen.result }}"
912+
echo "- test-go: ${{ needs.test-go.result }}"
913+
echo "- test-go-pg: ${{ needs.test-go-pg.result }}"
914+
echo "- test-go-race: ${{ needs.test-go-race.result }}"
915+
echo "- test-go-race-pg: ${{ needs.test-go-race-pg.result }}"
916+
echo "- test-js: ${{ needs.test-js.result }}"
917+
echo "- test-e2e: ${{ needs.test-e2e.result }}"
918+
echo "- offlinedocs: ${{ needs.offlinedocs.result }}"
919+
echo
920+
921+
# We allow skipped jobs to pass, but not failed or cancelled jobs.
922+
if [[ "${{ contains(needs.*.result, 'failure') }}" == "true" || "${{ contains(needs.*.result, 'cancelled') }}" == "true" ]]; then
923+
echo "One of the required checks has failed or has been cancelled"
924+
exit 1
925+
fi
926+
927+
echo "Required checks have passed"
918928
919929
# Builds the dylibs and upload it as an artifact so it can be embedded in the main build
920930
build-dylib:

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp