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:
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 ./...

View File

@ -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

View File

@ -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

View File

@ -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 ./...

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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: |

View File

@ -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

View File

@ -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/...

View File

@ -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

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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

View File

@ -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

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
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

2
mk
View File

@ -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.