@@ -3,10 +3,13 @@ name: Build and Test
3
3
on :
4
4
push :
5
5
branches :
6
- - ' ** '
6
+ - master
7
7
tags-ignore :
8
8
- ' *'
9
9
pull_request :
10
+ paths :
11
+ - ' **/Dockerfile'
12
+ - ' **/DevelPatchPerl.patch'
10
13
11
14
defaults :
12
15
run :
@@ -18,46 +21,56 @@ jobs:
18
21
runs-on : ubuntu-latest
19
22
outputs :
20
23
matrix : ${{ steps.generate.outputs.matrix }}
24
+
21
25
steps :
22
- - uses : actions/checkout@master
26
+ - uses : actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
27
+
23
28
- id : generate
24
29
name : Enumerate Dockerfiles
25
30
run : |
26
31
matrix="$(dirname */Dockerfile | sort -rn | jq -csR 'rtrimstr("\n") | split("\n") | { directory: . }')"
27
32
echo "matrix=$matrix" >> $GITHUB_OUTPUT
33
+
28
34
build-image :
29
35
needs : generate-matrix
30
36
runs-on : ubuntu-latest
31
37
strategy :
32
38
matrix : ${{ fromJson(needs.generate-matrix.outputs.matrix) }}
33
39
name : ${{ matrix.directory }}
40
+
34
41
steps :
35
42
- uses : actions/checkout@master
43
+
36
44
- name : Clone docker-library/official-images (for testing)
37
45
run : |
38
46
git clone --depth 1 --single-branch https://github.com/docker-library/official-images.git
47
+
39
48
- name : Build image
40
49
run : |
41
50
docker version
42
51
dir='${{ matrix.directory }}'
43
52
img="perl:${dir//,/-}"
44
- docker build -t "$img" "$dir"
53
+ docker buildx build --progress=plain -t "$img" "$dir"
54
+
45
55
- name : Inspect image creation and tag time
46
56
run : |
47
57
dir='${{ matrix.directory }}'
48
58
img="perl:${dir//,/-}"
49
59
docker image inspect --format '{{.Created}}' "$img"
50
60
docker image inspect --format '{{.Metadata.LastTagTime}}' "$img"
61
+
51
62
- name : Run tests from docker-library/official-images
52
63
run : |
53
64
dir='${{ matrix.directory }}'
54
65
img="perl:${dir//,/-}"
55
66
./official-images/test/run.sh "$img"
67
+
56
68
- name : Run HTTPS access test
57
69
run : |
58
70
dir='${{ matrix.directory }}'
59
71
img="perl:${dir//,/-}"
60
72
docker run "$img" perl -MHTTP::Tiny -E 'if (HTTP::Tiny->new->get("https://github.com")->{status} == 200) { exit 0 } exit 1'
73
+
61
74
- name : Run cpanm install test
62
75
run : |
63
76
dir='${{ matrix.directory }}'
@@ -67,13 +80,15 @@ jobs:
67
80
docker run "$img" cpanm -v Net::[email protected] _02
68
81
fi
69
82
docker run "$img" cpanm -v Mojolicious
83
+
70
84
- name : Run cpanm no-lwp by default test
71
85
run : |
72
86
dir='${{ matrix.directory }}'
73
87
img="perl:${dir//,/-}"
74
88
if [[ "$dir" != *"slim"* ]]; then
75
89
docker run "$img" bash -c "cpanm -v -n LWP && cpanm -v -n local::lib"
76
90
fi
91
+
77
92
- name : Run cpm install test
78
93
run : |
79
94
dir='${{ matrix.directory }}'
83
98
docker run "$img" cpm install -v Net::[email protected] _02
84
99
fi
85
100
docker run "$img" cpm install -v Mojolicious
86
- - name : COPY all to default WORKDIR
87
- run : |
88
- dir='${{ matrix.directory }}'
89
- img="perl:${dir//,/-}"
90
- mkdir -p test/lib
91
- cat <<EOF >Dockerfile
92
- FROM $img
93
- COPY . .
94
- EOF
95
- docker build -f Dockerfile test
0 commit comments