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