Skip to content
This repository was archived by the owner on Apr 15, 2024. It is now read-only.

Commit ef22d0d

Browse files
committed
refactor: improve action
1 parent 0e10e9e commit ef22d0d

30 files changed

Lines changed: 5752 additions & 851 deletions

.github/workflows/ci.yaml

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
name: ci
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- main
8+
pull_request:
9+
branches:
10+
- main
11+
12+
jobs:
13+
clamavScan:
14+
runs-on: ubuntu-latest
15+
services:
16+
registry:
17+
image: registry:2
18+
ports:
19+
- 5000:5000
20+
steps:
21+
-
22+
name: Checkout
23+
uses: actions/checkout@v2
24+
with:
25+
path: action
26+
-
27+
name: Set up Docker Buildx
28+
uses: docker/setup-buildx-action@v1
29+
with:
30+
version: latest
31+
driver-opts: network=host
32+
33+
-
34+
name: Build vulnerable image
35+
uses: docker/build-push-action@v2
36+
with:
37+
file: ./test/Dockerfile
38+
push: true
39+
tags: |
40+
localhost:5000/vulnerable/app:latest
41+
localhost:5000/vulnerable/app:1.0.0
42+
43+
-
44+
name: Run X9
45+
id: x9_run_with_virus
46+
continue-on-error: true
47+
uses: ./action
48+
with:
49+
image: localhost:5000/vulnerable/app:latest
50+
ignoreThreats: false
51+
-
52+
name: Check
53+
run: |
54+
echo "${{ toJson(steps.x9_run_with_virus) }}"
55+
if [ "${{ steps.x9_run_with_virus.outcome }}" != "failure" ] || [ "${{ steps.x9_run_with_virus.conclusion }}" != "success" ]; then
56+
echo "::error::Should have failed"
57+
exit 1
58+
fi
59+
-
60+
name: Dump context
61+
if: always()
62+
uses: crazy-max/ghaction-dump-context@v1
63+
64+
trivyScan:
65+
runs-on: ubuntu-latest
66+
steps:
67+
-
68+
name: Checkout
69+
uses: actions/checkout@v2
70+
with:
71+
path: action
72+
-
73+
name: Set up Docker Buildx
74+
uses: docker/setup-buildx-action@v1
75+
76+
-
77+
name: Run X9
78+
id: x9_run_with_vulnerabilities
79+
continue-on-error: true
80+
uses: ./action
81+
with:
82+
image: node:10.8.0-jessie
83+
ignoreThreats: false
84+
-
85+
name: Check
86+
run: |
87+
echo "${{ toJson(steps.x9_run_with_vulnerabilities) }}"
88+
if [ "${{ steps.x9_run_with_vulnerabilities.outcome }}" != "failure" ] || [ "${{ steps.x9_run_with_vulnerabilities.conclusion }}" != "success" ]; then
89+
echo "::error::Should have failed"
90+
exit 1
91+
fi
92+
-
93+
name: Dump context
94+
if: always()
95+
uses: crazy-max/ghaction-dump-context@v1

.github/workflows/test.yaml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: test
2+
3+
on:
4+
push:
5+
branches:
6+
- 'main'
7+
pull_request:
8+
branches:
9+
- 'main'
10+
11+
jobs:
12+
test:
13+
runs-on: ubuntu-latest
14+
steps:
15+
-
16+
name: Checkout
17+
uses: actions/checkout@v2
18+
-
19+
name: Validate
20+
uses: docker/bake-action@v1
21+
with:
22+
targets: validate
23+
-
24+
name: Test
25+
uses: docker/bake-action@v1
26+
with:
27+
targets: test
28+
-
29+
name: Upload coverage
30+
uses: codecov/codecov-action@v1
31+
with:
32+
file: ./coverage/clover.xml

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node_modules
2+
coverage
3+
lib

.prettierrc.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"printWidth": 240,
3+
"tabWidth": 2,
4+
"useTabs": false,
5+
"semi": true,
6+
"singleQuote": true,
7+
"trailingComma": "none",
8+
"bracketSpacing": false,
9+
"arrowParens": "avoid",
10+
"parser": "typescript"
11+
}

0 commit comments

Comments
 (0)