-
Notifications
You must be signed in to change notification settings - Fork 5
124 lines (118 loc) · 3.8 KB
/
test-e2e.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
118
119
120
121
122
123
124
name: Test-E2E
on:
pull_request:
paths:
- "**.sh"
- "test/**"
- "action.yml"
- ".github/workflows/test-e2e.yml"
jobs:
gh-action-default:
name: Action validates Dockerfiles
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: ./
with:
dockerfile: test/fixtures/Dockerfile-valid
gh-action-version:
name: Action supports custom version
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: ./
id: check
with:
dockerfile: test/fixtures/Dockerfile-valid
version: 2.10.0
- name: Compare versions
env:
HADOLINT_VERSION: ${{ steps.check.outputs.hadolint_version }}
REQUESTED_VERSION: 2.10.0
run: |
if [[ "${HADOLINT_VERSION}" != "${REQUESTED_VERSION}" ]]; then
echo "::error::Version mismatch: \"${HADOLINT_VERSION}\" does not equal \"${REQUESTED_VERSION}\""
exit 1
fi
gh-action-glob:
name: Action supports glob expansion
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: ./
with:
dockerfile: "test/**/Dockerfile-glob-*"
annotate: false
# https://github.com/jbergstroem/hadolint-gh-action/issues/134
gh-action-multiple-invocations:
name: Action supports multiple invocations in a job
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
# Download and run default version
- uses: ./
with:
dockerfile: test/fixtures/Dockerfile-valid
annotate: false
# Download and run custom version
- uses: ./
with:
dockerfile: test/fixtures/Dockerfile-valid
version: 2.11.0
annotate: false
# Redownload if binary is broken, in this case a non-executable
- run: chmod -x /usr/local/bin/hadolint
- uses: ./
with:
dockerfile: test/fixtures/Dockerfile-valid
version: 2.11.0
annotate: false
# Download and run default version again
- uses: ./
with:
dockerfile: test/fixtures/Dockerfile-valid
annotate: false
# https://github.com/jbergstroem/hadolint-gh-action/issues/142
gh-action-version-variations:
name: Action supports version variations
runs-on: ubuntu-22.04
strategy:
matrix:
version: ["1.23.0", "2.9.0", "2.12.0"]
steps:
- uses: actions/checkout@v4
- uses: ./
id: check
with:
dockerfile: test/fixtures/Dockerfile-valid
annotate: false
version: ${{ matrix.version }}
- name: Compare versions
env:
HADOLINT_VERSION: ${{ steps.check.outputs.hadolint_version }}
REQUESTED_VERSION: ${{ matrix.version }}
run: |
if [[ "${HADOLINT_VERSION}" != "${REQUESTED_VERSION}" ]]; then
echo "::error::Version mismatch: \"${HADOLINT_VERSION}\" does not equal \"${REQUESTED_VERSION}\""
exit 1
fi
gh-action-output:
name: Action populates output if configured
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: ./
id: action-output
with:
dockerfile: "test/fixtures/Dockerfile-valid"
annotate: false
output_format: json
- name: Compare output
env:
OUTPUT: ${{ steps.action-output.outputs.hadolint_output }}
ASSERT: '[{"code":"DL3018","column":1,"file":"test/fixtures/Dockerfile-warning","level":"warning","line":3,"message":"Pin versions in apk add. Instead of `apk add <package>` use `apk add <package>=<version>`"}]'
run: |
if [[ "${OUTPUT}" != "${ASSERT}" ]]; then
echo "::error::Output mismatch: \"${OUTPUT}\" does not equal \"${ASSERT}\""
exit 1
fi