-
Notifications
You must be signed in to change notification settings - Fork 3
68 lines (66 loc) · 2.01 KB
/
test.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
name: Build and Test
on:
push:
branches:
- master
pull_request:
branches:
- master
paths:
- "**/Dockerfile"
- "poetry.lock"
- "pyproject.toml"
- "requirements.txt"
- ".github/workflows/test.yaml"
env:
DOCKER_USERNAME: tiryoh
DOCKER_IMAGENAME: mkdocs-builder
jobs:
build:
strategy:
matrix:
target: [alpine, debian]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build docker image
env:
DOCKER_LABEL: ${{ matrix.target }}
run: |
docker build -t $DOCKER_USERNAME/$DOCKER_IMAGENAME:$DOCKER_LABEL -f $DOCKER_LABEL/Dockerfile .
- name: Checkout mkdocs
uses: actions/checkout@v4
with:
repository: squidfunk/mkdocs-material
path: mkdocs-material
- name: Test building mkdocs
env:
DOCKER_LABEL: ${{ matrix.target }}
run: |
docker run --rm -v $PWD/mkdocs-material:/docs $DOCKER_USERNAME/$DOCKER_IMAGENAME:$DOCKER_LABEL build
- name: List docker images
run: |
mkdir -p build_log
docker image ls "$DOCKER_USERNAME/*" | tee ./build_log/docker_images.txt
- uses: actions/upload-artifact@v3
with:
name: build-log-${{ matrix.target }}
path: build_log
- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@master
with:
image-ref: '${{ env.DOCKER_USERNAME }}/${{ env.DOCKER_IMAGENAME }}:${{ matrix.target }}'
exit-code: '0'
vuln-type: 'os,library'
severity: 'CRITICAL,HIGH'
format: 'template'
template: '@/contrib/sarif.tpl'
output: 'trivy-results.sarif'
env:
TRIVY_SKIP_DB_UPDATE: true
TRIVY_SKIP_JAVA_DB_UPDATE: true
- name: Upload Trivy scan results to GitHub Security tab
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: 'trivy-results.sarif'
wait-for-processing: true