]> Sergey Matveev's repositories - btrtrc.git/blob - .github/workflows/go.yml
go CI: Use common action and parallel jobs
[btrtrc.git] / .github / workflows / go.yml
1 name: Go
2
3 on: [push, pull_request]
4
5 jobs:
6
7   test:
8     runs-on: ubuntu-latest
9     strategy:
10       matrix:
11         go-version: [ '1.16', '1.17' ]
12       fail-fast: false
13     steps:
14     - uses: actions/checkout@v2
15     - uses: ./.github/actions/go-common
16     - run: go test -race -count 2 ./...
17
18   test-benchmarks:
19     runs-on: ubuntu-latest
20     strategy:
21       matrix:
22         go-version: [ '1.17' ]
23       fail-fast: false
24     steps:
25     - uses: actions/checkout@v2
26     - uses: ./.github/actions/go-common
27     - run: go test -race -run @ -bench . -benchtime 2x ./...
28
29   bench:
30     runs-on: ubuntu-latest
31     strategy:
32       matrix:
33         go-version: [ '1.17' ]
34       fail-fast: false
35     steps:
36     - uses: actions/checkout@v2
37     - uses: ./.github/actions/go-common
38     - run: go test -run @ -bench . ./...
39
40   test-386:
41     runs-on: ubuntu-latest
42     strategy:
43       matrix:
44         go-version: [ '1.16', '1.17' ]
45       fail-fast: false
46     steps:
47     - uses: actions/checkout@v2
48     - uses: ./.github/actions/go-common
49     - run: GOARCH=386 go test ./...
50     - run: GOARCH=386 go test ./... -run @ -bench .
51
52   build-wasm:
53     runs-on: ubuntu-latest
54     strategy:
55       matrix:
56         go-version: [ '1.16', '1.17' ]
57       fail-fast: false
58     steps:
59     - uses: actions/checkout@v2
60     - uses: ./.github/actions/go-common
61     - name: Some packages compile for WebAssembly
62       run: GOOS=js GOARCH=wasm go build -v . ./storage ./tracker/...
63
64   torrentfs:
65     runs-on: ubuntu-latest
66     strategy:
67       matrix:
68         go-version: [ '1.17' ]
69       fail-fast: false
70     steps:
71     - uses: actions/checkout@v2
72     - uses: ./.github/actions/go-common
73     - name: Install godo
74       run: |
75         # Need master for cross-compiling fix
76         go install -v -x github.com/anacrolix/godo@master
77         echo $PATH
78
79     - name: Apt packages
80       run: sudo apt install pv fuse
81
82     - name: torrentfs end-to-end test
83       # Test on 386 for atomic alignment and other bad 64-bit assumptions
84       run: GOARCH=386 fs/test.sh