-
-
Notifications
You must be signed in to change notification settings - Fork 0
125 lines (114 loc) · 4.37 KB
/
test.yml
File metadata and controls
125 lines (114 loc) · 4.37 KB
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
# SPDX-FileCopyrightText: 2026 The geany contributors.
# SPDX-License-Identifier: MPL-2.0
name: Tests
on:
push:
branches:
- master
pull_request:
branches:
- master
# Declare default permissions as read-only.
permissions: read-all
jobs:
Test:
strategy:
matrix:
go-version:
- "stable"
platform:
#- macos-latest
- ubuntu-latest
#- windows-latest
runs-on: ${{matrix.platform}}
steps:
- name: Harden Runner
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
with:
egress-policy: audit
- name: Install Go
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
with:
go-version: ${{matrix.go-version}}
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 1
- name: Test
run: go tool gotestsum --junitfile junit.xml -- -race -v `go list ./...` --covermode=atomic --coverpkg=./... --coverprofile=coverage.txt
- name: Upload test results to Codecov
if: ${{ !cancelled() }}
uses: codecov/codecov-action@e79a6962e0d4c0c17b229090214935d2e33f8354 # v6.0.1
with:
report_type: test_results
token: ${{ secrets.CODECOV_TOKEN }}
- name: Coverage
run: go tool cover -func=coverage.txt
- name: Upload coverage to Codecov
uses: codecov/codecov-action@e79a6962e0d4c0c17b229090214935d2e33f8354 # v6.0.1
with:
token: ${{ secrets.CODECOV_TOKEN }}
# This action is mainly composed of snippets of github.com/jidicula/go-fuzz-action
# FuzzTest:
# strategy:
# matrix:
# go-version:
# - "stable"
# platform:
# #- macos-latest
# - ubuntu-latest
# #- windows-latest
# packages:
# - ./
# runs-on: ${{ matrix.platform }}
# steps:
# - name: Harden Runner
# uses: step-security/harden-runner@6c3c2f2c1c457b00c10c4848d6f5491db3b629df # v2.18.0
# with:
# egress-policy: audit
#
# - name: Install Go
# uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
# with:
# go-version: ${{matrix.go-version}}
#
# - name: Checkout
# uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
# with:
# fetch-depth: 1
#
# - name: Run Fuzz Test
# shell: bash
# run: go test ${{ matrix.packages }} -fuzz="Fuzz" -fuzztime="30s" -fuzzminimizetime="10s"
#
# - name: Upload fuzz failure seed corpus as run artifact
# if: failure()
# uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
# with:
# name: testdata
# path: testdata
#
# - run: echo "EVENT NAME IS ${{ github.event_name }}"
# if: failure()
# shell: bash
#
# - name: Save PR head commit SHA
# if: failure() && github.event_name == 'pull_request'
# shell: bash
# run: |
# SHA="${{ github.event.pull_request.head.sha }}"
# echo "SHA=$SHA" >> $GITHUB_ENV
#
# - name: Save latest commit SHA if not PR
# if: failure() && github.event_name != 'pull_request'
# shell: bash
# run: echo "SHA=${{ github.sha }}" >> $GITHUB_ENV
#
# - name: Output message
# if: failure()
# shell: bash
# run: |
# MESSAGE='Fuzz test failed on commit ${{ env.SHA }}. To troubleshoot locally, use the [GitHub CLI](https://cli.github.com) to download the seed corpus with\n```\ngh run download ${{ github.run_id }} -n testdata\n```'
# DEEPLINK="https://github.com/${{ github.repository }}/commit/${{ env.SHA }}"
# echo -e "${MESSAGE/${{ env.SHA }}/$DEEPLINK}"
# echo -e "${MESSAGE/${{ env.SHA }}/[${GITHUB_SHA:0:8}]($DEEPLINK)}" >> $GITHUB_STEP_SUMMARY