-
Notifications
You must be signed in to change notification settings - Fork 0
82 lines (58 loc) · 1.54 KB
/
pull-request.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
name: Pull request
on:
pull_request:
branches:
- master
types:
- ready_for_review
env:
AWS_S3_REGION: ${{ secrets.AWS_S3_REGION }}
SBOM_FILENAME: package-sbom
permissions:
id-token: write
contents: read
packages: read
jobs:
validate:
name: Validate
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
- name: Cache Go modules
uses: actions/cache@v4
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Run build
run: make build
- name: Run vet
run: make vet
- name: Run tests
run: make test
static-analysis:
name: Static Analysis
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Create SBOM
uses: anchore/sbom-action@v0
with:
upload-artifact-retention: 1
format: cyclonedx-json
output-file: ${{ env.SBOM_FILENAME }}.cyclonedx.json
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.AWS_S3_SBOMS_ROLE_ARN }}
aws-region: ${{ env.AWS_S3_REGION }}
- name: Copy SBOM to S3
run: |
aws s3 cp ${{ env.SBOM_FILENAME }}.cyclonedx.json s3://repos-sboms/${{ github.event.repository.name }}/${{ env.SBOM_FILENAME }}.cyclonedx.json