Procházet zdrojové kódy

Use Github Action to replace Travis and AppVeyor for CI. (#541)

Add Github Actions.

Co-authored-by: Kalyana Chadalavada <kalyanac@users.noreply.github.com>
Garrett Wang před 4 roky
rodič
revize
eab82f03b7
No account linked to committer's email address
2 změnil soubory, kde provedl 145 přidání a 0 odebrání
  1. 1
    0
      .gitattributes
  2. 144
    0
      .github/workflows/ci.yaml

+ 1
- 0
.gitattributes Zobrazit soubor

@@ -0,0 +1 @@
1
+* text eol=lf

+ 144
- 0
.github/workflows/ci.yaml Zobrazit soubor

@@ -0,0 +1,144 @@
1
+name: ci
2
+on: 
3
+  push:
4
+    branches:
5
+      - master
6
+  pull_request:
7
+env:
8
+  GOPATH: ${{ github.workspace }}
9
+  WORKING_DIR: ./src/github.com/google/pprof/
10
+jobs:
11
+  test-mac:
12
+    runs-on: ${{ matrix.os }} 
13
+    continue-on-error: true
14
+    defaults:
15
+      run:
16
+        working-directory: ${{ env.WORKING_DIR }}
17
+    strategy:
18
+      matrix:
19
+        go: ['1.13', '1.14']
20
+        os: ['macos-10.15']
21
+        xcode-version: ['11.5', '10.3']
22
+    steps:
23
+      - name: Update go version
24
+        uses: actions/setup-go@v2
25
+        with:
26
+          go-version: ${{ matrix.go }}
27
+
28
+      - name: Checkout the repo
29
+        uses: actions/checkout@v2
30
+        with:
31
+          path: ${{ env.WORKING_DIR }}
32
+
33
+      - name: Set up Xcode
34
+        uses: maxim-lobanov/setup-xcode@1.0
35
+        with:
36
+          xcode-version: ${{ matrix.xcode-version }}
37
+
38
+      - name: Fetch dependencies
39
+        # Do not let tools interfere with the main module's go.mod.
40
+        env: 
41
+          GO111MODULE: off         
42
+        run: |
43
+          brew install graphviz
44
+          go get -u golang.org/x/lint/golint honnef.co/go/tools/cmd/...
45
+
46
+      - name: Run the script 
47
+        run: |
48
+          gofmtdiff=$(gofmt -s -d .) && if [ -n "$gofmtdiff" ]; then printf 'gofmt -s found:\n%s\n' "$gofmtdiff" && exit 1; fi
49
+          golintlint=$(golint ./...) && if [ -n "$golintlint" ]; then printf 'golint found:\n%s\n' "$golintlint" && exit 1; fi
50
+          go vet -all ./...
51
+          ./test.sh
52
+
53
+      - name: Check to make sure that tests also work in GOPATH mode
54
+        env: 
55
+          GO111MODULE: off
56
+        run: |
57
+          go get -d .
58
+          go test -v ./...
59
+
60
+      - name: Code coverage
61
+        uses: codecov/codecov-action@v1
62
+        with:
63
+          file: ./coverage.txt
64
+
65
+  test-linux:
66
+    runs-on: ${{ matrix.os }}
67
+    continue-on-error: true
68
+    defaults:
69
+      run:
70
+        working-directory: ${{ env.WORKING_DIR }} 
71
+    strategy:
72
+      matrix:
73
+        go: ['1.13', '1.14']
74
+        os: ['ubuntu-20.04', 'ubuntu-18.04', 'ubuntu-16.04'] 
75
+    steps:
76
+      - name: Update go version
77
+        uses: actions/setup-go@v2
78
+        with:
79
+          go-version: ${{ matrix.go }}
80
+
81
+      - name: Checkout the repo
82
+        uses: actions/checkout@v2
83
+        with:
84
+          path: ${{ env.WORKING_DIR }}
85
+
86
+      - name: Fetch dependencies
87
+        # Do not let tools interfere with the main module's go.mod.
88
+        env: 
89
+          GO111MODULE: off         
90
+        run: |
91
+          sudo apt-get install graphviz
92
+          go get -u golang.org/x/lint/golint honnef.co/go/tools/cmd/...
93
+
94
+      - name: Run the script 
95
+        run: |
96
+          gofmtdiff=$(gofmt -s -d .) && if [ -n "$gofmtdiff" ]; then printf 'gofmt -s found:\n%s\n' "$gofmtdiff" && exit 1; fi
97
+          golintlint=$(golint ./...) && if [ -n "$golintlint" ]; then printf 'golint found:\n%s\n' "$golintlint" && exit 1; fi
98
+          go vet -all ./...
99
+          ./test.sh
100
+
101
+      - name: Check to make sure that tests also work in GOPATH mode
102
+        env: 
103
+          GO111MODULE: off
104
+        run: |
105
+          go get -d .
106
+          go test -v ./...
107
+
108
+      - name: Code coverage
109
+        uses: codecov/codecov-action@v1
110
+        with:
111
+          file: ./${{ env.WORKING_DIR }}/coverage.txt
112
+
113
+  test-windows:
114
+    runs-on: windows-2019
115
+    strategy:
116
+      matrix:
117
+        go: ['1.13', '1.14']
118
+    steps:
119
+      - name: Update go version
120
+        uses: actions/setup-go@v2
121
+        with:
122
+          go-version: ${{ matrix.go }}
123
+      
124
+          # - name: Make sure line endings work correctly on Windows
125
+          #    run: |
126
+          #      git config --global core.eol lf
127
+          #      git config --global core.autocrlf input
128
+
129
+      - name: Checkout the repo
130
+        uses: actions/checkout@v2
131
+        with:
132
+          path: ${{ env.WORKING_DIR }}
133
+
134
+      - name: Fetch Windows dependency
135
+        uses: crazy-max/ghaction-chocolatey@v1
136
+        with:
137
+          args: install graphviz
138
+
139
+      - name: Run the test
140
+        run: |
141
+          go env
142
+          go build github.com/google/pprof
143
+          go test -v ./...
144
+        working-directory: ${{ env.WORKING_DIR }}