...
1name: CI
2
3on:
4 pull_request:
5 branches: [ master ]
6
7jobs:
8
9 build:
10 name: Build
11 strategy:
12 matrix:
13 go-version: [1.21.x, 1.20.x]
14 platform: [ubuntu-20.04, macos-latest]
15 runs-on: ${{ matrix.platform }}
16 env:
17 GO111MODULE: on
18 GOPATH: ${{ github.workspace }}
19 DISPLAY: ":99.0"
20 EGL_PLATFORM: "x11"
21 defaults:
22 run:
23 working-directory: ${{ env.GOPATH }}/src/gonum.org/v1/plot
24
25 steps:
26 - name: Install Go
27 uses: actions/setup-go@v3
28 with:
29 go-version: ${{ matrix.go-version }}
30
31 - name: Checkout code
32 uses: actions/checkout@v3
33 with:
34 path: ${{ env.GOPATH }}/src/gonum.org/v1/plot
35 fetch-depth: 1
36
37 - name: Cache-Go
38 uses: actions/cache@v3
39 with:
40 # In order:
41 # * Module download cache
42 # * Build cache (Linux)
43 # * Build cache (Mac)
44 # * Build cache (Windows)
45 path: |
46 ~/go/pkg/mod
47 ~/.cache/go-build
48 ~/Library/Caches/go-build
49 '%LocalAppData%\go-build'
50 key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
51 restore-keys: |
52 ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
53
54 - name: Install Linux packages
55 if: matrix.platform == 'ubuntu-20.04'
56 run: |
57 sudo apt-get update
58 sudo apt-get install -qq gcc pkg-config libwayland-dev libx11-dev libx11-xcb-dev libxkbcommon-x11-dev libgles2-mesa-dev libegl1-mesa-dev libffi-dev libxcursor-dev libvulkan-dev xvfb xdotool
59 # start a virtual frame buffer
60 Xvfb :99 -screen 0 1920x1024x24 &
61
62 - name: Check copyrights+formatting
63 run: |
64 # Required for format check.
65 go install golang.org/x/tools/cmd/goimports@latest
66 # Required for imports check.
67 go install gonum.org/v1/tools/cmd/check-imports@latest
68 # Required for copyright header check.
69 go install gonum.org/v1/tools/cmd/check-copyright@latest
70
71 ./.ci/check-copyright.sh
72 ./.ci/check-formatting.sh
73
74 - name: Build
75 run: |
76 go install -v ./...
77
78 - name: Test Linux
79 if: matrix.platform == 'ubuntu-20.04'
80 run: |
81 go test -v ./...
82 ./.ci/check-imports.sh
83 ./.ci/test-coverage.sh
84
85 - name: Test Windows
86 if: matrix.platform == 'windows-latest'
87 run: |
88 go test -v ./...
89
90 - name: Test Darwin
91 if: matrix.platform == 'macos-latest'
92 run: |
93 go test -v ./...
94
95 - name: Upload-Coverage
96 if: matrix.platform == 'ubuntu-20.04'
97 uses: codecov/codecov-action@v2
View as plain text