-
-
Notifications
You must be signed in to change notification settings - Fork 10
executable file
·169 lines (154 loc) · 5.04 KB
/
go.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
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
name: Go
on:
push:
branches: [ master ]
# Sequence of patterns matched against refs/tags
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
pull_request:
branches: [ master ]
# types: [assigned, opened, synchronize, reopened]
#on: [push, pull_request]
jobs:
test:
strategy:
matrix:
go-version: [ 1.22.x ]
#os: [ubuntu-latest, macos-latest, windows-latest]
os: [ ubuntu-latest ]
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
- name: Checkout code
uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Test
run: |
for GOOS in $(go tool dist list|awk -F'/' '{print $1}'|sort -u); do
echo -e "\n\nTESTING FOR $GOOS ...\n"
go mod tidy
go test ./...
done
coverage:
#needs: test
env:
COVERALLS_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
runs-on: ubuntu-latest
steps:
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: 1.22.x
- name: Checkout code
uses: actions/checkout@v4
#with:
# path: ./src/github.com/${{ github.repository }}
- uses: actions/cache@v4
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Test & Coverage
run: go mod tidy && go test -v -coverprofile=profile.cov ./...
- name: Send coverage
uses: shogo82148/actions-goveralls@v1
with:
path-to-profile: profile.cov
parallel: true
# build:
# #env:
# # GOPATH: ${{ github.workspace }}
# # GO111MODULE: off
# runs-on: ubuntu-latest
# steps:
# - name: Install Go
# uses: actions/setup-go@v5
# with:
# go-version: 1.14.x
# - name: Checkout code
# uses: actions/checkout@v4
# #with:
# # path: ./src/github.com/${{ github.repository }}
# - uses: actions/cache@v4
# with:
# path: ~/go/pkg/mod
# key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
# restore-keys: |
# ${{ runner.os }}-go-
# - name: Build
# run: |
# for dir in cmdr std; do
# for GOOS in windows linux darwin; do
# for GOARCH in amd64; do
# suf=; if [[ $GOOS == "windows" ]]; then suf=".exe"; fi
# go build -v -o bin/tcp-tool-$dir-$GOOS-$GOARCH$suf ./examples/$dir
# gzip bin/tcp-tool-$dir-$GOOS-$GOARCH$suf
# done
# done
# done
# - name: upload artifacts
# uses: actions/upload-artifact@master
# if: startsWith(github.ref, 'refs/tags/v')
# with:
# name: binaries
# path: bin/
#
# - name: Upload binaries to release
# uses: svenstaro/upload-release-action@v2
# if: startsWith(github.ref, 'refs/tags/v')
# with:
# repo_token: ${{ secrets.GITHUB_TOKEN }}
# file: bin/*
# tag: ${{ github.ref }}
# overwrite: true
# file_glob: true
# #body:
## - name: Create Release
## id: create_release
## uses: actions/create-release@v1
## env:
## GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
## with:
## tag_name: ${{ github.ref }}
## release_name: Release ${{ github.ref }}
## draft: false
## prerelease: false
## - name: Upload Release Asset
## id: upload-release-asset
## uses: actions/upload-release-asset@v1
## env:
## GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
## with:
## upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
## asset_path: bin/*
## asset_name: my-artifact.zip
## asset_content_type: application/zip
# notifies coveralls that all test jobs are finished
finish-coverage:
name: Finish Coverage
needs: coverage
runs-on: ubuntu-latest
steps:
- uses: shogo82148/actions-goveralls@v1
with:
parallel-finished: true
do-release:
permissions: write-all # this is the FIX
runs-on: ubuntu-latest
needs: coverage
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')