-
Notifications
You must be signed in to change notification settings - Fork 168
121 lines (108 loc) · 3.72 KB
/
tests.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
name: Go Tests
on:
pull_request_target:
types: [opened, synchronize, reopened, labeled]
push:
branches: [ master ]
concurrency:
group: ci-${{ github.ref }}-test
cancel-in-progress: true
jobs:
permission:
if: ${{ github.event_name == 'pull_request_target' }}
runs-on: ubuntu-latest
steps:
- name: Add comment if PR permission failed
if: ${{ !contains(github.event.pull_request.labels.*.name, 'safe PR') }}
uses: actions/github-script@v3
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
github.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: '🔒 Could not start CI tests due to missing *safe PR* label. Please contact a DEDIS maintainer.'
})
- name: Check permission
if: ${{ !contains(github.event.pull_request.labels.*.name, 'safe PR') }}
run: |
echo "::error:: Could not start CI tests due to missing *safe PR* label."
exit 1
test:
if: ${{ github.event_name == 'push' || (github.event_name == 'pull_request_target' && contains(github.event.pull_request.labels.*.name, 'safe PR')) }}
strategy:
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
size: ['64b', '32b']
golang: ['1.21.10', '1.22.3']
exclude:
- os: windows-latest
size: '32b'
- os: macos-latest
size: '32b'
runs-on: ${{ matrix.os }}
env:
DBGSYNCLOG: trace
DBGSYNCON: true
steps:
- name: Set up Go ${{ matrix.golang }}
uses: actions/setup-go@v5
if: ${{ matrix.size == '64b' }}
with:
go-version: ${{ matrix.golang }}
check-latest: false
- name: Check out code into the Go module directory
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
- name: Setup Alpine Linux
uses: jirutka/setup-alpine@v1
if: ${{ matrix.size == '32b' }}
with:
arch: x86
packages: >
make
git
gcc
musl-dev
- name: Test without coverage (Windows, MacOS)
if: ${{ matrix.os == 'macos-latest' || matrix.os == 'windows-latest' }}
run: make test
- name: Test without coverage (Ubuntu x86)
if: ${{ matrix.size == '32b' }}
run: |
cd ..
wget -O go.tgz -nv https://go.dev/dl/go${{matrix.golang}}.linux-386.tar.gz
tar -xzf go.tgz
export PATH=$PATH:$(pwd)/go/bin
cd kyber
make test
shell: alpine.sh {0}
- name: Test with coverage
if: ${{ matrix.os == 'ubuntu-latest' && matrix.size == '64b' }}
run: make coverage
- name: SonarCloud scan
if: ${{ matrix.os == 'ubuntu-latest' && matrix.size == '64b' }}
uses: sonarsource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
with:
args: >
-Dsonar.organization=dedis
-Dsonar.projectKey=dedis_kyber
-Dsonar.go.tests.reportPaths=report.json
-Dsonar.go.coverage.reportPaths=profile.cov
-Dsonar.pullrequest.key=${{ github.event.number }}
-Dsonar.pullrequest.branch=${{ github.head_ref }}
-Dsonar.pullrequest.base=${{ github.event.pull_request.base }}
-Dsonar.c.file.suffixes=-
-Dsonar.cpp.file.suffixes=-
-Dsonar.objc.file.suffixes=-
- name: Send coverage
if: ${{ github.event_name == 'push' && matrix.os == 'ubuntu-latest' && matrix.size == '64b' }}
uses: shogo82148/actions-goveralls@v1
with:
path-to-profile: profile.cov