-
Notifications
You must be signed in to change notification settings - Fork 1
49 lines (43 loc) · 1.3 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
---
name: Test
on: # yamllint disable-line rule:truthy
workflow_dispatch:
workflow_call:
secrets:
SONAR_TOKEN:
required: false
outputs:
workflow_output:
description: "Unit tests output"
value: ${{ jobs.go_test.outputs.test_output_failure }}
jobs:
go_test:
name: HydraGon
runs-on: ubuntu-latest
outputs:
test_output_failure: ${{ steps.run_tests_failure.outputs.test_output }}
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: 1.21.x
- name: Install Dependencies
run: ./setup-ci.sh
- name: Run Go Test
run: make test
- name: Run Go Test Failed
if: failure()
id: run_tests_failure
run: echo "test_output=false" >> $GITHUB_OUTPUT
- name: SonarCloud Scan
if: ${{ env.HAVE_SONAR_TOKEN == 'true' }}
uses: SonarSource/sonarcloud-github-action@master
env:
HAVE_SONAR_TOKEN: ${{ secrets.SONAR_TOKEN != '' }}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}