From 42050fe5665daa9131e6c277c098bdbdab61fc59 Mon Sep 17 00:00:00 2001 From: Simone Basso Date: Fri, 27 Jan 2023 02:29:29 +0100 Subject: [PATCH] fix: attempt to make all workflows green (#1065) The check for the number of tokens was failing for Windows so relax the check to say "three or more". There's a warning related to use the old checkout@v2, so upgrade to using checkout@v3 for all workflows in the repo. The Linux action didn't set the correct version of Go, so it wasn't possible to start the build. Everything else was WAI. Part of https://github.com/ooni/probe/issues/2273. --- .github/workflows/alltests.yml | 2 +- .github/workflows/android.yml | 4 +- .github/workflows/checks.yml | 2 +- .github/workflows/codeql-analysis.yml | 2 +- .github/workflows/coverage.yml | 2 +- .github/workflows/debianrepo.yml | 8 ++-- .github/workflows/generate.yml | 2 +- .github/workflows/ghpublish.yml | 2 +- .github/workflows/gosec.yml | 2 +- .github/workflows/ios.yml | 4 +- .github/workflows/jafar.yml | 2 +- .github/workflows/libtorlinux.yml | 2 +- .github/workflows/linux.yml | 62 ++++++++++++++++++++++----- .github/workflows/macos.yml | 6 +-- .github/workflows/netxlite.yml | 2 +- .github/workflows/oohelperd.yml | 2 +- .github/workflows/qa.yml | 2 +- .github/workflows/tarball.yml | 2 +- .github/workflows/windows.yml | 6 +-- internal/cmd/buildtool/windows.go | 2 +- internal/cmd/ghgen/linux.go | 1 + internal/cmd/ghgen/utils.go | 2 +- 22 files changed, 81 insertions(+), 40 deletions(-) diff --git a/.github/workflows/alltests.yml b/.github/workflows/alltests.yml index 7e6646788d..d9454e4053 100644 --- a/.github/workflows/alltests.yml +++ b/.github/workflows/alltests.yml @@ -11,7 +11,7 @@ jobs: test: runs-on: ubuntu-20.04 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Get GOVERSION content id: goversion diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index b86252db92..2c7a9e96df 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -16,7 +16,7 @@ jobs: build_android: runs-on: ubuntu-20.04 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: fetch-depth: 0 @@ -98,7 +98,7 @@ jobs: permissions: contents: write steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: fetch-depth: 0 diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index ca411e1414..4915786f4f 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -13,5 +13,5 @@ jobs: matrix: os: [ "ubuntu-20.04" ] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - run: ./script/nocopyreadall.bash diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index cdd04dc80a..81ad0fabaa 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -22,7 +22,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Initialize CodeQL uses: github/codeql-action/init@v2 diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 698ff0d9c5..1345171bcf 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -13,7 +13,7 @@ jobs: runs-on: ubuntu-20.04 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Get GOVERSION content id: goversion diff --git a/.github/workflows/debianrepo.yml b/.github/workflows/debianrepo.yml index fff443c8a5..ba003dfc67 100644 --- a/.github/workflows/debianrepo.yml +++ b/.github/workflows/debianrepo.yml @@ -11,27 +11,27 @@ jobs: test_386: runs-on: "ubuntu-20.04" steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - run: sudo ./E2E/debian.bash docker i386 - run: sudo cat DEBIAN_INSTALLED_PACKAGE.txt test_amd64: runs-on: "ubuntu-20.04" steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - run: sudo ./E2E/debian.bash docker amd64 - run: sudo cat DEBIAN_INSTALLED_PACKAGE.txt test_arm: runs-on: "ubuntu-20.04" steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - run: sudo ./E2E/debian.bash docker armhf - run: sudo cat DEBIAN_INSTALLED_PACKAGE.txt test_arm64: runs-on: "ubuntu-20.04" steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - run: sudo ./E2E/debian.bash docker arm64 - run: sudo cat DEBIAN_INSTALLED_PACKAGE.txt diff --git a/.github/workflows/generate.yml b/.github/workflows/generate.yml index 0afdccde2e..29d848ea45 100644 --- a/.github/workflows/generate.yml +++ b/.github/workflows/generate.yml @@ -10,7 +10,7 @@ jobs: test: runs-on: ubuntu-20.04 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Get GOVERSION content id: goversion diff --git a/.github/workflows/ghpublish.yml b/.github/workflows/ghpublish.yml index 59bdc93f95..473c3f083c 100644 --- a/.github/workflows/ghpublish.yml +++ b/.github/workflows/ghpublish.yml @@ -11,7 +11,7 @@ jobs: test_ghpublish_bash: runs-on: ubuntu-20.04 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: fetch-depth: 0 diff --git a/.github/workflows/gosec.yml b/.github/workflows/gosec.yml index 240b8f23c5..af3beee5e9 100644 --- a/.github/workflows/gosec.yml +++ b/.github/workflows/gosec.yml @@ -14,7 +14,7 @@ jobs: GO111MODULE: on steps: - name: Checkout Source - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Get GOVERSION content id: goversion diff --git a/.github/workflows/ios.yml b/.github/workflows/ios.yml index c4327bda31..4427d67e44 100644 --- a/.github/workflows/ios.yml +++ b/.github/workflows/ios.yml @@ -16,7 +16,7 @@ jobs: build_ios_mobile: runs-on: macos-11 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: fetch-depth: 0 @@ -53,7 +53,7 @@ jobs: permissions: contents: write steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: fetch-depth: 0 diff --git a/.github/workflows/jafar.yml b/.github/workflows/jafar.yml index c6f9bef694..8030db42c7 100644 --- a/.github/workflows/jafar.yml +++ b/.github/workflows/jafar.yml @@ -10,7 +10,7 @@ jobs: test: runs-on: ubuntu-20.04 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Get GOVERSION content id: goversion diff --git a/.github/workflows/libtorlinux.yml b/.github/workflows/libtorlinux.yml index 9366c96f77..a8139f4e89 100644 --- a/.github/workflows/libtorlinux.yml +++ b/.github/workflows/libtorlinux.yml @@ -13,7 +13,7 @@ jobs: runs-on: ubuntu-20.04 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Get GOVERSION content id: goversion diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index ae8833d86a..042805dd71 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -16,7 +16,7 @@ jobs: build_linux_cli_386: runs-on: ubuntu-20.04 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: fetch-depth: 0 @@ -27,6 +27,14 @@ jobs: PSIPHON_CONFIG_KEY: ${{ secrets.PSIPHON_CONFIG_KEY }} PSIPHON_CONFIG_JSON_AGE_BASE64: ${{ secrets.PSIPHON_CONFIG_JSON_AGE_BASE64 }} + - name: Get GOVERSION content + id: goversion + run: echo ::set-output name=version::$(cat GOVERSION) + - uses: magnetikonline/action-golang-cache@v2 + with: + go-version: "${{ steps.goversion.outputs.version }}" + cache-key-suffix: "-linux-386-${{ steps.goversion.outputs.version }}" + - uses: actions/cache@v3 with: path: GOCACHE @@ -50,7 +58,7 @@ jobs: permissions: contents: write steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: fetch-depth: 0 @@ -69,7 +77,7 @@ jobs: build_linux_cli_amd64: runs-on: ubuntu-20.04 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: fetch-depth: 0 @@ -80,6 +88,14 @@ jobs: PSIPHON_CONFIG_KEY: ${{ secrets.PSIPHON_CONFIG_KEY }} PSIPHON_CONFIG_JSON_AGE_BASE64: ${{ secrets.PSIPHON_CONFIG_JSON_AGE_BASE64 }} + - name: Get GOVERSION content + id: goversion + run: echo ::set-output name=version::$(cat GOVERSION) + - uses: magnetikonline/action-golang-cache@v2 + with: + go-version: "${{ steps.goversion.outputs.version }}" + cache-key-suffix: "-linux-amd64-${{ steps.goversion.outputs.version }}" + - uses: actions/cache@v3 with: path: GOCACHE @@ -101,7 +117,7 @@ jobs: runs-on: ubuntu-20.04 needs: build_linux_cli_amd64 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: fetch-depth: 0 @@ -138,7 +154,7 @@ jobs: permissions: contents: write steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: fetch-depth: 0 @@ -157,7 +173,7 @@ jobs: build_linux_cli_armv6: runs-on: ubuntu-20.04 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: fetch-depth: 0 @@ -171,6 +187,14 @@ jobs: PSIPHON_CONFIG_KEY: ${{ secrets.PSIPHON_CONFIG_KEY }} PSIPHON_CONFIG_JSON_AGE_BASE64: ${{ secrets.PSIPHON_CONFIG_JSON_AGE_BASE64 }} + - name: Get GOVERSION content + id: goversion + run: echo ::set-output name=version::$(cat GOVERSION) + - uses: magnetikonline/action-golang-cache@v2 + with: + go-version: "${{ steps.goversion.outputs.version }}" + cache-key-suffix: "-linux-armv6-${{ steps.goversion.outputs.version }}" + - uses: actions/cache@v3 with: path: GOCACHE @@ -194,7 +218,7 @@ jobs: permissions: contents: write steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: fetch-depth: 0 @@ -213,7 +237,7 @@ jobs: build_linux_cli_armv7: runs-on: ubuntu-20.04 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: fetch-depth: 0 @@ -227,6 +251,14 @@ jobs: PSIPHON_CONFIG_KEY: ${{ secrets.PSIPHON_CONFIG_KEY }} PSIPHON_CONFIG_JSON_AGE_BASE64: ${{ secrets.PSIPHON_CONFIG_JSON_AGE_BASE64 }} + - name: Get GOVERSION content + id: goversion + run: echo ::set-output name=version::$(cat GOVERSION) + - uses: magnetikonline/action-golang-cache@v2 + with: + go-version: "${{ steps.goversion.outputs.version }}" + cache-key-suffix: "-linux-armv7-${{ steps.goversion.outputs.version }}" + - uses: actions/cache@v3 with: path: GOCACHE @@ -250,7 +282,7 @@ jobs: permissions: contents: write steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: fetch-depth: 0 @@ -269,7 +301,7 @@ jobs: build_linux_cli_arm64: runs-on: ubuntu-20.04 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: fetch-depth: 0 @@ -283,6 +315,14 @@ jobs: PSIPHON_CONFIG_KEY: ${{ secrets.PSIPHON_CONFIG_KEY }} PSIPHON_CONFIG_JSON_AGE_BASE64: ${{ secrets.PSIPHON_CONFIG_JSON_AGE_BASE64 }} + - name: Get GOVERSION content + id: goversion + run: echo ::set-output name=version::$(cat GOVERSION) + - uses: magnetikonline/action-golang-cache@v2 + with: + go-version: "${{ steps.goversion.outputs.version }}" + cache-key-suffix: "-linux-arm64-${{ steps.goversion.outputs.version }}" + - uses: actions/cache@v3 with: path: GOCACHE @@ -306,7 +346,7 @@ jobs: permissions: contents: write steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: fetch-depth: 0 diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index a52ac5f282..6006a89448 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -16,7 +16,7 @@ jobs: build_darwin_cli: runs-on: macos-11 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: fetch-depth: 0 @@ -61,7 +61,7 @@ jobs: runs-on: macos-11 needs: build_darwin_cli steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: fetch-depth: 0 @@ -79,7 +79,7 @@ jobs: permissions: contents: write steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: fetch-depth: 0 diff --git a/.github/workflows/netxlite.yml b/.github/workflows/netxlite.yml index 5d3b9cbbd1..9c79103d7f 100644 --- a/.github/workflows/netxlite.yml +++ b/.github/workflows/netxlite.yml @@ -18,7 +18,7 @@ jobs: os: [ "ubuntu-20.04", "windows-2019", "macos-10.15" ] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Get GOVERSION content id: goversion diff --git a/.github/workflows/oohelperd.yml b/.github/workflows/oohelperd.yml index 206bb33ba9..349f446bfb 100644 --- a/.github/workflows/oohelperd.yml +++ b/.github/workflows/oohelperd.yml @@ -16,7 +16,7 @@ jobs: permissions: # See https://github.com/ooni/probe/issues/2154 contents: write steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Get GOVERSION content id: goversion diff --git a/.github/workflows/qa.yml b/.github/workflows/qa.yml index 68b2e6d736..2594b72194 100644 --- a/.github/workflows/qa.yml +++ b/.github/workflows/qa.yml @@ -11,5 +11,5 @@ jobs: test_webconnectivity: runs-on: ubuntu-20.04 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - run: ./QA/rundocker.bash "webconnectivity" diff --git a/.github/workflows/tarball.yml b/.github/workflows/tarball.yml index c14d62fea7..a53fa370c8 100644 --- a/.github/workflows/tarball.yml +++ b/.github/workflows/tarball.yml @@ -17,7 +17,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: fetch-depth: 0 diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 799ce7f09e..2ac0f7b7d1 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -16,7 +16,7 @@ jobs: build_windows_cli: runs-on: ubuntu-20.04 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: fetch-depth: 0 @@ -64,7 +64,7 @@ jobs: runs-on: windows-2019 needs: build_windows_cli steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: fetch-depth: 0 @@ -81,7 +81,7 @@ jobs: permissions: contents: write steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: fetch-depth: 0 diff --git a/internal/cmd/buildtool/windows.go b/internal/cmd/buildtool/windows.go index 6c39ea2937..8875fe2fea 100644 --- a/internal/cmd/buildtool/windows.go +++ b/internal/cmd/buildtool/windows.go @@ -100,7 +100,7 @@ func windowsMingwCheckFor(compiler string) { expected := windowsMingwExpectedVersionGetter() firstLine := string(must.FirstLineBytes(must.RunOutputQuiet(compiler, "--version"))) v := strings.Split(firstLine, " ") - runtimex.Assert(len(v) == 3, "expected to see exactly three tokens") + runtimex.Assert(len(v) >= 3, "expected to see three tokens or more") if got := v[2]; got != expected { log.Fatalf("expected mingw %s but got %s", expected, got) } diff --git a/internal/cmd/ghgen/linux.go b/internal/cmd/ghgen/linux.go index 43541be8d9..597337203a 100644 --- a/internal/cmd/ghgen/linux.go +++ b/internal/cmd/ghgen/linux.go @@ -32,6 +32,7 @@ func buildAndPublishCLILinux(w io.Writer, job *Job) { newSetupInstallQemuUserStatic(w) } newStepSetupPsiphon(w) + newStepSetupGo(w, fmt.Sprintf("linux-%s", arch)) newStepSetupLinuxDockerGoCache(w, arch) newStepMake(w, fmt.Sprintf("CLI/linux-static-%s", arch)) newStepUploadArtifacts(w, artifacts) diff --git a/internal/cmd/ghgen/utils.go b/internal/cmd/ghgen/utils.go index d702732432..f1ee68a841 100644 --- a/internal/cmd/ghgen/utils.go +++ b/internal/cmd/ghgen/utils.go @@ -30,7 +30,7 @@ func newJob(w io.Writer, name, runsOn, needs string, permissions map[string]stri } func newStepCheckout(w io.Writer) { - mustFprintf(w, " - uses: actions/checkout@v2\n") + mustFprintf(w, " - uses: actions/checkout@v3\n") mustFprintf(w, " with:\n") mustFprintf(w, " fetch-depth: 0\n") mustFprintf(w, "\n")