cleanup: define required Go version just once (#861)

See https://github.com/ooni/probe/issues/2217
This commit is contained in:
Simone Basso 2022-08-17 11:39:38 +02:00 committed by GitHub
parent 6a0ae5c70b
commit 3cc2ce0b81
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
22 changed files with 169 additions and 57 deletions

View File

@ -9,8 +9,14 @@ jobs:
test: test:
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
steps: steps:
- uses: actions/checkout@v2
- name: Get GOVERSION content
id: goversion
run: echo ::set-output name=version::$(cat GOVERSION)
- uses: actions/setup-go@v1 - uses: actions/setup-go@v1
with: with:
go-version: "1.18.3" go-version: "${{ steps.goversion.outputs.version }}"
- uses: actions/checkout@v2
- run: go test -race -tags shaping ./... - run: go test -race -tags shaping ./...

View File

@ -14,14 +14,18 @@ jobs:
contents: write contents: write
steps: steps:
- uses: actions/setup-go@v1
with:
go-version: "1.18.3"
- uses: actions/checkout@v2 - uses: actions/checkout@v2
with: with:
fetch-depth: 0 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: | - run: |
echo -n $PSIPHON_CONFIG_KEY > ./internal/engine/psiphon-config.key echo -n $PSIPHON_CONFIG_KEY > ./internal/engine/psiphon-config.key
echo $PSIPHON_CONFIG_JSON_AGE_BASE64 | base64 -d > ./internal/engine/psiphon-config.json.age echo $PSIPHON_CONFIG_JSON_AGE_BASE64 | base64 -d > ./internal/engine/psiphon-config.json.age

View File

@ -10,17 +10,21 @@ on:
jobs: jobs:
measure_coverage: measure_coverage:
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
strategy:
matrix:
go:
- "1.18.3"
steps: 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 - uses: magnetikonline/action-golang-cache@v2
with: with:
go-version: "${{ matrix.go }}" go-version: "${{ steps.goversion.outputs.version }}"
cache-key-suffix: "-coverage-${{ matrix.go }}" cache-key-suffix: "-coverage-${{ steps.goversion.outputs.version }}"
- uses: actions/checkout@v2
- run: go test -short -race -tags shaping -coverprofile=probe-cli.cov ./... - run: go test -short -race -tags shaping -coverprofile=probe-cli.cov ./...
- uses: shogo82148/actions-goveralls@v1 - uses: shogo82148/actions-goveralls@v1
with: with:
path-to-profile: probe-cli.cov path-to-profile: probe-cli.cov

View File

@ -9,8 +9,14 @@ jobs:
test: test:
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
steps: steps:
- uses: actions/checkout@v2
- name: Get GOVERSION content
id: goversion
run: echo ::set-output name=version::$(cat GOVERSION)
- uses: actions/setup-go@v1 - uses: actions/setup-go@v1
with: with:
go-version: "1.18.3" go-version: "${{ steps.goversion.outputs.version }}"
- uses: actions/checkout@v2
- run: go generate ./... - run: go generate ./...

View File

@ -11,14 +11,18 @@ jobs:
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
env: env:
GO111MODULE: on GO111MODULE: on
strategy:
matrix:
go:
- "1.18.3"
steps: steps:
- name: Checkout Source - name: Checkout Source
uses: actions/checkout@v2 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 - name: Run Gosec security scanner
continue-on-error: true # TODO(https://github.com/ooni/probe/issues/2180) continue-on-error: true # TODO(https://github.com/ooni/probe/issues/2180)
uses: securego/gosec@master uses: securego/gosec@master

View File

@ -14,13 +14,18 @@ jobs:
contents: write contents: write
steps: steps:
- uses: actions/setup-go@v1
with:
go-version: "1.18.3"
- uses: actions/checkout@v2 - uses: actions/checkout@v2
with: with:
fetch-depth: 0 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: | - run: |
echo -n $PSIPHON_CONFIG_KEY > ./internal/engine/psiphon-config.key echo -n $PSIPHON_CONFIG_KEY > ./internal/engine/psiphon-config.key
echo $PSIPHON_CONFIG_JSON_AGE_BASE64 | base64 -d > ./internal/engine/psiphon-config.json.age echo $PSIPHON_CONFIG_JSON_AGE_BASE64 | base64 -d > ./internal/engine/psiphon-config.json.age

View File

@ -9,9 +9,16 @@ jobs:
test: test:
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
steps: steps:
- uses: actions/checkout@v2
- name: Get GOVERSION content
id: goversion
run: echo ::set-output name=version::$(cat GOVERSION)
- uses: actions/setup-go@v1 - uses: actions/setup-go@v1
with: with:
go-version: "1.18.3" go-version: "${{ steps.goversion.outputs.version }}"
- uses: actions/checkout@v2
- run: go build -v ./internal/cmd/jafar - run: go build -v ./internal/cmd/jafar
- run: sudo ./testjafar.bash - run: sudo ./testjafar.bash

View File

@ -13,19 +13,28 @@ jobs:
permissions: # See https://github.com/ooni/probe/issues/2154 permissions: # See https://github.com/ooni/probe/issues/2154
contents: write contents: write
steps: steps:
- uses: actions/setup-go@v1
with:
go-version: "1.18.3"
- uses: actions/checkout@v2 - uses: actions/checkout@v2
with: with:
fetch-depth: 0 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: | - run: |
echo -n $PSIPHON_CONFIG_KEY > ./internal/engine/psiphon-config.key echo -n $PSIPHON_CONFIG_KEY > ./internal/engine/psiphon-config.key
echo $PSIPHON_CONFIG_JSON_AGE_BASE64 | base64 -d > ./internal/engine/psiphon-config.json.age echo $PSIPHON_CONFIG_JSON_AGE_BASE64 | base64 -d > ./internal/engine/psiphon-config.json.age
env: env:
PSIPHON_CONFIG_KEY: ${{ secrets.PSIPHON_CONFIG_KEY }} PSIPHON_CONFIG_KEY: ${{ secrets.PSIPHON_CONFIG_KEY }}
PSIPHON_CONFIG_JSON_AGE_BASE64: ${{ secrets.PSIPHON_CONFIG_JSON_AGE_BASE64 }} PSIPHON_CONFIG_JSON_AGE_BASE64: ${{ secrets.PSIPHON_CONFIG_JSON_AGE_BASE64 }}
- run: ./mk ./CLI/ooniprobe-darwin - run: ./mk ./CLI/ooniprobe-darwin
- run: ./E2E/ooniprobe.sh ./CLI/ooniprobe-darwin-amd64 - run: ./E2E/ooniprobe.sh ./CLI/ooniprobe-darwin-amd64
- run: | - run: |

View File

@ -19,14 +19,18 @@ jobs:
contents: write contents: write
steps: steps:
- uses: actions/setup-go@v1
with:
go-version: "1.18.3"
- uses: actions/checkout@v2 - uses: actions/checkout@v2
with: with:
fetch-depth: 0 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: | - run: |
echo -n $PSIPHON_CONFIG_KEY > ./internal/engine/psiphon-config.key echo -n $PSIPHON_CONFIG_KEY > ./internal/engine/psiphon-config.key
echo $PSIPHON_CONFIG_JSON_AGE_BASE64 | base64 -d > ./internal/engine/psiphon-config.json.age echo $PSIPHON_CONFIG_JSON_AGE_BASE64 | base64 -d > ./internal/engine/psiphon-config.json.age

View File

@ -14,14 +14,20 @@ jobs:
runs-on: "${{ matrix.os }}" runs-on: "${{ matrix.os }}"
strategy: strategy:
matrix: matrix:
go: [ "1.18.3" ]
os: [ "ubuntu-20.04", "windows-2019", "macos-10.15" ] os: [ "ubuntu-20.04", "windows-2019", "macos-10.15" ]
steps: 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 - uses: magnetikonline/action-golang-cache@v2
with: with:
go-version: "${{ matrix.go }}" go-version: "${{ steps.goversion.outputs.version }}"
cache-key-suffix: "-coverage-${{ matrix.go }}" cache-key-suffix: "-coverage-${{ steps.goversion.outputs.version }}"
- uses: actions/checkout@v2
# The first test compiles and links against libc and uses getaddrinfo # The first test compiles and links against libc and uses getaddrinfo
- run: go test -race ./internal/netxlite/... - run: go test -race ./internal/netxlite/...

View File

@ -14,9 +14,14 @@ jobs:
contents: write contents: write
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: Get GOVERSION content
id: goversion
run: echo ::set-output name=version::$(cat GOVERSION)
- uses: actions/setup-go@v1 - uses: actions/setup-go@v1
with: with:
go-version: "1.18.3" go-version: "${{ steps.goversion.outputs.version }}"
- name: build oohelperd binary - 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 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

View File

@ -9,8 +9,14 @@ jobs:
test: test:
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
steps: steps:
- uses: actions/checkout@v2
- name: Get GOVERSION content
id: goversion
run: echo ::set-output name=version::$(cat GOVERSION)
- uses: actions/setup-go@v1 - uses: actions/setup-go@v1
with: with:
go-version: "1.18.3" go-version: "${{ steps.goversion.outputs.version }}"
- uses: actions/checkout@v2
- run: ./QA/rundocker.bash "fbmessenger" - run: ./QA/rundocker.bash "fbmessenger"

View File

@ -9,8 +9,14 @@ jobs:
test: test:
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
steps: steps:
- uses: actions/checkout@v2
- name: Get GOVERSION content
id: goversion
run: echo ::set-output name=version::$(cat GOVERSION)
- uses: actions/setup-go@v1 - uses: actions/setup-go@v1
with: with:
go-version: "1.18.3" go-version: "${{ steps.goversion.outputs.version }}"
- uses: actions/checkout@v2
- run: ./QA/rundocker.bash "hhfm" - run: ./QA/rundocker.bash "hhfm"

View File

@ -9,8 +9,14 @@ jobs:
test: test:
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
steps: steps:
- uses: actions/checkout@v2
- name: Get GOVERSION content
id: goversion
run: echo ::set-output name=version::$(cat GOVERSION)
- uses: actions/setup-go@v1 - uses: actions/setup-go@v1
with: with:
go-version: "1.18.3" go-version: "${{ steps.goversion.outputs.version }}"
- uses: actions/checkout@v2
- run: ./QA/rundocker.bash "hirl" - run: ./QA/rundocker.bash "hirl"

View File

@ -9,8 +9,14 @@ jobs:
test: test:
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
steps: steps:
- uses: actions/checkout@v2
- name: Get GOVERSION content
id: goversion
run: echo ::set-output name=version::$(cat GOVERSION)
- uses: actions/setup-go@v1 - uses: actions/setup-go@v1
with: with:
go-version: "1.18.3" go-version: "${{ steps.goversion.outputs.version }}"
- uses: actions/checkout@v2
- run: ./QA/rundocker.bash "telegram" - run: ./QA/rundocker.bash "telegram"

View File

@ -9,8 +9,14 @@ jobs:
test: test:
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
steps: steps:
- uses: actions/checkout@v2
- name: Get GOVERSION content
id: goversion
run: echo ::set-output name=version::$(cat GOVERSION)
- uses: actions/setup-go@v1 - uses: actions/setup-go@v1
with: with:
go-version: "1.18.3" go-version: "${{ steps.goversion.outputs.version }}"
- uses: actions/checkout@v2
- run: ./QA/rundocker.bash "webconnectivity" - run: ./QA/rundocker.bash "webconnectivity"

View File

@ -9,8 +9,14 @@ jobs:
test: test:
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
steps: steps:
- uses: actions/checkout@v2
- name: Get GOVERSION content
id: goversion
run: echo ::set-output name=version::$(cat GOVERSION)
- uses: actions/setup-go@v1 - uses: actions/setup-go@v1
with: with:
go-version: "1.18.3" go-version: "${{ steps.goversion.outputs.version }}"
- uses: actions/checkout@v2
- run: ./QA/rundocker.bash "whatsapp" - run: ./QA/rundocker.bash "whatsapp"

View File

@ -16,15 +16,21 @@ jobs:
uses: actions/checkout@v2 uses: actions/checkout@v2
with: with:
fetch-depth: 0 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: with:
go-version: "1.18.3" go-version: "${{ steps.goversion.outputs.version }}"
- name: Generate release tarball - name: Generate release tarball
run: | run: |
VERSION=${GITHUB_REF_NAME#v} VERSION=${GITHUB_REF_NAME#v}
go mod vendor go mod vendor
tar czf ooni-probe-cli-${VERSION}.tar.gz --transform "s,^,ooni-probe-cli-${VERSION}/," * tar czf ooni-probe-cli-${VERSION}.tar.gz --transform "s,^,ooni-probe-cli-${VERSION}/," *
- name: Upload release tarball - name: Upload release tarball
run: | run: |
gh release create -p $GITHUB_REF_NAME --target $GITHUB_SHA || true gh release create -p $GITHUB_REF_NAME --target $GITHUB_SHA || true

View File

@ -11,12 +11,18 @@ jobs:
build: build:
runs-on: "ubuntu-20.04" runs-on: "ubuntu-20.04"
steps: steps:
- uses: actions/setup-go@v1
with:
go-version: "1.18.3"
- uses: actions/checkout@v2 - uses: actions/checkout@v2
with: with:
fetch-depth: 0 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: sudo apt install mingw-w64
- run: | - run: |
echo -n $PSIPHON_CONFIG_KEY > ./internal/engine/psiphon-config.key echo -n $PSIPHON_CONFIG_KEY > ./internal/engine/psiphon-config.key
@ -24,11 +30,14 @@ jobs:
env: env:
PSIPHON_CONFIG_KEY: ${{ secrets.PSIPHON_CONFIG_KEY }} PSIPHON_CONFIG_KEY: ${{ secrets.PSIPHON_CONFIG_KEY }}
PSIPHON_CONFIG_JSON_AGE_BASE64: ${{ secrets.PSIPHON_CONFIG_JSON_AGE_BASE64 }} PSIPHON_CONFIG_JSON_AGE_BASE64: ${{ secrets.PSIPHON_CONFIG_JSON_AGE_BASE64 }}
- run: ./mk MINGW_W64_VERSION="9.3-win32" ./CLI/ooniprobe-windows - run: ./mk MINGW_W64_VERSION="9.3-win32" ./CLI/ooniprobe-windows
- uses: actions/upload-artifact@v2 - uses: actions/upload-artifact@v2
with: with:
name: ooniprobe-windows-amd64.exe name: ooniprobe-windows-amd64.exe
path: ./CLI/ooniprobe-windows-amd64.exe path: ./CLI/ooniprobe-windows-amd64.exe
- uses: actions/upload-artifact@v2 - uses: actions/upload-artifact@v2
with: with:
name: ooniprobe-windows-386.exe name: ooniprobe-windows-386.exe

1
GOVERSION Normal file
View File

@ -0,0 +1 @@
1.18.3

View File

@ -53,8 +53,8 @@ Please, make sure you add the `ooni/probe-cli` label.
### ooniprobe ### ooniprobe
Be sure you have golang 1.18.3 and a C compiler (Mingw-w64 for Windows). You Be sure you have the golang version mentioned inside the [GOVERSION](GOVERSION)
can build using: file and a C compiler (Mingw-w64 for Windows). You can build using:
```bash ```bash
go build -v ./cmd/ooniprobe go build -v ./cmd/ooniprobe

2
mk
View File

@ -64,7 +64,7 @@ GOLANG_EXTRA_FLAGS =
#help: #help:
#help: * GOLANG_VERSION_NUMBER : the expected version number for golang. #help: * GOLANG_VERSION_NUMBER : the expected version number for golang.
GOLANG_VERSION_NUMBER = 1.18.3 GOLANG_VERSION_NUMBER = $(shell cat GOVERSION)
#help: #help:
#help: * MINGW_W64_VERSION : the expected mingw-w64 version. #help: * MINGW_W64_VERSION : the expected mingw-w64 version.