-
Notifications
You must be signed in to change notification settings - Fork 0
171 lines (168 loc) · 5.57 KB
/
docker-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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
---
#
# https://docs.docker.com/build/ci/github-actions/
# https://github.com/docker/build-push-action
# https://docs.github.com/en/actions/creating-actions/creating-a-docker-container-action
# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#workflow_dispatch
#
name: Docker Test Workflow
on: # yamllint disable-line rule:truthy
workflow_dispatch:
workflow_run:
workflows:
- "Docker Build Workflow"
types:
- completed
env:
IMAGE_NAME: ci-generic-debian
defaults:
run:
shell: bash
jobs:
stage1a:
name: Docker Generic Container Test
env:
ORG: ${{ secrets.DOCKERHUB_USERNAME }}
IMAGE_NAME: ci-generic-debian
runs-on: ubuntu-latest
strategy:
matrix:
cmd:
- rustc --version
- go version
- node --version
- ruby --version
- gcc --version
- g++ --version
- python --version
steps:
- name: Test Entrypoint Default
run: |-
{
ORG_IMAGE="${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}"
printf "Testing default entrypoint\n"
printf "\n"
docker run "${ORG_IMAGE}:latest"
printf "\n"
for c in $(docker ps -a | grep "${ORG_IMAGE}" | awk '{ print $1 }'); do
echo docker rm "${c}"
docker rm "${c}"
printf "\n"
done
} | tee -a "${GITHUB_STEP_SUMMARY}"
- name: Test Entrypoint ${{ matrix.cmd }}
run: |-
{
ORG_IMAGE="${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}"
printf "Testing ${{ matrix.cmd }} entrypoint\n"
printf "\n"
docker run "${ORG_IMAGE}:latest" ${{ matrix.cmd }}
printf "\n"
for c in $(docker ps -a | grep "${ORG_IMAGE}" | awk '{ print $1 }'); do
echo docker rm "${c}"
docker rm "${c}"
printf "\n"
done
} | tee -a "${GITHUB_STEP_SUMMARY}"
- name: Docker Version
run: |-
docker version
- name: Test Entrypoint - Docker
run: |-
{
ORG_IMAGE="${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}"
printf "Testing entrypoint - docker\n"
printf "\n"
docker run -v /var/run/docker.sock:/var/run/docker.sock "${ORG_IMAGE}:latest" docker version
printf "\n"
for c in $(docker ps -a | grep "${ORG_IMAGE}" | awk '{ print $1 }'); do
echo docker rm "${c}"
docker rm "${c}"
printf "\n"
done
} | tee -a "${GITHUB_STEP_SUMMARY}"
stage1b:
name: Docker Anaconda Container Test
env:
ORG: ${{ secrets.DOCKERHUB_USERNAME }}
IMAGE_NAME: ci-anaconda-debian
runs-on: ubuntu-latest
strategy:
matrix:
cmd:
- gcc --version
- python --version
- R --version
- Rscript --version
steps:
- name: Test Entrypoint Default
run: |-
{
ORG_IMAGE="${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}"
printf "Testing default entrypoint\n"
printf "\n"
docker run "${ORG_IMAGE}:latest"
printf "\n"
for c in $(docker ps -a | grep "${ORG_IMAGE}" | awk '{ print $1 }'); do
echo docker rm "${c}"
docker rm "${c}"
printf "\n"
done
} | tee -a "${GITHUB_STEP_SUMMARY}"
- name: Test Entrypoint ${{ matrix.cmd }}
run: |-
{
ORG_IMAGE="${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}"
printf "Testing ${{ matrix.cmd }} entrypoint\n"
printf "\n"
docker run "${ORG_IMAGE}:latest" ${{ matrix.cmd }}
printf "\n"
for c in $(docker ps -a | grep "${ORG_IMAGE}" | awk '{ print $1 }'); do
echo docker rm "${c}"
docker rm "${c}"
printf "\n"
done
} | tee -a "${GITHUB_STEP_SUMMARY}"
- name: Docker Version
run: |-
docker version
- name: Test Entrypoint - Docker
run: |-
{
ORG_IMAGE="${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}"
printf "Testing entrypoint - docker\n"
printf "\n"
docker run -v /var/run/docker.sock:/var/run/docker.sock "${ORG_IMAGE}:latest" docker version
printf "\n"
for c in $(docker ps -a | grep "${ORG_IMAGE}" | awk '{ print $1 }'); do
echo docker rm "${c}"
docker rm "${c}"
printf "\n"
done
} | tee -a "${GITHUB_STEP_SUMMARY}"
stage2:
name: Dagger Test
env:
ORG: ${{ secrets.DOCKERHUB_USERNAME }}
strategy:
matrix:
image:
- ci-generic-debian
- ci-anaconda-debian
runs-on: ubuntu-latest
steps:
- name: Show dagger version
run: |-
{
IMAGE_NAME="${{ matrix.image }}"
ORG_IMAGE="${{ secrets.DOCKERHUB_USERNAME }}/${IMAGE_NAME}"
printf "dagger version\n"
docker run "${ORG_IMAGE}:latest" dagger version
} |& tee -a "${GITHUB_STEP_SUMMARY}"
- name: Test dagger run
run: |-
{
ORG_IMAGE="${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}"
printf "Testing entrypoint - dagger\n"
docker run -v /var/run/docker.sock:/var/run/docker.sock "${ORG_IMAGE}:latest" dagger run uptime
} |& tee -a "${GITHUB_STEP_SUMMARY}"