This repository has been archived by the owner on Dec 20, 2023. It is now read-only.
forked from getsentry/sentry-go
-
Notifications
You must be signed in to change notification settings - Fork 0
120 lines (120 loc) · 3.67 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
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
name: Test
on:
push:
branches:
- master
- release/**
pull_request:
permissions:
contents: read
defaults:
run:
shell: bash
concurrency:
group: test-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
name: Module Mode
runs-on: ${{ matrix.os }}-latest
env:
GO111MODULE: "on"
GOFLAGS: "-mod=readonly"
steps:
- uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go }}
- uses: actions/checkout@v3
- uses: actions/cache@v2
with:
# In order:
# * Module download cache
# * Build cache (Linux)
# * Build cache (Mac)
# * Build cache (Windows)
path: |
~/go/pkg/mod
~/.cache/go-build
~/Library/Caches/go-build
%LocalAppData%\go-build
key: ${{ runner.os }}-go-${{ matrix.go }}-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-${{ matrix.go }}-
${{ runner.os }}-go-
- name: Build
run: make build
- name: Vet
run: make vet
- name: Check go.mod Tidiness
run: make mod-tidy
if: ${{ matrix.go == '1.20' }}
- name: Test
run: make test
- name: Test (with race detection)
run: make test-race
# The race detector adds considerable runtime overhead. To save time on
# pull requests, only run this step for a single job in the matrix. For
# all other workflow triggers (e.g., pushes to a release branch) run
# this step for the whole matrix.
if: ${{ github.event_name != 'pull_request' || (matrix.go == '1.20' && matrix.os == 'ubuntu') }}
- name: Collect coverage
run: make test-coverage
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
directory: .coverage
timeout-minutes: 10
strategy:
matrix:
go: ["1.20", "1.19", "1.18"]
os: [ubuntu, windows, macos]
fail-fast: false
# Test the GOPATH mode with the oldest Go version we support
test-gopath:
name: GOPATH Mode
runs-on: ubuntu-latest
env:
# We use two paths in GOPATH.
# The first one is where 'go get' will download dependencies, and
# the second is where sentry-go itself will be checked out.
GOPATH: ${{ github.workspace }}/deps:${{ github.workspace }}/main
GO111MODULE: "off"
WORKDIR: ${{ github.workspace }}/main/src/github.com/getsentry/sentry-go
defaults:
run:
working-directory: ${{ env.WORKDIR }}
steps:
- uses: actions/setup-go@v3
with:
go-version: "1.18"
- uses: actions/checkout@v3
with:
path: ${{ env.WORKDIR }}
# TODO: cache dependencies
# - uses: actions/cache@v2
# with:
# # In order:
# # * GOPATH with dependencies (but without sentry-go)
# # * GOPATH with sentry-go installed package objects (*.a files)
# # * Build cache (Linux)
# path: |
# ${{ github.workspace }}/deps
# ${{ github.workspace }}/main/pkg
# ~/.cache/go-build
# key: gopath-${{ github.ref }}
# restore-keys: |
# gopath-
- name: Remove Unsupported Code
run: |
# Iris requires Module mode, therefore we delete the relevant code to
# skip testing it in GOPATH mode.
rm -vrf ./iris/ ./_examples/iris/
- name: Download Dependencies
run: go get -d -t -v ./...
- name: Build
run: go build ./...
- name: Vet
run: go vet ./...
- name: Test
run: make test-race
timeout-minutes: 10