test.yml 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. on:
  2. push:
  3. branches:
  4. - master
  5. - ci-test
  6. pull_request:
  7. branches:
  8. - master
  9. # Note that a full "go test" is quite heavy,
  10. # as it runs many builds under the hood.
  11. # The default -timeout=10m can be hit by the hosted runners.
  12. #
  13. # Also note that we don't use actions/cache for Go on purpose.
  14. # Caching GOMODCACHE wouldn't help much, as we have few deps.
  15. # Caching GOCACHE would do more harm than good,
  16. # as the tests redo most of their work if the garble version changes,
  17. # and the majority of commits or PRs will do so.
  18. name: Test
  19. jobs:
  20. test:
  21. strategy:
  22. matrix:
  23. go-version: [1.18.x]
  24. os: [ubuntu-latest, macos-latest, windows-latest]
  25. runs-on: ${{ matrix.os }}
  26. steps:
  27. - uses: actions/setup-go@v3
  28. with:
  29. go-version: ${{ matrix.go-version }}
  30. - uses: actions/checkout@v3
  31. - name: Test
  32. run: go test -timeout=15m ./...
  33. - name: Test with -race
  34. # macos and windows tend to be a bit slower,
  35. # and it's rare that a race in garble would be OS-specific.
  36. if: matrix.os == 'ubuntu-latest'
  37. run: go test -race -timeout=20m ./...
  38. # Static checks from this point forward. Only run on one Go version and on
  39. # Linux, since it's the fastest platform, and the tools behave the same.
  40. - if: matrix.os == 'ubuntu-latest' && matrix.go-version == '1.18.x'
  41. run: |
  42. go install
  43. ./scripts/check-third-party.sh
  44. - if: matrix.os == 'ubuntu-latest' && matrix.go-version == '1.18.x'
  45. run: ./scripts/crlf-test.sh
  46. - if: matrix.os == 'ubuntu-latest' && matrix.go-version == '1.18.x'
  47. run: diff <(echo -n) <(gofmt -d .)
  48. - if: matrix.os == 'ubuntu-latest' && matrix.go-version == '1.18.x'
  49. run: go vet ./...
  50. - if: matrix.os == 'ubuntu-latest' && matrix.go-version == '1.18.x'
  51. uses: dominikh/staticcheck-action@v1
  52. with:
  53. version: "2022.1.1"
  54. install-go: false
  55. # We don't care about GOARCH=386 particularly,
  56. # but it helps ensure we support 32-bit hosts and targets well.
  57. # TODO: use CGO_ENABLED=1 once we figure out how to install gcc-multilib,
  58. # and once gotooltest forwards the value of CGO_ENABLED to the scripts.
  59. test-386:
  60. runs-on: ubuntu-latest
  61. env:
  62. GOARCH: 386
  63. steps:
  64. - uses: actions/setup-go@v3
  65. with:
  66. go-version: 1.18.x
  67. - uses: actions/checkout@v3
  68. - name: Test
  69. run: go test -timeout=15m ./...
  70. test-gotip:
  71. runs-on: ubuntu-latest
  72. steps:
  73. - name: Install Go
  74. env:
  75. GO_COMMIT: f32519e5fbcf1b12f9654a6175e5e72b09ae8f3a # 2022-07-30
  76. run: |
  77. cd $HOME
  78. mkdir $HOME/gotip
  79. cd $HOME/gotip
  80. wget -O gotip.tar.gz https://go.googlesource.com/go/+archive/${GO_COMMIT}.tar.gz
  81. tar -xf gotip.tar.gz
  82. echo "devel go1.19-${GO_COMMIT}" >VERSION
  83. cd src
  84. # GOGC=off helps Go build about 20% faster, if we can spare memory.
  85. GOGC=off ./make.bash
  86. echo "GOROOT=$HOME/gotip" >>$GITHUB_ENV
  87. echo "$HOME/gotip/bin" >>$GITHUB_PATH
  88. - uses: actions/checkout@v3
  89. - name: Test
  90. run: go test -timeout=15m ./...