-
Notifications
You must be signed in to change notification settings - Fork 12
120 lines (106 loc) · 3.45 KB
/
go-basic-tests.yaml
File metadata and controls
120 lines (106 loc) · 3.45 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
name: Basic-Go-Testing
on:
workflow_call:
inputs:
GO_VERSION:
required: true
type: string
GO111MODULE:
required: false
type: string
CGO_ENABLED:
required: false
type: number
default: 1
BUILD_PATH:
required: false
type: string
default: "./..."
UNIT_TESTS_PATH:
required: false
type: string
default: "./..."
FAILEDTHRESHOLD:
required: false
type: number
default: 50
# TEST_MULTI_ENVIRONMENTS:
# required: false
# type: boolean
# default: true
secrets:
SNYK_TOKEN:
required: false
GITGUARDIAN_API_KEY:
required: false
jobs:
Check-secret:
name: check if secrets are set
runs-on: ubuntu-latest
outputs:
run-gitgardian: ${{ steps.check-secret-set.outputs.is-gitgardian-set }}
run-snyk: ${{ steps.check-secret-set.outputs.is-snyk-set }}
steps:
- name: Check whether unity activation requests should be done
id: check-secret-set
env:
GITGUARDIAN_API_KEY: ${{ secrets.GITGUARDIAN_API_KEY }}
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
run: |
echo "is-gitgardian-set=${{ env.GITGUARDIAN_API_KEY != '' }}" >> $GITHUB_OUTPUT
echo "is-snyk-set=${{ env.SNYK_TOKEN != '' }}" >> $GITHUB_OUTPUT
# Setup-Environment:
# runs-on: ubuntu-latest
# outputs:
# matrix: ${{ steps.set-matrix.outputs.matrix }}
# steps:
# - id: set-matrix
# env:
# TEST_MULTI_ENVIRONMENTS: ${{ inputs.TEST_MULTI_ENVIRONMENTS }}
# run: |
# if [ ${{ env.TEST_MULTI_ENVIRONMENTS }} ]; then
# echo "matrix=[\"ubuntu-20.04\", \"macos-latest\", \"windows-latest\"]" >> $GITHUB_OUTPUT
# else
# echo "matrix=[\"ubuntu-20.04\"]" >> $GITHUB_OUTPUT
# fi
Environment-Test:
name: Create cross-platform build
# needs: [ Setup-Environment ]
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
CGO_ENABLED: ${{ inputs.CGO_ENABLED }}
# strategy:
# matrix:
# os: ${{ fromJSON(needs.Setup-Environment.outputs.matrix) }}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: actions/setup-go@v5
name: Setup Go
with:
go-version: '${{ inputs.GO_VERSION }}'
- name: Ensure ig is installed
run: curl https://github.com/inspektor-gadget/inspektor-gadget/releases/download/v0.48.1/ig_0.48.1_amd64.deb -LO && sudo dpkg -i ig_0.48.1_amd64.deb
- name: Build gadgets
run: make gadgets
- name: Test race conditions
if: ${{ env.CGO_ENABLED == 1 }}
run: go test -exec sudo -v -race $(go list ${{ inputs.UNIT_TESTS_PATH }} | grep -v /e2e)
- name: Test without race conditions
if: ${{ env.CGO_ENABLED != 1 }}
run: go test -exec sudo -v $(go list ${{ inputs.UNIT_TESTS_PATH }} | grep -v /e2e)
- name: Initialize CodeQL
continue-on-error: true
uses: github/codeql-action/init@v2
with:
languages: go
- name: Autobuild
continue-on-error: true
uses: github/codeql-action/autobuild@v2
- name: Perform CodeQL Analysis
continue-on-error: true
uses: github/codeql-action/analyze@v2
# - name: Test go build
# run: go build -v ${{ inputs.BUILD_PATH }}