-
Notifications
You must be signed in to change notification settings - Fork 26
77 lines (64 loc) · 1.9 KB
/
test.yml
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
on: [push, pull_request]
name: Test
jobs:
test:
timeout-minutes: 30
strategy:
matrix:
go-version: [1.21.x, 1.22.x]
platform: [ubuntu-latest]
fail-fast: false
runs-on: ${{ matrix.platform }}
env:
GO111MODULE: on
steps:
- name: Install Go
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go-version }}
- name: Go environment
run: |
go version
go env
echo PATH is $PATH
shell: bash
- name: Checkout code
uses: actions/checkout@v3
with:
go-version: ${{ matrix.go-version }}
- name: Check gofmt
run: |
gofmt -l .
test `gofmt -l . | wc -l` = 0
shell: bash
- name: Install gopls
run: go install golang.org/x/tools/gopls@latest
working-directory: /
- name: Install pyls on unix
if: matrix.platform != 'windows-latest'
run: sudo python3 -m pip install 'python-language-server[yapf]'
- name: Install pyls on windows
if: matrix.platform == 'windows-latest'
run: pip install 'python-language-server[yapf]'
- name: Check if 'go install' modified go.mod file
run: git diff --exit-code
- name: Test on unix
if: matrix.platform != 'windows-latest'
run: |
export PATH=${PATH}:$(go env GOPATH)/bin
go test -race -v ./...
shell: bash
- name: Test on windows
if: matrix.platform == 'windows-latest'
run: |
# 8.3 filenames causes issues. See
# https://github.com/actions/virtual-environments/issues/712
$env:TMP = "$env:USERPROFILE\AppData\Local\Temp"
$env:TEMP = "$env:USERPROFILE\AppData\Local\Temp"
$env:path += ";C:\Users\runneradmin\go\bin"
go test -race -v ./...
- name: Cross compile for plan9
if: matrix.platform == 'ubuntu-latest'
env:
GOOS: plan9
run: go build ./...