From 07b9db6a46f36c52e77395174b10fcd27c1cc8e5 Mon Sep 17 00:00:00 2001 From: Henry Mercer Date: Tue, 15 Nov 2022 20:53:57 +0000 Subject: [PATCH] Explicitly set up Go 1.13.1 in checks running on old runner images --- .github/workflows/__analyze-ref-input.yml | 5 +++ .github/workflows/__go-custom-queries.yml | 4 ++- .../workflows/__go-tracing-autobuilder.yml | 4 ++- .../__go-tracing-custom-build-steps.yml | 4 ++- .../__go-tracing-legacy-workflow.yml | 4 ++- .github/workflows/__ml-powered-queries.yml | 5 +++ .../workflows/__multi-language-autodetect.yml | 5 +++ .github/workflows/__remote-config.yml | 5 +++ .github/workflows/__unset-environment.yml | 5 +++ .github/workflows/__upload-ref-sha-input.yml | 5 +++ .github/workflows/__with-checkout-path.yml | 5 +++ pr-checks/checks/go-custom-queries.yml | 3 -- pr-checks/checks/go-tracing-autobuilder.yml | 3 -- .../checks/go-tracing-custom-build-steps.yml | 3 -- .../checks/go-tracing-legacy-workflow.yml | 3 -- pr-checks/sync.py | 35 ++++++++++++------- 16 files changed, 70 insertions(+), 28 deletions(-) diff --git a/.github/workflows/__analyze-ref-input.yml b/.github/workflows/__analyze-ref-input.yml index 8998eb0fdc..84b99876fe 100644 --- a/.github/workflows/__analyze-ref-input.yml +++ b/.github/workflows/__analyze-ref-input.yml @@ -72,6 +72,11 @@ jobs: uses: ./.github/prepare-test with: version: ${{ matrix.version }} + - name: Set up Go + if: matrix.os == 'ubuntu-20.04' || matrix.os == 'windows-2019' + uses: actions/setup-go@v3 + with: + go-version: ^1.13.1 - uses: ./../action/init with: tools: ${{ steps.prepare-test.outputs.tools-url }} diff --git a/.github/workflows/__go-custom-queries.yml b/.github/workflows/__go-custom-queries.yml index 8ed26a9520..3b4da7b4ed 100644 --- a/.github/workflows/__go-custom-queries.yml +++ b/.github/workflows/__go-custom-queries.yml @@ -72,7 +72,9 @@ jobs: uses: ./.github/prepare-test with: version: ${{ matrix.version }} - - uses: actions/setup-go@v3 + - name: Set up Go + if: matrix.os == 'ubuntu-20.04' || matrix.os == 'windows-2019' + uses: actions/setup-go@v3 with: go-version: ^1.13.1 - uses: ./../action/init diff --git a/.github/workflows/__go-tracing-autobuilder.yml b/.github/workflows/__go-tracing-autobuilder.yml index 62a2e5d1c0..0de99293de 100644 --- a/.github/workflows/__go-tracing-autobuilder.yml +++ b/.github/workflows/__go-tracing-autobuilder.yml @@ -60,7 +60,9 @@ jobs: uses: ./.github/prepare-test with: version: ${{ matrix.version }} - - uses: actions/setup-go@v3 + - name: Set up Go + if: matrix.os == 'ubuntu-20.04' || matrix.os == 'windows-2019' + uses: actions/setup-go@v3 with: go-version: ^1.13.1 - uses: ./../action/init diff --git a/.github/workflows/__go-tracing-custom-build-steps.yml b/.github/workflows/__go-tracing-custom-build-steps.yml index d863d8d92e..e9877327d1 100644 --- a/.github/workflows/__go-tracing-custom-build-steps.yml +++ b/.github/workflows/__go-tracing-custom-build-steps.yml @@ -60,7 +60,9 @@ jobs: uses: ./.github/prepare-test with: version: ${{ matrix.version }} - - uses: actions/setup-go@v3 + - name: Set up Go + if: matrix.os == 'ubuntu-20.04' || matrix.os == 'windows-2019' + uses: actions/setup-go@v3 with: go-version: ^1.13.1 - uses: ./../action/init diff --git a/.github/workflows/__go-tracing-legacy-workflow.yml b/.github/workflows/__go-tracing-legacy-workflow.yml index a328893591..77aa3793db 100644 --- a/.github/workflows/__go-tracing-legacy-workflow.yml +++ b/.github/workflows/__go-tracing-legacy-workflow.yml @@ -60,7 +60,9 @@ jobs: uses: ./.github/prepare-test with: version: ${{ matrix.version }} - - uses: actions/setup-go@v3 + - name: Set up Go + if: matrix.os == 'ubuntu-20.04' || matrix.os == 'windows-2019' + uses: actions/setup-go@v3 with: go-version: ^1.13.1 - uses: ./../action/init diff --git a/.github/workflows/__ml-powered-queries.yml b/.github/workflows/__ml-powered-queries.yml index 47835d60af..5c73023747 100644 --- a/.github/workflows/__ml-powered-queries.yml +++ b/.github/workflows/__ml-powered-queries.yml @@ -60,6 +60,11 @@ jobs: uses: ./.github/prepare-test with: version: ${{ matrix.version }} + - name: Set up Go + if: matrix.os == 'ubuntu-20.04' || matrix.os == 'windows-2019' + uses: actions/setup-go@v3 + with: + go-version: ^1.13.1 - uses: ./../action/init with: languages: javascript diff --git a/.github/workflows/__multi-language-autodetect.yml b/.github/workflows/__multi-language-autodetect.yml index e0369b6cd9..c990a6ed09 100644 --- a/.github/workflows/__multi-language-autodetect.yml +++ b/.github/workflows/__multi-language-autodetect.yml @@ -60,6 +60,11 @@ jobs: uses: ./.github/prepare-test with: version: ${{ matrix.version }} + - name: Set up Go + if: matrix.os == 'ubuntu-20.04' || matrix.os == 'windows-2019' + uses: actions/setup-go@v3 + with: + go-version: ^1.13.1 - uses: ./../action/init with: db-location: ${{ runner.temp }}/customDbLocation diff --git a/.github/workflows/__remote-config.yml b/.github/workflows/__remote-config.yml index e079f7b103..948d6bf936 100644 --- a/.github/workflows/__remote-config.yml +++ b/.github/workflows/__remote-config.yml @@ -72,6 +72,11 @@ jobs: uses: ./.github/prepare-test with: version: ${{ matrix.version }} + - name: Set up Go + if: matrix.os == 'ubuntu-20.04' || matrix.os == 'windows-2019' + uses: actions/setup-go@v3 + with: + go-version: ^1.13.1 - uses: ./../action/init with: tools: ${{ steps.prepare-test.outputs.tools-url }} diff --git a/.github/workflows/__unset-environment.yml b/.github/workflows/__unset-environment.yml index 4dd1f9df7c..dcb8b0693c 100644 --- a/.github/workflows/__unset-environment.yml +++ b/.github/workflows/__unset-environment.yml @@ -48,6 +48,11 @@ jobs: uses: ./.github/prepare-test with: version: ${{ matrix.version }} + - name: Set up Go + if: matrix.os == 'ubuntu-20.04' || matrix.os == 'windows-2019' + uses: actions/setup-go@v3 + with: + go-version: ^1.13.1 - uses: ./../action/init with: db-location: ${{ runner.temp }}/customDbLocation diff --git a/.github/workflows/__upload-ref-sha-input.yml b/.github/workflows/__upload-ref-sha-input.yml index 4197671a9e..d9c29bd703 100644 --- a/.github/workflows/__upload-ref-sha-input.yml +++ b/.github/workflows/__upload-ref-sha-input.yml @@ -72,6 +72,11 @@ jobs: uses: ./.github/prepare-test with: version: ${{ matrix.version }} + - name: Set up Go + if: matrix.os == 'ubuntu-20.04' || matrix.os == 'windows-2019' + uses: actions/setup-go@v3 + with: + go-version: ^1.13.1 - uses: ./../action/init with: tools: ${{ steps.prepare-test.outputs.tools-url }} diff --git a/.github/workflows/__with-checkout-path.yml b/.github/workflows/__with-checkout-path.yml index 66b8af3f3b..29d9cfbb92 100644 --- a/.github/workflows/__with-checkout-path.yml +++ b/.github/workflows/__with-checkout-path.yml @@ -72,6 +72,11 @@ jobs: uses: ./.github/prepare-test with: version: ${{ matrix.version }} + - name: Set up Go + if: matrix.os == 'ubuntu-20.04' || matrix.os == 'windows-2019' + uses: actions/setup-go@v3 + with: + go-version: ^1.13.1 - uses: actions/checkout@v3 with: ref: 474bbf07f9247ffe1856c6a0f94aeeb10e7afee6 diff --git a/pr-checks/checks/go-custom-queries.yml b/pr-checks/checks/go-custom-queries.yml index b8215bebe7..20261adc3f 100644 --- a/pr-checks/checks/go-custom-queries.yml +++ b/pr-checks/checks/go-custom-queries.yml @@ -3,9 +3,6 @@ description: "Checks that Go works in conjunction with a config file specifying env: DOTNET_GENERATE_ASPNET_CERTIFICATE: "false" steps: - - uses: actions/setup-go@v3 - with: - go-version: "^1.13.1" - uses: ./../action/init with: languages: go diff --git a/pr-checks/checks/go-tracing-autobuilder.yml b/pr-checks/checks/go-tracing-autobuilder.yml index 4e0bafa94e..7ea1d7e263 100644 --- a/pr-checks/checks/go-tracing-autobuilder.yml +++ b/pr-checks/checks/go-tracing-autobuilder.yml @@ -4,9 +4,6 @@ operatingSystems: ["ubuntu", "macos"] env: DOTNET_GENERATE_ASPNET_CERTIFICATE: "false" steps: - - uses: actions/setup-go@v3 - with: - go-version: "^1.13.1" - uses: ./../action/init with: languages: go diff --git a/pr-checks/checks/go-tracing-custom-build-steps.yml b/pr-checks/checks/go-tracing-custom-build-steps.yml index 4267e8e090..361fa31ce9 100644 --- a/pr-checks/checks/go-tracing-custom-build-steps.yml +++ b/pr-checks/checks/go-tracing-custom-build-steps.yml @@ -2,9 +2,6 @@ name: "Go: tracing with custom build steps" description: "Checks that Go tracing traces the build when using custom build steps" operatingSystems: ["ubuntu", "macos"] steps: - - uses: actions/setup-go@v3 - with: - go-version: "^1.13.1" - uses: ./../action/init with: languages: go diff --git a/pr-checks/checks/go-tracing-legacy-workflow.yml b/pr-checks/checks/go-tracing-legacy-workflow.yml index ea5d6a881b..0c82542304 100644 --- a/pr-checks/checks/go-tracing-legacy-workflow.yml +++ b/pr-checks/checks/go-tracing-legacy-workflow.yml @@ -4,9 +4,6 @@ operatingSystems: ["ubuntu", "macos"] env: DOTNET_GENERATE_ASPNET_CERTIFICATE: "false" steps: - - uses: actions/setup-go@v3 - with: - go-version: "^1.13.1" - uses: ./../action/init with: languages: go diff --git a/pr-checks/sync.py b/pr-checks/sync.py index 0a2beda4e8..19189d3ac7 100644 --- a/pr-checks/sync.py +++ b/pr-checks/sync.py @@ -58,6 +58,19 @@ def writeHeader(checkStream): with open(f"checks/{file}", 'r') as checkStream: checkSpecification = yaml.load(checkStream) + matrix = [] + for version in checkSpecification.get('versions', defaultTestVersions): + runnerImages = operatingSystemsForVersion(version) + if checkSpecification.get('operatingSystems', None): + runnerImages = [image for image in runnerImages for operatingSystem in checkSpecification['operatingSystems'] + if image.startswith(operatingSystem)] + + for runnerImage in runnerImages: + matrix.append({ + 'os': runnerImage, + 'version': version + }) + steps = [ { 'name': 'Check out repository', @@ -72,20 +85,18 @@ def writeHeader(checkStream): } } ] - steps.extend(checkSpecification['steps']) - matrix = [] - for version in checkSpecification.get('versions', defaultTestVersions): - runnerImages = operatingSystemsForVersion(version) - if checkSpecification.get('operatingSystems', None): - runnerImages = [image for image in runnerImages for operatingSystem in checkSpecification['operatingSystems'] - if image.startswith(operatingSystem)] + if any(not isCompatibleWithLatestImages(m['version']) for m in matrix): + steps.append({ + 'name': 'Set up Go', + 'if': "matrix.os == 'ubuntu-20.04' || matrix.os == 'windows-2019'", + 'uses': 'actions/setup-go@v3', + 'with': { + 'go-version': '^1.13.1' + } + }) - for runnerImage in runnerImages: - matrix.append({ - 'os': runnerImage, - 'version': version - }) + steps.extend(checkSpecification['steps']) checkJob = { 'strategy': {