From 3cc2ce0b816ffc9f5ba6538a94ac24260977e3c7 Mon Sep 17 00:00:00 2001 From: Simone Basso Date: Wed, 17 Aug 2022 11:39:38 +0200 Subject: [PATCH] cleanup: define required Go version just once (#861) See https://github.com/ooni/probe/issues/2217 --- .github/workflows/alltests.yml | 10 ++++++++-- .github/workflows/android.yml | 12 ++++++++---- .github/workflows/coverage.yml | 18 +++++++++++------- .github/workflows/generate.yml | 10 ++++++++-- .github/workflows/gosec.yml | 12 ++++++++---- .github/workflows/ios.yml | 11 ++++++++--- .github/workflows/jafar.yml | 11 +++++++++-- .github/workflows/macos.yml | 15 ++++++++++++--- .github/workflows/miniooni.yml | 12 ++++++++---- .github/workflows/netxlite.yml | 14 ++++++++++---- .github/workflows/oohelperd.yml | 7 ++++++- .github/workflows/qafbmessenger.yml | 10 ++++++++-- .github/workflows/qahhfm.yml | 10 ++++++++-- .github/workflows/qahirl.yml | 10 ++++++++-- .github/workflows/qatelegram.yml | 10 ++++++++-- .github/workflows/qawebconnectivity.yml | 10 ++++++++-- .github/workflows/qawhatsapp.yml | 10 ++++++++-- .github/workflows/tarball.yml | 12 +++++++++--- .github/workflows/windows.yml | 15 ++++++++++++--- GOVERSION | 1 + Readme.md | 4 ++-- mk | 2 +- 22 files changed, 169 insertions(+), 57 deletions(-) create mode 100644 GOVERSION diff --git a/.github/workflows/alltests.yml b/.github/workflows/alltests.yml index a7389d8..a4fcf52 100644 --- a/.github/workflows/alltests.yml +++ b/.github/workflows/alltests.yml @@ -9,8 +9,14 @@ jobs: test: runs-on: ubuntu-20.04 steps: + - uses: actions/checkout@v2 + + - name: Get GOVERSION content + id: goversion + run: echo ::set-output name=version::$(cat GOVERSION) + - uses: actions/setup-go@v1 with: - go-version: "1.18.3" - - uses: actions/checkout@v2 + go-version: "${{ steps.goversion.outputs.version }}" + - run: go test -race -tags shaping ./... diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index 1865ab4..1297d14 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -14,14 +14,18 @@ jobs: contents: write steps: - - uses: actions/setup-go@v1 - with: - go-version: "1.18.3" - - uses: actions/checkout@v2 with: fetch-depth: 0 + - name: Get GOVERSION content + id: goversion + run: echo ::set-output name=version::$(cat GOVERSION) + + - uses: actions/setup-go@v1 + with: + go-version: "${{ steps.goversion.outputs.version }}" + - run: | echo -n $PSIPHON_CONFIG_KEY > ./internal/engine/psiphon-config.key echo $PSIPHON_CONFIG_JSON_AGE_BASE64 | base64 -d > ./internal/engine/psiphon-config.json.age diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 62b8cbd..2bd993f 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -10,17 +10,21 @@ on: jobs: measure_coverage: runs-on: ubuntu-20.04 - strategy: - matrix: - go: - - "1.18.3" + steps: + - uses: actions/checkout@v2 + + - name: Get GOVERSION content + id: goversion + run: echo ::set-output name=version::$(cat GOVERSION) + - uses: magnetikonline/action-golang-cache@v2 with: - go-version: "${{ matrix.go }}" - cache-key-suffix: "-coverage-${{ matrix.go }}" - - uses: actions/checkout@v2 + go-version: "${{ steps.goversion.outputs.version }}" + cache-key-suffix: "-coverage-${{ steps.goversion.outputs.version }}" + - run: go test -short -race -tags shaping -coverprofile=probe-cli.cov ./... + - uses: shogo82148/actions-goveralls@v1 with: path-to-profile: probe-cli.cov diff --git a/.github/workflows/generate.yml b/.github/workflows/generate.yml index 28aa9ad..6572ee6 100644 --- a/.github/workflows/generate.yml +++ b/.github/workflows/generate.yml @@ -9,8 +9,14 @@ jobs: test: runs-on: ubuntu-20.04 steps: + - uses: actions/checkout@v2 + + - name: Get GOVERSION content + id: goversion + run: echo ::set-output name=version::$(cat GOVERSION) + - uses: actions/setup-go@v1 with: - go-version: "1.18.3" - - uses: actions/checkout@v2 + go-version: "${{ steps.goversion.outputs.version }}" + - run: go generate ./... diff --git a/.github/workflows/gosec.yml b/.github/workflows/gosec.yml index 44860c7..4b588dc 100644 --- a/.github/workflows/gosec.yml +++ b/.github/workflows/gosec.yml @@ -11,14 +11,18 @@ jobs: runs-on: ubuntu-20.04 env: GO111MODULE: on - strategy: - matrix: - go: - - "1.18.3" steps: - name: Checkout Source uses: actions/checkout@v2 + - name: Get GOVERSION content + id: goversion + run: echo ::set-output name=version::$(cat GOVERSION) + + - uses: actions/setup-go@v1 + with: + go-version: "${{ steps.goversion.outputs.version }}" + - name: Run Gosec security scanner continue-on-error: true # TODO(https://github.com/ooni/probe/issues/2180) uses: securego/gosec@master diff --git a/.github/workflows/ios.yml b/.github/workflows/ios.yml index d1cfcf6..e1b2d0e 100644 --- a/.github/workflows/ios.yml +++ b/.github/workflows/ios.yml @@ -14,13 +14,18 @@ jobs: contents: write steps: - - uses: actions/setup-go@v1 - with: - go-version: "1.18.3" - uses: actions/checkout@v2 with: fetch-depth: 0 + - name: Get GOVERSION content + id: goversion + run: echo ::set-output name=version::$(cat GOVERSION) + + - uses: actions/setup-go@v1 + with: + go-version: "${{ steps.goversion.outputs.version }}" + - run: | echo -n $PSIPHON_CONFIG_KEY > ./internal/engine/psiphon-config.key echo $PSIPHON_CONFIG_JSON_AGE_BASE64 | base64 -d > ./internal/engine/psiphon-config.json.age diff --git a/.github/workflows/jafar.yml b/.github/workflows/jafar.yml index 7cd2069..c048b91 100644 --- a/.github/workflows/jafar.yml +++ b/.github/workflows/jafar.yml @@ -9,9 +9,16 @@ jobs: test: runs-on: ubuntu-20.04 steps: + - uses: actions/checkout@v2 + + - name: Get GOVERSION content + id: goversion + run: echo ::set-output name=version::$(cat GOVERSION) + - uses: actions/setup-go@v1 with: - go-version: "1.18.3" - - uses: actions/checkout@v2 + go-version: "${{ steps.goversion.outputs.version }}" + - run: go build -v ./internal/cmd/jafar + - run: sudo ./testjafar.bash diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index aca3b14..ed959a6 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -13,19 +13,28 @@ jobs: permissions: # See https://github.com/ooni/probe/issues/2154 contents: write steps: - - uses: actions/setup-go@v1 - with: - go-version: "1.18.3" + - uses: actions/checkout@v2 with: fetch-depth: 0 + + - name: Get GOVERSION content + id: goversion + run: echo ::set-output name=version::$(cat GOVERSION) + + - uses: actions/setup-go@v1 + with: + go-version: "${{ steps.goversion.outputs.version }}" + - run: | echo -n $PSIPHON_CONFIG_KEY > ./internal/engine/psiphon-config.key echo $PSIPHON_CONFIG_JSON_AGE_BASE64 | base64 -d > ./internal/engine/psiphon-config.json.age env: PSIPHON_CONFIG_KEY: ${{ secrets.PSIPHON_CONFIG_KEY }} PSIPHON_CONFIG_JSON_AGE_BASE64: ${{ secrets.PSIPHON_CONFIG_JSON_AGE_BASE64 }} + - run: ./mk ./CLI/ooniprobe-darwin + - run: ./E2E/ooniprobe.sh ./CLI/ooniprobe-darwin-amd64 - run: | diff --git a/.github/workflows/miniooni.yml b/.github/workflows/miniooni.yml index 9f1c962..2ae7f9c 100644 --- a/.github/workflows/miniooni.yml +++ b/.github/workflows/miniooni.yml @@ -19,14 +19,18 @@ jobs: contents: write steps: - - uses: actions/setup-go@v1 - with: - go-version: "1.18.3" - - uses: actions/checkout@v2 with: fetch-depth: 0 + - name: Get GOVERSION content + id: goversion + run: echo ::set-output name=version::$(cat GOVERSION) + + - uses: actions/setup-go@v1 + with: + go-version: "${{ steps.goversion.outputs.version }}" + - run: | echo -n $PSIPHON_CONFIG_KEY > ./internal/engine/psiphon-config.key echo $PSIPHON_CONFIG_JSON_AGE_BASE64 | base64 -d > ./internal/engine/psiphon-config.json.age diff --git a/.github/workflows/netxlite.yml b/.github/workflows/netxlite.yml index e0cae76..542fc5c 100644 --- a/.github/workflows/netxlite.yml +++ b/.github/workflows/netxlite.yml @@ -14,14 +14,20 @@ jobs: runs-on: "${{ matrix.os }}" strategy: matrix: - go: [ "1.18.3" ] os: [ "ubuntu-20.04", "windows-2019", "macos-10.15" ] steps: + + - uses: actions/checkout@v2 + + - name: Get GOVERSION content + id: goversion + run: echo ::set-output name=version::$(cat GOVERSION) + shell: bash + - uses: magnetikonline/action-golang-cache@v2 with: - go-version: "${{ matrix.go }}" - cache-key-suffix: "-coverage-${{ matrix.go }}" - - uses: actions/checkout@v2 + go-version: "${{ steps.goversion.outputs.version }}" + cache-key-suffix: "-coverage-${{ steps.goversion.outputs.version }}" # The first test compiles and links against libc and uses getaddrinfo - run: go test -race ./internal/netxlite/... diff --git a/.github/workflows/oohelperd.yml b/.github/workflows/oohelperd.yml index ba2bd40..0ea5d7b 100644 --- a/.github/workflows/oohelperd.yml +++ b/.github/workflows/oohelperd.yml @@ -14,9 +14,14 @@ jobs: contents: write steps: - uses: actions/checkout@v2 + + - name: Get GOVERSION content + id: goversion + run: echo ::set-output name=version::$(cat GOVERSION) + - uses: actions/setup-go@v1 with: - go-version: "1.18.3" + go-version: "${{ steps.goversion.outputs.version }}" - name: build oohelperd binary run: GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o ./CLI/oohelperd-linux-amd64 -v -tags netgo -ldflags="-s -w -extldflags -static" ./internal/cmd/oohelperd diff --git a/.github/workflows/qafbmessenger.yml b/.github/workflows/qafbmessenger.yml index 6b377d5..dbeda34 100644 --- a/.github/workflows/qafbmessenger.yml +++ b/.github/workflows/qafbmessenger.yml @@ -9,8 +9,14 @@ jobs: test: runs-on: ubuntu-20.04 steps: + - uses: actions/checkout@v2 + + - name: Get GOVERSION content + id: goversion + run: echo ::set-output name=version::$(cat GOVERSION) + - uses: actions/setup-go@v1 with: - go-version: "1.18.3" - - uses: actions/checkout@v2 + go-version: "${{ steps.goversion.outputs.version }}" + - run: ./QA/rundocker.bash "fbmessenger" diff --git a/.github/workflows/qahhfm.yml b/.github/workflows/qahhfm.yml index 6210391..3f41cc8 100644 --- a/.github/workflows/qahhfm.yml +++ b/.github/workflows/qahhfm.yml @@ -9,8 +9,14 @@ jobs: test: runs-on: ubuntu-20.04 steps: + - uses: actions/checkout@v2 + + - name: Get GOVERSION content + id: goversion + run: echo ::set-output name=version::$(cat GOVERSION) + - uses: actions/setup-go@v1 with: - go-version: "1.18.3" - - uses: actions/checkout@v2 + go-version: "${{ steps.goversion.outputs.version }}" + - run: ./QA/rundocker.bash "hhfm" diff --git a/.github/workflows/qahirl.yml b/.github/workflows/qahirl.yml index d8557fa..8d1c90b 100644 --- a/.github/workflows/qahirl.yml +++ b/.github/workflows/qahirl.yml @@ -9,8 +9,14 @@ jobs: test: runs-on: ubuntu-20.04 steps: + - uses: actions/checkout@v2 + + - name: Get GOVERSION content + id: goversion + run: echo ::set-output name=version::$(cat GOVERSION) + - uses: actions/setup-go@v1 with: - go-version: "1.18.3" - - uses: actions/checkout@v2 + go-version: "${{ steps.goversion.outputs.version }}" + - run: ./QA/rundocker.bash "hirl" diff --git a/.github/workflows/qatelegram.yml b/.github/workflows/qatelegram.yml index d412757..951a5b5 100644 --- a/.github/workflows/qatelegram.yml +++ b/.github/workflows/qatelegram.yml @@ -9,8 +9,14 @@ jobs: test: runs-on: ubuntu-20.04 steps: + - uses: actions/checkout@v2 + + - name: Get GOVERSION content + id: goversion + run: echo ::set-output name=version::$(cat GOVERSION) + - uses: actions/setup-go@v1 with: - go-version: "1.18.3" - - uses: actions/checkout@v2 + go-version: "${{ steps.goversion.outputs.version }}" + - run: ./QA/rundocker.bash "telegram" diff --git a/.github/workflows/qawebconnectivity.yml b/.github/workflows/qawebconnectivity.yml index 20416c4..808884f 100644 --- a/.github/workflows/qawebconnectivity.yml +++ b/.github/workflows/qawebconnectivity.yml @@ -9,8 +9,14 @@ jobs: test: runs-on: ubuntu-20.04 steps: + - uses: actions/checkout@v2 + + - name: Get GOVERSION content + id: goversion + run: echo ::set-output name=version::$(cat GOVERSION) + - uses: actions/setup-go@v1 with: - go-version: "1.18.3" - - uses: actions/checkout@v2 + go-version: "${{ steps.goversion.outputs.version }}" + - run: ./QA/rundocker.bash "webconnectivity" diff --git a/.github/workflows/qawhatsapp.yml b/.github/workflows/qawhatsapp.yml index 0687f6b..db88e32 100644 --- a/.github/workflows/qawhatsapp.yml +++ b/.github/workflows/qawhatsapp.yml @@ -9,8 +9,14 @@ jobs: test: runs-on: ubuntu-20.04 steps: + - uses: actions/checkout@v2 + + - name: Get GOVERSION content + id: goversion + run: echo ::set-output name=version::$(cat GOVERSION) + - uses: actions/setup-go@v1 with: - go-version: "1.18.3" - - uses: actions/checkout@v2 + go-version: "${{ steps.goversion.outputs.version }}" + - run: ./QA/rundocker.bash "whatsapp" diff --git a/.github/workflows/tarball.yml b/.github/workflows/tarball.yml index e8dda66..48118ea 100644 --- a/.github/workflows/tarball.yml +++ b/.github/workflows/tarball.yml @@ -16,15 +16,21 @@ jobs: uses: actions/checkout@v2 with: fetch-depth: 0 - - name: Set up Go - uses: actions/setup-go@v2 + + - name: Get GOVERSION content + id: goversion + run: echo ::set-output name=version::$(cat GOVERSION) + + - uses: actions/setup-go@v1 with: - go-version: "1.18.3" + go-version: "${{ steps.goversion.outputs.version }}" + - name: Generate release tarball run: | VERSION=${GITHUB_REF_NAME#v} go mod vendor tar czf ooni-probe-cli-${VERSION}.tar.gz --transform "s,^,ooni-probe-cli-${VERSION}/," * + - name: Upload release tarball run: | gh release create -p $GITHUB_REF_NAME --target $GITHUB_SHA || true diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 1d695c6..7ce51da 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -11,12 +11,18 @@ jobs: build: runs-on: "ubuntu-20.04" steps: - - uses: actions/setup-go@v1 - with: - go-version: "1.18.3" - uses: actions/checkout@v2 with: fetch-depth: 0 + + - name: Get GOVERSION content + id: goversion + run: echo ::set-output name=version::$(cat GOVERSION) + + - uses: actions/setup-go@v1 + with: + go-version: "${{ steps.goversion.outputs.version }}" + - run: sudo apt install mingw-w64 - run: | echo -n $PSIPHON_CONFIG_KEY > ./internal/engine/psiphon-config.key @@ -24,11 +30,14 @@ jobs: env: PSIPHON_CONFIG_KEY: ${{ secrets.PSIPHON_CONFIG_KEY }} PSIPHON_CONFIG_JSON_AGE_BASE64: ${{ secrets.PSIPHON_CONFIG_JSON_AGE_BASE64 }} + - run: ./mk MINGW_W64_VERSION="9.3-win32" ./CLI/ooniprobe-windows + - uses: actions/upload-artifact@v2 with: name: ooniprobe-windows-amd64.exe path: ./CLI/ooniprobe-windows-amd64.exe + - uses: actions/upload-artifact@v2 with: name: ooniprobe-windows-386.exe diff --git a/GOVERSION b/GOVERSION new file mode 100644 index 0000000..b9fb27a --- /dev/null +++ b/GOVERSION @@ -0,0 +1 @@ +1.18.3 diff --git a/Readme.md b/Readme.md index 5801b84..f2473e2 100644 --- a/Readme.md +++ b/Readme.md @@ -53,8 +53,8 @@ Please, make sure you add the `ooni/probe-cli` label. ### ooniprobe -Be sure you have golang 1.18.3 and a C compiler (Mingw-w64 for Windows). You -can build using: +Be sure you have the golang version mentioned inside the [GOVERSION](GOVERSION) +file and a C compiler (Mingw-w64 for Windows). You can build using: ```bash go build -v ./cmd/ooniprobe diff --git a/mk b/mk index 4b3d167..d2b6f74 100755 --- a/mk +++ b/mk @@ -64,7 +64,7 @@ GOLANG_EXTRA_FLAGS = #help: #help: * GOLANG_VERSION_NUMBER : the expected version number for golang. -GOLANG_VERSION_NUMBER = 1.18.3 +GOLANG_VERSION_NUMBER = $(shell cat GOVERSION) #help: #help: * MINGW_W64_VERSION : the expected mingw-w64 version.