| name: ci |
| on: |
| push: |
| branches: |
| - master |
| pull_request: |
| schedule: |
| - cron: '0 2 * * *' # Run every day, at 2AM UTC. |
| env: |
| GOPATH: ${{ github.workspace }} |
| WORKING_DIR: ./src/github.com/google/pprof/ |
| jobs: |
| test-mac: |
| runs-on: ${{ matrix.os }} |
| defaults: |
| run: |
| working-directory: ${{ env.WORKING_DIR }} |
| strategy: |
| fail-fast: false |
| matrix: |
| go: ['1.16', '1.17', 'tip'] |
| # Supported macOS versions can be found in |
| # https://github.com/actions/virtual-environments#available-environments. |
| os: ['macos-10.15', 'macos-11'] |
| # Supported Xcode versions for macOS 10.15 can be found in |
| # https://github.com/actions/virtual-environments/blob/main/images/macos/macos-10.15-Readme.md#xcode. |
| # Supported Xcode versions for macOS 11 can be found in |
| # https://github.com/actions/virtual-environments/blob/main/images/macos/macos-11-Readme.md#xcode |
| xcode-version: ['13.0', '12.5', '12.4', '12.3', '12.1.1', '12.0.1', '11.7'] |
| exclude: |
| - os: 'macos-10.15' |
| xcode-version: '13.0' |
| - os: 'macos-10.15' |
| xcode-version: '12.5' |
| - os: 'macos-11' |
| xcode-version: '12.4' |
| - os: 'macos-11' |
| xcode-version: '12.3' |
| - os: 'macos-11' |
| xcode-version: '12.1.1' |
| - os: 'macos-11' |
| xcode-version: '12.0.1' |
| steps: |
| - name: Update Go version using setup-go |
| uses: actions/setup-go@v2 |
| if: matrix.go != 'tip' |
| with: |
| go-version: ${{ matrix.go }} |
| |
| - name: Update Go version manually |
| if: matrix.go == 'tip' |
| working-directory: ${{ github.workspace }} |
| run: | |
| git clone https://go.googlesource.com/go $HOME/gotip |
| cd $HOME/gotip/src |
| ./make.bash |
| echo "GOROOT=$HOME/gotip" >> $GITHUB_ENV |
| echo "RUN_STATICCHECK=false" >> $GITHUB_ENV |
| echo "$HOME/gotip/bin:$PATH" >> $GITHUB_PATH |
| |
| - name: Checkout the repo |
| uses: actions/checkout@v2 |
| with: |
| path: ${{ env.WORKING_DIR }} |
| |
| - name: Set up Xcode |
| uses: maxim-lobanov/setup-xcode@v1 |
| with: |
| xcode-version: ${{ matrix.xcode-version }} |
| |
| - name: Fetch dependencies |
| run: | |
| brew install graphviz |
| # Do not let tools interfere with the main module's go.mod. |
| cd && go mod init tools |
| go get -u golang.org/x/lint/golint honnef.co/go/tools/cmd/... |
| go install golang.org/x/lint/golint honnef.co/go/tools/cmd/... |
| # Add PATH for installed tools. |
| echo "$GOPATH/bin:$PATH" >> $GITHUB_PATH |
| |
| - name: Run the script |
| run: | |
| go version |
| gofmtdiff=$(gofmt -s -d .) && if [ -n "$gofmtdiff" ]; then printf 'gofmt -s found:\n%s\n' "$gofmtdiff" && exit 1; fi |
| golintlint=$(golint ./...) && if [ -n "$golintlint" ]; then printf 'golint found:\n%s\n' "$golintlint" && exit 1; fi |
| go vet -all ./... |
| ./test.sh |
| |
| - name: Check to make sure that tests also work in GOPATH mode |
| env: |
| GO111MODULE: off |
| run: | |
| go get -d . |
| go test -v ./... |
| |
| - name: Code coverage |
| uses: codecov/codecov-action@v1 |
| with: |
| file: ./coverage.txt |
| |
| test-linux: |
| runs-on: ${{ matrix.os }} |
| defaults: |
| run: |
| working-directory: ${{ env.WORKING_DIR }} |
| strategy: |
| fail-fast: false |
| matrix: |
| go: ['1.16', '1.17', 'tip'] |
| os: ['ubuntu-20.04', 'ubuntu-18.04'] |
| steps: |
| - name: Update Go version using setup-go |
| uses: actions/setup-go@v2 |
| if: matrix.go != 'tip' |
| with: |
| go-version: ${{ matrix.go }} |
| |
| - name: Update Go version manually |
| if: matrix.go == 'tip' |
| working-directory: ${{ github.workspace }} |
| run: | |
| git clone https://go.googlesource.com/go $HOME/gotip |
| cd $HOME/gotip/src |
| ./make.bash |
| echo "GOROOT=$HOME/gotip" >> $GITHUB_ENV |
| echo "RUN_STATICCHECK=false" >> $GITHUB_ENV |
| echo "$HOME/gotip/bin" >> $GITHUB_PATH |
| |
| - name: Checkout the repo |
| uses: actions/checkout@v2 |
| with: |
| path: ${{ env.WORKING_DIR }} |
| |
| - name: Fetch dependencies |
| run: | |
| sudo apt-get install graphviz |
| # Do not let tools interfere with the main module's go.mod. |
| cd && go mod init tools |
| go get -u golang.org/x/lint/golint honnef.co/go/tools/cmd/... |
| go install golang.org/x/lint/golint honnef.co/go/tools/cmd/... |
| # Add PATH for installed tools. |
| echo "PATH=$GOPATH/bin:$PATH" >> $GITHUB_ENV |
| |
| - name: Run the script |
| run: | |
| go version |
| gofmtdiff=$(gofmt -s -d .) && if [ -n "$gofmtdiff" ]; then printf 'gofmt -s found:\n%s\n' "$gofmtdiff" && exit 1; fi |
| golintlint=$(golint ./...) && if [ -n "$golintlint" ]; then printf 'golint found:\n%s\n' "$golintlint" && exit 1; fi |
| go vet -all ./... |
| ./test.sh |
| |
| - name: Check to make sure that tests also work in GOPATH mode |
| env: |
| GO111MODULE: off |
| run: | |
| go get -d . |
| go test -v ./... |
| |
| - name: Code coverage |
| uses: codecov/codecov-action@v1 |
| with: |
| file: ./${{ env.WORKING_DIR }}/coverage.txt |
| |
| test-windows: |
| runs-on: windows-2019 |
| strategy: |
| fail-fast: false |
| matrix: |
| go: ['1.16', '1.17'] |
| steps: |
| - name: Update Go version using setup-go |
| uses: actions/setup-go@v2 |
| with: |
| go-version: ${{ matrix.go }} |
| |
| - name: Checkout the repo |
| uses: actions/checkout@v2 |
| with: |
| path: ${{ env.WORKING_DIR }} |
| |
| - name: Fetch Windows dependency |
| uses: crazy-max/ghaction-chocolatey@v1 |
| with: |
| args: install graphviz llvm |
| |
| - name: Run the test |
| run: | |
| go version |
| # This is a workaround to make graphviz installed through choco work. |
| # It generates a config file to tell dot what layout engine and |
| # format types are available. See |
| # https://github.com/google/pprof/issues/585 for more details. |
| dot -c |
| go env |
| go build github.com/google/pprof |
| go test -v ./... |
| working-directory: ${{ env.WORKING_DIR }} |