Skip to content

chore: upgrade ipfs deps #326

chore: upgrade ipfs deps

chore: upgrade ipfs deps #326

Workflow file for this run

name: Go
on:
push:
tags:
- v*
branches:
- main
paths:
- "**"
- "!**.md"
- "go.*"
- "**.go"
- ".github/workflows/go.yml"
pull_request:
paths:
- "**"
- "!**.md"
- "go.*"
- "**.go"
- ".github/workflows/go.yml"
jobs:
golangci-lint:
name: Golangci-lint
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup asdf
uses: asdf-vm/actions/setup@v1
- name: Setup golang
run: |
asdf plugin add golang
asdf install golang
- name: Setup golangci-lint
run: |
asdf plugin add golangci-lint
asdf install golangci-lint
- name: Run golangci-lint
run: make lint
# this is not very common to have a job that checks the flappy tests.
#
# reason: some tests are flappy, they works, but not always;
# this job checks that they are working sometimes.
# if this job fails, then a test is "broken", not "flappy".
#
# summary: this job checks that "flappy tests" do not become "broken tests".
#
# we hope we can remove this job because all the tests are stable 100% of the time
flappy-tests:
name: Flappy tests (Linux)
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Load variables from file
uses: antifree/[email protected]
with:
filename: .github/workflows/utils/variables.json
- name: Setup asdf
uses: asdf-vm/actions/setup@v1
- name: Setup go
run: |
asdf plugin add golang
asdf install golang
echo "go_version=$(asdf current golang | xargs | cut -d ' ' -f 2)" >> $GITHUB_ENV
- name: Cache go modules
uses: actions/[email protected]
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ env.go_version }}-${{ env.json_cache-versions_go }}-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ runner.os }}-go-${{ env.go_version }}-${{ env.json_cache-versions_go }}-
- name: Avoid triggering make generate
run: touch gen.sum
- name: Fetch go modules
run: go mod download
- name: Compile the testing binaries
run: |
pushd . && go test -c -o ./tests.bin . && popd
- name: Check go.mod and go.sum
run: |
go mod tidy -v
git --no-pager diff go.mod go.sum
git --no-pager diff --quiet go.mod go.sum
- name: Run fast flappy tests
env:
TEST_SPEED: fast
TEST_STABILITY: flappy
run: make go.flappy-tests
go-tests-on-linux:
name: Stable tests (Linux)
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Load variables from file
uses: antifree/[email protected]
with:
filename: .github/workflows/utils/variables.json
- name: Setup asdf
uses: asdf-vm/actions/setup@v1
- name: Setup go
run: |
asdf plugin add golang
asdf install golang
echo "go_version=$(asdf current golang | xargs | cut -d ' ' -f 2)" >> $GITHUB_ENV
- name: Cache go modules
uses: actions/[email protected]
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ env.go_version }}-${{ env.json_cache-versions_go }}-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ runner.os }}-go-${{ env.go_version }}-${{ env.json_cache-versions_go }}-
- name: Check go.mod and go.sum
run: |
go mod tidy -v
git --no-pager diff go.mod go.sum
git --no-pager diff --quiet go.mod go.sum
- name: Run fast tests multiple times
env:
TEST_SPEED: fast
GO_TEST_OPTS: -test.timeout=600s -count 1
run: set -o pipefail; make go.unittest | tee test_log.txt
- name: Run all tests
env:
TEST_SPEED: any
GO_TEST_OPTS: -test.timeout=600s -count 1
run: make go.unittest
- name: Run all tests with race flag and generate coverage
env:
TEST_SPEED: any
GO_TEST_OPTS: -test.timeout=1200s -count=1 -race -cover -coverprofile=coverage.txt -covermode=atomic
run: make go.unittest
- name: Upload coverage to Codecov
uses: codecov/[email protected]
env:
OS: ${{ runner.os }}
GOLANG: ${{ env.go_version }}
with:
file: ./go/coverage.txt
flags: go.unittests
env_vars: OS,GOLANG
name: codecov-umbrella
fail_ci_if_error: false
go-tests-on-windows:
name: Stable tests (Windows)
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Load variables from file
uses: antifree/[email protected]
with:
filename: .github/workflows/utils/variables.json
- name: Get go version
shell: bash
run: echo "go_version=$(cat .tool-versions | grep '^golang [0-9]\+\.[0-9]\+\.[0-9]\+.*$' | cut -d ' ' -f 2)" >> $GITHUB_ENV
- name: Setup go
uses: actions/setup-go@v3
with:
go-version: ${{ env.go_version }}
- name: Cache go modules
uses: actions/[email protected]
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ env.go_version }}-${{ env.json_cache-versions_go }}-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ runner.os }}-go-${{ env.go_version }}-${{ env.json_cache-versions_go }}-
- name: Check go.mod and go.sum
run: |
go mod tidy -v
git --no-pager diff go.mod go.sum
git --no-pager diff --quiet go.mod go.sum
- name: Run fast tests multiple times
env:
TEST_SPEED: fast
run: go.exe test ./... -buildmode=exe -timeout=600s -count=5
- name: Run all tests
env:
TEST_SPEED: any
run: go.exe test ./... -buildmode=exe -timeout=600s -count=1
go-tests-on-macos:
name: Stable tests (macOS)
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Load variables from file
uses: antifree/[email protected]
with:
filename: .github/workflows/utils/variables.json
- name: Setup asdf
uses: asdf-vm/actions/setup@v1
- name: Setup go
run: |
asdf plugin add golang
asdf install golang
echo "go_version=$(asdf current golang | xargs | cut -d ' ' -f 2)" >> $GITHUB_ENV
- name: Cache go modules
uses: actions/[email protected]
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ env.go_version }}-${{ env.json_cache-versions_go }}-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ runner.os }}-go-${{ env.go_version }}-${{ env.json_cache-versions_go }}-
- name: Check go.mod and go.sum
run: |
go mod tidy -v
git --no-pager diff go.mod go.sum
git --no-pager diff --quiet go.mod go.sum
- name: Run fast tests multiple times
env:
TEST_SPEED: fast
GO_TEST_OPTS: -test.timeout=600s -count 1
run: set -o pipefail; make go.unittest | tee test_log.txt
- name: Run all tests
env:
TEST_SPEED: any
GO_TEST_OPTS: -test.timeout=600s -count 1
run: make go.unittest
- name: Run all tests with race flag and generate coverage
env:
TEST_SPEED: any
GO_TEST_OPTS: -test.timeout=1200s -count=1 -race -cover -coverprofile=coverage.txt -covermode=atomic
run: make go.unittest
- name: Upload coverage to Codecov
uses: codecov/[email protected]
env:
OS: ${{ runner.os }}
GOLANG: ${{ env.go_version }}
with:
file: ./go/coverage.txt
flags: go.unittests
env_vars: OS,GOLANG
name: codecov-umbrella
fail_ci_if_error: false
# TODO: consider adding various GOARCH check per OS.
# i.e., to validate that we build on 32/64bit.