forked from edgexfoundry/device-opc-ua
-
Notifications
You must be signed in to change notification settings - Fork 0
77 lines (74 loc) · 2.05 KB
/
pr.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
name: Build Test and Scan
on:
pull_request:
types: [opened, synchronize, reopened]
jobs:
build-and-scan:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build the image
uses: docker/build-push-action@v5
with:
tags: device-opcua:${{ github.sha }}
load: true
- name: Scan with Trivy
uses: aquasecurity/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GHCR_TOKEN }}
TRIVY_DISABLE_VEX_NOTICE: "true"
with:
image-ref: device-opcua:${{ github.sha }}
format: table
exit-code: 1
ignore-unfixed: true
hide-progress: true
severity: CRITICAL,HIGH,MEDIUM
output: trivy.txt
- name: Publish Trivy Output to Summary
if: always()
run: |
if [[ -s trivy.txt ]]; then
{
echo "### Trivy Scan Results"
echo ""
echo '```terraform'
cat trivy.txt
echo '```'
} >> $GITHUB_STEP_SUMMARY
fi
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
check-latest: true
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install dependencies
run: |
python3 -m pip install opcua cryptography
- name: Run unit tests
run: |
make test >> test-results.txt
- name: Publish results to summary
if: always()
run: |
if [[ -s test-results.txt ]]; then
{
echo "### Test Results"
echo ""
echo '```sh'
cat test-results.txt
echo '```'
} >> $GITHUB_STEP_SUMMARY
fi