tests.yml 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. name: CI
  2. on:
  3. push:
  4. branches:
  5. - master
  6. - staging-client
  7. - staging-server
  8. jobs:
  9. run_tests:
  10. strategy:
  11. fail-fast: false
  12. matrix:
  13. os: [ "ubuntu" ]
  14. go: [ "1.14.12" ]
  15. test-type: [ "detector", "coverage", "memory" ]
  16. runs-on: ${{ matrix.os }}-latest
  17. name: psiphon-tunnel-core ${{ matrix.test-type }} tests on ${{ matrix.os}}, Go ${{ matrix.go }}
  18. env:
  19. GOPATH: ${{ github.workspace }}/go
  20. steps:
  21. - name: Clone repository
  22. uses: actions/checkout@v2
  23. with:
  24. path: ${{ github.workspace }}/go/src/github.com/Psiphon-Labs/psiphon-tunnel-core
  25. - name: Install Go
  26. uses: actions/setup-go@v2
  27. with:
  28. go-version: ${{ matrix.go }}
  29. - name: Install networking components
  30. run: |
  31. sudo apt-get update
  32. sudo apt-get install libnetfilter-queue-dev
  33. sudo apt-get install conntrack
  34. - name: Install coverage tools
  35. if: ${{ matrix.test-type == 'coverage' }}
  36. run: |
  37. go get github.com/axw/gocov/gocov
  38. go get github.com/modocache/gover
  39. go get github.com/mattn/goveralls
  40. go get golang.org/x/tools/cmd/cover
  41. - name: Check environment
  42. run: |
  43. echo "GitHub workspace: $GITHUB_WORKSPACE"
  44. echo "Working directory: `pwd`"
  45. echo "GOROOT: $GOROOT"
  46. echo "GOPATH: $GOPATH"
  47. echo "Go version: `go version`"
  48. - name: Pave config files
  49. env:
  50. CONTROLLER_TEST_CONFIG: ${{ secrets.CONTROLLER_TEST_CONFIG }}
  51. run: |
  52. cd ${{ github.workspace }}/go/src/github.com/Psiphon-Labs/psiphon-tunnel-core
  53. echo "$CONTROLLER_TEST_CONFIG" > ./psiphon/controller_test.config
  54. # TODO: fix and re-enable test
  55. # sudo -E env "PATH=$PATH" go test -v -race ./psiphon/common/tun
  56. - name: Run tests with data race detector
  57. if: ${{ matrix.test-type == 'detector' }}
  58. run: |
  59. cd ${{ github.workspace }}/go/src/github.com/Psiphon-Labs/psiphon-tunnel-core
  60. go test -v -race ./psiphon/common
  61. go test -v -race ./psiphon/common/accesscontrol
  62. go test -v -race ./psiphon/common/crypto/ssh
  63. go test -v -race ./psiphon/common/fragmentor
  64. go test -v -race ./psiphon/common/obfuscator
  65. go test -v -race ./psiphon/common/osl
  66. sudo -E env "PATH=$PATH" go test -v -race -tags "PSIPHON_RUN_PACKET_MANIPULATOR_TEST" ./psiphon/common/packetman
  67. go test -v -race ./psiphon/common/parameters
  68. go test -v -race ./psiphon/common/protocol
  69. go test -v -race ./psiphon/common/quic
  70. go test -v -race ./psiphon/common/tactics
  71. go test -v -race ./psiphon/common/values
  72. go test -v -race ./psiphon/common/wildcard
  73. go test -v -race ./psiphon/transferstats
  74. sudo -E env "PATH=$PATH" go test -v -race -tags "PSIPHON_RUN_PACKET_MANIPULATOR_TEST" ./psiphon/server
  75. go test -v -race ./psiphon/server/psinet
  76. go test -v -race ./psiphon
  77. go test -v -race ./ClientLibrary/clientlib
  78. go test -v -race ./Server/logging/analysis
  79. # TODO: fix and re-enable test
  80. # sudo -E env "PATH=$PATH" go test -v -covermode=count -coverprofile=tun.coverprofile ./psiphon/common/tun
  81. - name: Run tests with coverage
  82. env:
  83. COVERALLS_TOKEN: ${{ secrets.COVERALLS_TOKEN }}
  84. if: ${{ matrix.test-type == 'coverage' && env.COVERALLS_TOKEN != '' }}
  85. run: |
  86. cd ${{ github.workspace }}/go/src/github.com/Psiphon-Labs/psiphon-tunnel-core
  87. go test -v -covermode=count -coverprofile=common.coverprofile ./psiphon/common
  88. go test -v -covermode=count -coverprofile=accesscontrol.coverprofile ./psiphon/common/accesscontrol
  89. go test -v -covermode=count -coverprofile=ssh.coverprofile ./psiphon/common/crypto/ssh
  90. go test -v -covermode=count -coverprofile=fragmentor.coverprofile ./psiphon/common/fragmentor
  91. go test -v -covermode=count -coverprofile=obfuscator.coverprofile ./psiphon/common/obfuscator
  92. go test -v -covermode=count -coverprofile=osl.coverprofile ./psiphon/common/osl
  93. sudo -E env "PATH=$PATH" go test -v -covermode=count -coverprofile=packetman.coverprofile -tags "PSIPHON_RUN_PACKET_MANIPULATOR_TEST" ./psiphon/common/packetman
  94. go test -v -covermode=count -coverprofile=parameters.coverprofile ./psiphon/common/parameters
  95. go test -v -covermode=count -coverprofile=protocol.coverprofile ./psiphon/common/protocol
  96. go test -v -covermode=count -coverprofile=quic.coverprofile ./psiphon/common/quic
  97. go test -v -covermode=count -coverprofile=tactics.coverprofile ./psiphon/common/tactics
  98. go test -v -covermode=count -coverprofile=values.coverprofile ./psiphon/common/values
  99. go test -v -covermode=count -coverprofile=wildcard.coverprofile ./psiphon/common/wildcard
  100. go test -v -covermode=count -coverprofile=transferstats.coverprofile ./psiphon/transferstats
  101. sudo -E env "PATH=$PATH" go test -v -covermode=count -coverprofile=server.coverprofile -tags "PSIPHON_RUN_PACKET_MANIPULATOR_TEST" ./psiphon/server
  102. go test -v -covermode=count -coverprofile=psinet.coverprofile ./psiphon/server/psinet
  103. go test -v -covermode=count -coverprofile=psiphon.coverprofile ./psiphon
  104. go test -v -covermode=count -coverprofile=clientlib.coverprofile ./ClientLibrary/clientlib
  105. go test -v -covermode=count -coverprofile=analysis.coverprofile ./Server/logging/analysis
  106. $GOPATH/bin/gover
  107. $GOPATH/bin/goveralls -coverprofile=gover.coverprofile -service=github -repotoken "$COVERALLS_TOKEN"
  108. - name: Run memory tests
  109. if: ${{ matrix.test-type == 'memory' }}
  110. run: |
  111. cd ${{ github.workspace }}/go/src/github.com/Psiphon-Labs/psiphon-tunnel-core
  112. go test -v ./psiphon/memory_test -run TestReconnectTunnel
  113. go test -v ./psiphon/memory_test -run TestRestartController