-
-
Notifications
You must be signed in to change notification settings - Fork 34
185 lines (176 loc) · 5.08 KB
/
ci.yaml
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
172
173
174
175
176
177
178
179
180
181
182
183
184
185
on:
push:
pull_request:
workflow_dispatch:
schedule:
- cron: '0 0 * * 4'
name: CI
jobs:
docker:
name: Docker
defaults:
run:
shell: bash --noprofile --norc -exo pipefail {0}
strategy:
fail-fast: false
matrix:
docker_version:
# - 18.09
# - 19.03
- "20.10"
- "23.0"
- "24.0"
docker_channel:
- stable
- test
# - nightly
os:
- ubuntu-20.04
- ubuntu-22.04
- ubuntu-latest
- macos-13
# - macos-13-xlarge
include:
# macOS
- os: macos-latest
docker_channel: stable
docker_version: "20.10"
runs-on: ${{ matrix.os }}
# timeout-minutes: 20
steps:
- uses: actions/checkout@main
with:
fetch-depth: 2
- uses: azure/docker-login@v1
if: |
github.event_name == 'push'
with:
# login-server: contoso.azurecr.io
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: setup Docker
uses: ./
# uses: docker-practice/actions-setup-docker@master
with:
docker_version: ${{ matrix.docker_version }}
docker_channel: ${{ matrix.docker_channel }}
- name: Setup tmate session
uses: mxschmitt/action-tmate@master
if: ${{ failure() }}
timeout-minutes: 60
- name: Test
run: |
# set -x
docker version
cat /etc/docker/daemon.json || true
cat /Users/runner/.docker/daemon.json || true
docker buildx version || true
docker buildx ls || true
docker-default:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- macos-latest
# timeout-minutes: 20
defaults:
run:
shell: bash --noprofile --norc -exo pipefail {0}
steps:
- uses: actions/checkout@main
with:
fetch-depth: 2
- name: setup docker(default)
uses: ./
# uses: docker-practice/actions-setup-docker@master
- name: Setup tmate session
uses: mxschmitt/action-tmate@master
if: ${{ failure() }}
timeout-minutes: 60
- run: docker version
# Login docker hub or other docker registry
# test docker login
- uses: azure/docker-login@v1
if: |
github.event_name == 'push'
with:
# login-server: contoso.azurecr.io
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
# - name: docker login by cli
# run: |
# echo ${docker_password} | docker login -u ${docker_username} --password-stdin ${docker_registry:-}
# if: |
# github.event_name == 'push'
# env:
# # docker_registry: contoso.azurecr.io
# docker_username: ${{ secrets.DOCKER_USERNAME }}
# docker_password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build Docker Image
run: |
# set -x
push=
if [ "${push_image}" = 'true' ];then
push='--push'
fi
echo 'FROM --platform=${TARGETPLATFORM} alpine' > Dockerfile
echo 'RUN set -x ; apk add --no-cache curl' >> Dockerfile
# fix macos docker auth
sed -i "" 's/credsStore/_credsStore/g' ${DOCKER_CONFIG}/config.json || true
tag=${version:-20.10}-${channel:-stable}-${os}
docker buildx build \
-t khs1994/alpine:${tag} \
${push} \
--platform linux/arm64,linux/amd64 \
.
env:
os: ${{ matrix.os }}
# version: ${{ matrix.docker_version }}
# channel: ${{ matrix.docker_channel }}
push_image: ${{ github.event_name == 'push' }}
# docker-nightly:
# strategy:
# fail-fast: false
# matrix:
# os:
# - ubuntu-20.04
# - ubuntu-22.04
# - ubuntu-latest
# runs-on: ${{ matrix.os }}
# defaults:
# run:
# shell: bash --noprofile --norc -exo pipefail {0}
# steps:
# - uses: actions/checkout@main
# with:
# fetch-depth: 2
# - uses: azure/docker-login@v1
# if: |
# github.event_name == 'push'
# with:
# # login-server: contoso.azurecr.io
# username: ${{ secrets.DOCKER_USERNAME }}
# password: ${{ secrets.DOCKER_PASSWORD }}
# - name: setup docker
# uses: ./
# # uses: docker-practice/actions-setup-docker@master
# with:
# docker_nightly_version: snapshot-20210202
# docker_channel: nightly
# - run: docker version
notsupport-platform:
strategy:
fail-fast: false
matrix:
os:
- windows-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@main
with:
fetch-depth: 2
- name: setup docker(default)
uses: ./
# uses: docker-practice/actions-setup-docker@master