forked from confidential-containers/cloud-api-adaptor
-
Notifications
You must be signed in to change notification settings - Fork 0
62 lines (59 loc) · 1.74 KB
/
build.yaml
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
# (C) Copyright Confidential Containers Contributors
# # SPDX-License-Identifier: Apache-2.0
#
# Build binary and run unit tests
---
name: build
on:
pull_request:
workflow_dispatch:
jobs:
build_job:
name: build
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
type:
- dev
- release
runner:
- ubuntu-latest
go_version:
- "1.20.7"
steps:
- name: Checkout the pull request code
uses: actions/checkout@v3
- name: Setup Golang version ${{ matrix.go_version }}
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go_version }}
- name: Install build dependencies
if: matrix.type == 'dev'
run: |
sudo apt-get update -y
sudo apt-get install -y libvirt-dev
- name: Build
run: |
# Build the binaries
if [ ${{ matrix.type }} == "release" ]; then
RELEASE_BUILD=true make build
else
RELEASE_BUILD=false make build
fi
- name: Test
if: matrix.type == 'dev'
run: |
go install github.com/jstemmer/[email protected]
export CI="true"
sudo -E env PATH="$PATH" make test | tee tests_report.txt
sudo chmod o+rw tests_report.txt
cat tests_report.txt | $(go env GOPATH)/bin/go-junit-report -set-exit-code > tests_report_junit.xml
shell: bash
- name: Upload tests report
uses: actions/upload-artifact@v3
if: matrix.type == 'dev'
with:
name: tests_report_junit-${{ matrix.runner }}_${{ matrix.go_version }}
path: ${{ github.workspace }}/tests_report_junit.xml
retention-days: 1