-
Notifications
You must be signed in to change notification settings - Fork 373
120 lines (117 loc) · 4.4 KB
/
Copy pathgo-e2e-debian.yaml
File metadata and controls
120 lines (117 loc) · 4.4 KB
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
118
119
120
name: go-e2e-debian
on:
pull_request:
branches: [master]
permissions:
contents: read
jobs:
e2e-tests:
permissions:
actions: write # for styfle/cancel-workflow-action to cancel/stop running workflows
contents: read # for docker/build-push-action to read repo content
name: e2e-tests-${{ matrix.config.tag_suffix }}
strategy:
fail-fast: false
matrix:
go-version: [1.26.x]
config:
- os: ubuntu-latest
platform: linux/amd64
dockerfile: docker/Dockerfile.debian
tag_suffix: debian-amd64
- os: ubuntu-24.04-arm
platform: linux/arm64
dockerfile: docker/Dockerfile.debian
tag_suffix: debian-arm64
runs-on: ${{ matrix.config.os }}
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa # 0.12.1
with:
access_token: ${{ github.token }}
- name: Check out code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
- name: Set up Go
uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 #v6.3.0
with:
go-version: ${{ matrix.go-version }}
- name: Print go env
run: go env
- name: Get Modules
run: go mod vendor
- name: Set up Node v14
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f #v6.3.0
with:
node-version: "20"
- name: Install mock server
run: npm ci
working-directory: .github/scripts/server-mock
- name: Start mock server
run: (npm run start&)
working-directory: .github/scripts/server-mock
- name: Set up Docker Buildx
id: buildx
uses: step-security/setup-buildx-action@f931205d68723ad9589fd2a7e2ece238bf9de341 # v4.0.0
- name: Cache Docker layers
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ matrix.config.tag_suffix }}-${{ github.ref }}
restore-keys: |
${{ runner.os }}-buildx-${{ matrix.config.tag_suffix }}-${{ github.ref }}
- name: Append Entrypoint in dockerfile
if: matrix.config.dockerfile == 'docker/Dockerfile.debian'
run: |
echo "ENTRYPOINT [\"/app/bin/kics\"]" >> docker/Dockerfile.debian
- name: Get short SHA
run: echo "GITHUB_SHA_SHORT=$(echo $GITHUB_SHA | cut -c 1-8)" >> $GITHUB_ENV
- name: Build
id: docker_build
uses: step-security/docker-build-push-action@846549baaf047e867d038826129a64d81df0f704 # v7.1.0
with:
load: true
context: ./
file: ./${{ matrix.config.dockerfile }}
builder: ${{ steps.buildx.outputs.name }}
push: false
tags: kics:e2e-${{ matrix.config.tag_suffix }}-${{ github.sha }}
platforms: ${{ matrix.config.platform }}
build-args: |
VERSION=development
COMMIT=${{ github.sha }}
BUILDPLATFORM=${{ matrix.config.platform }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}
- name: Display PWD / Files
run: |
pwd
ls
- name: Set Output Permissions
run: |
sudo chmod -R 777 ./e2e
- name: Run E2E Tests
env:
E2E_KICS_DOCKER: kics:e2e-${{ matrix.config.tag_suffix }}-${{ github.sha }}
E2E_KICS_QUERIES_PATH: ${{ steps.getbin.outputs.queries }}
run: |
go test -tags dev "github.com/Checkmarx/kics/v2/e2e" -timeout 1500s -json > results.json
- name: Generate E2E Report
if: always()
env:
E2E_KICS_DOCKERFILE: ${{ matrix.config.dockerfile }}
run: |
CWD=$(pwd)
cd .github/scripts/report
go mod tidy
go build
./e2e-report -test-path ${CWD} -test-name results.json -report-path ${CWD} -report-name e2e-report.html
- name: Archive test report
if: always()
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: e2e-tests-report-${{ matrix.config.tag_suffix }}
path: e2e-report.html