-
Notifications
You must be signed in to change notification settings - Fork 1
117 lines (99 loc) · 3.42 KB
/
ci.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
name: Continuous Integration
# This GitHub action runs your tests for each pull request and push.
# Optionally, you can turn it on using a schedule for regular testing.
on:
# pull_request:
# paths-ignore:
# - 'README.md'
pull_request_target:
branches:
- main
push:
branches:
- main
env:
LC_APPLICATION_ID: the-cla
# Testing only needs permissions to read the repository contents.
permissions:
contents: read
jobs:
build:
name: Build & Test
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: '18.x'
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
cache: true
- name: Build
run: make all
- name: Run Tests
run: make test
sonatype:
name: Sonatype Lifecycle
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: '18.x'
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
cache: true
# See https://help.sonatype.com/en/npm-application-analysis.html
- name: Install Production Node Dependencies
run: corepack yarn install --prod
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
- name: Build Container and export to Docker
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
load: true
platforms: linux/amd64
tags: sonatypecommunity/the-cla:${{ github.sha }}
- name: Sonatype Lifecycle Evaluation
id: evaluate
uses: sonatype/actions/evaluate@v1.0.1
with:
iq-server-url: ${{ vars.SONATYPE_PLATFORM_URL }}
username: ${{ secrets.SONATYPE_LIFECYCLE_USERNAME }}
password: ${{ secrets.SONATYPE_LIFECYCLE_PASSWORD }}
application-id: ${{ env.LC_APPLICATION_ID }}
scan-targets: 'container:docker.io/sonatypecommunity/the-cla:${{ github.sha }} .'
code_quality:
name: Code Quality
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
# Disabling shallow clone is recommended for improving relevancy of reporting
fetch-depth: 0
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
cache: true
- name: Run Go Linter
uses: golangci/golangci-lint-action@v6
with:
version: latest