github.com/psiphon-labs/psiphon-tunnel-core@v2.0.28+incompatible/.github/workflows/tests.yml (about)

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