暫無描述

ci.yaml 4.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. name: ci
  2. on:
  3. push:
  4. branches:
  5. - master
  6. pull_request:
  7. env:
  8. GOPATH: ${{ github.workspace }}
  9. WORKING_DIR: ./src/github.com/google/pprof/
  10. jobs:
  11. test-mac:
  12. runs-on: ${{ matrix.os }}
  13. continue-on-error: true
  14. defaults:
  15. run:
  16. working-directory: ${{ env.WORKING_DIR }}
  17. strategy:
  18. matrix:
  19. go: ['1.13', '1.14']
  20. os: ['macos-10.15']
  21. xcode-version: ['11.5', '10.3']
  22. steps:
  23. - name: Update go version
  24. uses: actions/setup-go@v2
  25. with:
  26. go-version: ${{ matrix.go }}
  27. - name: Checkout the repo
  28. uses: actions/checkout@v2
  29. with:
  30. path: ${{ env.WORKING_DIR }}
  31. - name: Set up Xcode
  32. uses: maxim-lobanov/setup-xcode@1.0
  33. with:
  34. xcode-version: ${{ matrix.xcode-version }}
  35. - name: Fetch dependencies
  36. # Do not let tools interfere with the main module's go.mod.
  37. env:
  38. GO111MODULE: off
  39. run: |
  40. brew install graphviz
  41. go get -u golang.org/x/lint/golint honnef.co/go/tools/cmd/...
  42. - name: Run the script
  43. run: |
  44. gofmtdiff=$(gofmt -s -d .) && if [ -n "$gofmtdiff" ]; then printf 'gofmt -s found:\n%s\n' "$gofmtdiff" && exit 1; fi
  45. golintlint=$(golint ./...) && if [ -n "$golintlint" ]; then printf 'golint found:\n%s\n' "$golintlint" && exit 1; fi
  46. go vet -all ./...
  47. ./test.sh
  48. - name: Check to make sure that tests also work in GOPATH mode
  49. env:
  50. GO111MODULE: off
  51. run: |
  52. go get -d .
  53. go test -v ./...
  54. - name: Code coverage
  55. uses: codecov/codecov-action@v1
  56. with:
  57. file: ./coverage.txt
  58. test-linux:
  59. runs-on: ${{ matrix.os }}
  60. continue-on-error: true
  61. defaults:
  62. run:
  63. working-directory: ${{ env.WORKING_DIR }}
  64. strategy:
  65. matrix:
  66. go: ['1.13', '1.14']
  67. os: ['ubuntu-20.04', 'ubuntu-18.04', 'ubuntu-16.04']
  68. steps:
  69. - name: Update go version
  70. uses: actions/setup-go@v2
  71. with:
  72. go-version: ${{ matrix.go }}
  73. - name: Checkout the repo
  74. uses: actions/checkout@v2
  75. with:
  76. path: ${{ env.WORKING_DIR }}
  77. - name: Fetch dependencies
  78. # Do not let tools interfere with the main module's go.mod.
  79. env:
  80. GO111MODULE: off
  81. run: |
  82. sudo apt-get install graphviz
  83. go get -u golang.org/x/lint/golint honnef.co/go/tools/cmd/...
  84. - name: Run the script
  85. run: |
  86. gofmtdiff=$(gofmt -s -d .) && if [ -n "$gofmtdiff" ]; then printf 'gofmt -s found:\n%s\n' "$gofmtdiff" && exit 1; fi
  87. golintlint=$(golint ./...) && if [ -n "$golintlint" ]; then printf 'golint found:\n%s\n' "$golintlint" && exit 1; fi
  88. go vet -all ./...
  89. ./test.sh
  90. - name: Check to make sure that tests also work in GOPATH mode
  91. env:
  92. GO111MODULE: off
  93. run: |
  94. go get -d .
  95. go test -v ./...
  96. - name: Code coverage
  97. uses: codecov/codecov-action@v1
  98. with:
  99. file: ./${{ env.WORKING_DIR }}/coverage.txt
  100. test-windows:
  101. runs-on: windows-2019
  102. strategy:
  103. matrix:
  104. go: ['1.13', '1.14']
  105. steps:
  106. - name: Update go version
  107. uses: actions/setup-go@v2
  108. with:
  109. go-version: ${{ matrix.go }}
  110. # - name: Make sure line endings work correctly on Windows
  111. # run: |
  112. # git config --global core.eol lf
  113. # git config --global core.autocrlf input
  114. - name: Checkout the repo
  115. uses: actions/checkout@v2
  116. with:
  117. path: ${{ env.WORKING_DIR }}
  118. - name: Fetch Windows dependency
  119. uses: crazy-max/ghaction-chocolatey@v1
  120. with:
  121. args: install graphviz
  122. - name: Run the test
  123. run: |
  124. go env
  125. go build github.com/google/pprof
  126. go test -v ./...
  127. working-directory: ${{ env.WORKING_DIR }}