File: test.yaml

package info (click to toggle)
golang-github-pion-sctp 1.8.6-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bookworm-backports, forky, sid, trixie
  • size: 888 kB
  • sloc: makefile: 13
file content (174 lines) | stat: -rw-r--r-- 4,787 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
#
# DO NOT EDIT THIS FILE
#
# It is automatically copied from https://github.com/pion/.goassets repository.
# If this repository should have package specific CI config,
# remove the repository name from .goassets/.github/workflows/assets-sync.yml.
#
# If you want to update the shared CI config, send a PR to
# https://github.com/pion/.goassets instead of this repository.
#

name: Test
on:
  push:
    branches:
    - master
  pull_request:
    branches:
    - master

permissions:
  contents: read

jobs:
  test:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        go: ['1.19', '1.18'] # auto-update/supported-go-version-list
      fail-fast: false
    name: Go ${{ matrix.go }}
    steps:
      - uses: actions/checkout@v3

      - uses: actions/cache@v3
        with:
          path: |
            ~/go/pkg/mod
            ~/go/bin
            ~/.cache
          key: ${{ runner.os }}-amd64-go-${{ hashFiles('**/go.sum') }}
          restore-keys: |
            ${{ runner.os }}-amd64-go-

      - name: Setup Go
        uses: actions/setup-go@v3
        with:
          go-version: ${{ matrix.go }}

      - name: Setup go-acc
        run: go install github.com/ory/go-acc@latest

      - name: Set up gotestfmt
        uses: haveyoudebuggedit/gotestfmt-action@v2
        with:
          token: ${{ secrets.GITHUB_TOKEN }} # Avoid getting rate limited

      - name: Run test
        run: |
          TEST_BENCH_OPTION="-bench=."
          if [ -f .github/.ci.conf ]; then . .github/.ci.conf; fi

          set -euo pipefail
          go-acc -o cover.out ./... -- \
            ${TEST_BENCH_OPTION} \
            -json \
            -v -race 2>&1 | grep -v '^go: downloading' | tee /tmp/gotest.log | gotestfmt

      - name: Upload test log
        uses: actions/upload-artifact@v3
        if: always()
        with:
          name: test-log-${{ matrix.go }}
          path: /tmp/gotest.log
          if-no-files-found: error

      - name: Run TEST_HOOK
        run: |
          if [ -f .github/.ci.conf ]; then . .github/.ci.conf; fi
          if [ -n "${TEST_HOOK}" ]; then ${TEST_HOOK}; fi

      - uses: codecov/codecov-action@v3
        with:
          name: codecov-umbrella
          fail_ci_if_error: true
          flags: go

  test-i386:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        go: ['1.19', '1.18'] # auto-update/supported-go-version-list
      fail-fast: false
    name: Go i386 ${{ matrix.go }}
    steps:
      - uses: actions/checkout@v3

      - uses: actions/cache@v3
        with:
          path: |
            ~/go/pkg/mod
            ~/.cache
          key: ${{ runner.os }}-i386-go-${{ hashFiles('**/go.sum') }}
          restore-keys: |
            ${{ runner.os }}-i386-go-

      - name: Run test
        run: |
          mkdir -p $HOME/go/pkg/mod $HOME/.cache
          docker run \
            -u $(id -u):$(id -g) \
            -e "GO111MODULE=on" \
            -e "CGO_ENABLED=0" \
            -v $GITHUB_WORKSPACE:/go/src/github.com/pion/$(basename $GITHUB_WORKSPACE) \
            -v $HOME/go/pkg/mod:/go/pkg/mod \
            -v $HOME/.cache:/.cache \
            -w /go/src/github.com/pion/$(basename $GITHUB_WORKSPACE) \
            i386/golang:${{matrix.go}}-alpine \
            /usr/local/go/bin/go test \
              ${TEST_EXTRA_ARGS:-} \
              -v ./...

  test-wasm:
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
    name: WASM
    steps:
      - uses: actions/checkout@v3

      - name: Use Node.js
        uses: actions/setup-node@v3
        with:
          node-version: '16.x'

      - uses: actions/cache@v3
        with:
          path: |
            ~/go/pkg/mod
            ~/.cache
          key: ${{ runner.os }}-wasm-go-${{ hashFiles('**/go.sum') }}
          restore-keys: |
            ${{ runner.os }}-wasm-go-

      - name: Download Go
        run: curl -sSfL https://dl.google.com/go/go${GO_VERSION}.linux-amd64.tar.gz | tar -C ~ -xzf -
        env:
          GO_VERSION: '1.19' # auto-update/latest-go-version

      - name: Set Go Root
        run: echo "GOROOT=${HOME}/go" >> $GITHUB_ENV

      - name: Set Go Path
        run: echo "GOPATH=${HOME}/go" >> $GITHUB_ENV

      - name: Set Go Path
        run: echo "GO_JS_WASM_EXEC=${GOROOT}/misc/wasm/go_js_wasm_exec" >> $GITHUB_ENV

      - name: Insall NPM modules
        run: yarn install

      - name: Run Tests
        run: |
          if [ -f .github/.ci.conf ]; then . .github/.ci.conf; fi
          GOOS=js GOARCH=wasm $GOPATH/bin/go test \
            -coverprofile=cover.out -covermode=atomic \
            -exec="${GO_JS_WASM_EXEC}" \
            -v ./...

      - uses: codecov/codecov-action@v3
        with:
          name: codecov-umbrella
          fail_ci_if_error: true
          flags: wasm