forked from lucacome/docker-image-update-checker
-
Notifications
You must be signed in to change notification settings - Fork 3
126 lines (97 loc) · 3.34 KB
/
test.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
125
126
name: Test
on: [push, workflow_dispatch]
jobs:
test-public-images:
name: Works with public images
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, ubuntu-20.04]
parent-image: ["nginx:1.21.0", ubuntu]
my-image: ["nginx/nginx-ingress:1.12.0", ubuntu]
steps:
- uses: actions/checkout@v3
- id: check
uses: ./
with:
parent-image: ${{ matrix.parent-image }}
my-image: ${{ matrix.my-image }}
- run: ./tests/assert-out-of-date.sh "${{ matrix.my-image }}" "${{matrix.parent-image }}"
shell: bash
if: steps.check.outputs.out-of-date == 'true'
- run: ./tests/assert-up-to-date.sh "${{ matrix.my-image }}" "${{matrix.parent-image }}"
shell: bash
if: steps.check.outputs.out-of-date == 'false'
test-private-images:
name: Works with private images
runs-on: ${{ matrix.os }}
# Pass docker/login-action authorization to our custom action. See https://github.com/docker/login-action/issues/32 and https://github.com/docker/login-action/issues/34.
env:
DOCKER_CONFIG: $HOME/.docker
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, ubuntu-20.04]
parent-image:
["alpine:3.13", "alpine:3.14", "ghcr.io/twiddler/my-alpine:3.13"]
my-image: ["ghcr.io/twiddler/my-alpine:3.13"]
steps:
- uses: actions/checkout@v3
# Refer to https://github.com/docker/login-action on how to use authenticate with your registry.
- uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- id: check
uses: ./
with:
parent-image: ${{ matrix.parent-image }}
my-image: ${{ matrix.my-image }}
- run: ./tests/assert-out-of-date.sh "${{ matrix.my-image }}" "${{matrix.parent-image }}"
shell: bash
if: steps.check.outputs.out-of-date == 'true'
- run: ./tests/assert-up-to-date.sh "${{ matrix.my-image }}" "${{matrix.parent-image }}"
shell: bash
if: steps.check.outputs.out-of-date == 'false'
fail-on-unknown-parent-image:
name: We should fail if we cannot find `parent-image`
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, ubuntu-20.04]
parent-image: [qwertzui]
my-image: [alpine, asdfghjk]
steps:
- uses: actions/checkout@v3
- id: check
uses: ./
with:
parent-image: ${{ matrix.parent-image }}
my-image: ${{ matrix.my-image }}
continue-on-error: true
- run: exit 1
shell: bash
if: steps.check.outputs.out-of-date != ''
fail-on-unknown-my-image:
name: We should fail if we cannot find `my-image`
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, ubuntu-20.04]
parent-image: [alpine, asdfghjk]
my-image: [qwertzui]
steps:
- uses: actions/checkout@v3
- id: check
uses: ./
with:
parent-image: ${{ matrix.parent-image }}
my-image: ${{ matrix.my-image }}
continue-on-error: true
- run: exit 1
shell: bash
if: steps.check.outputs.out-of-date != ''