-
Notifications
You must be signed in to change notification settings - Fork 14
87 lines (76 loc) · 2.45 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
name: ci
on:
pull_request:
branches-ignore:
- none
jobs:
build-and-test:
name: Build and run tests
runs-on: ubuntu-latest
services:
redis:
image: redis
ports:
- 6379:6379
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: '^1.13.1'
- name: Get version
run: echo "VERSION=$(awk '/^const Version/{gsub(/"/, "", $4); print $4}' splitio/version.go)" >> $GITHUB_ENV
- name: Run test
run: make test_coverage
- name: Create build folder
run: mkdir -p build
- name: Build assets
run: make release_assets
- name: SonarQube Scan (Pull Request)
uses: SonarSource/[email protected]
env:
SONAR_TOKEN: ${{ secrets.SONARQUBE_TOKEN }}
with:
projectBaseDir: .
args: >
-Dsonar.host.url=${{ secrets.SONARQUBE_HOST }}
-Dsonar.projectVersion=${{ env.VERSION }}
-Dsonar.pullrequest.key=${{ github.event.pull_request.number }}
-Dsonar.pullrequest.branch=${{ github.event.pull_request.head.ref }}
-Dsonar.pullrequest.base=${{ github.event.pull_request.base.ref }}
build-docker-image:
name: Build Docker Image
runs-on: ubuntu-latest
strategy:
matrix:
mode: [synchronizer, proxy]
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Docker Build and Push
uses: docker/build-push-action@v4
with:
context: .
file: docker/Dockerfile.${{ matrix.mode }}
push: false
tags: splitio-docker.jfrog.io/split-${{ matrix.mode }}:latest
- name: Scan container using Lacework
uses: lacework/[email protected]
with:
LW_ACCOUNT_NAME: ${{ secrets.LW_ACCOUNT_NAME }}
LW_ACCESS_TOKEN: ${{ secrets.LW_ACCESS_TOKEN }}
IMAGE_NAME: splitio-docker.jfrog.io/split-${{ matrix.mode }}
IMAGE_TAG: latest
SAVE_RESULTS_IN_LACEWORK: true
SAVE_BUILD_REPORT: true
BUILD_REPORT_FILE_NAME: split-${{ matrix.mode }}.html
- name: Save vulnerability report
if: always()
uses: actions/upload-artifact@v3
with:
name: vulnerability_report
path: split-${{ matrix.mode }}.html
retention-days: 7