forked from testcontainers/Docker.DotNet
-
Notifications
You must be signed in to change notification settings - Fork 0
89 lines (80 loc) · 2.67 KB
/
Copy pathci.yml
File metadata and controls
89 lines (80 loc) · 2.67 KB
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
name: CI
on:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
services:
# Docker without TLS (plain TCP) !DEPRECATED! with next docker release
docker-no-tls:
image: docker:28.1-dind
env:
DOCKER_TLS_CERTDIR: ""
ports:
- 2375:2375
options: >-
--privileged
# Docker with TLS (secure TCP)
docker-tls:
image: docker:28.1-dind
env:
DOCKER_TLS_CERTDIR: /certs
ports:
- 2376:2376
options: >-
--privileged
volumes:
- ${{ github.workspace }}/certs:/certs
strategy:
matrix:
framework:
- net8.0
- net9.0
steps:
- uses: actions/checkout@v4
with:
path: test
fetch-depth: 0
- name: Setup .NET Core
uses: actions/setup-dotnet@v4
with:
dotnet-version: 9.x
- name: Build
run: dotnet build -c Release --framework ${{ matrix.framework }}
working-directory: test
- name: Pack client cert, key, ca for C# docker client
run: |
mkdir -p ${{ github.workspace }}/certs
sudo chmod 777 ${{ github.workspace }}/certs
# create pfx
openssl pkcs12 -export -out ${{ github.workspace }}/certs/client.pfx -inkey ${{ github.workspace }}/certs/client/key.pem -in ${{ github.workspace }}/certs/client/cert.pem -certfile ${{ github.workspace }}/certs/client/ca.pem -passout pass:
- name: Wait for Docker (no TLS) to be healthy
run: |
for i in {1..10}; do
if docker --host=tcp://localhost:2375 version; then
echo "Docker (no TLS) is ready!"
exit 0
fi
echo "Waiting for Docker (no TLS) to be ready..."
sleep 3
done
echo "Docker (no TLS) did not become ready in time."
exit 1
- name: Wait for Docker (with TLS) to be healthy
run: |
for i in {1..10}; do
if docker --host=tcp://localhost:2376 --tlsverify \
--tlscacert=${{ github.workspace }}/certs/client/ca.pem \
--tlscert=${{ github.workspace }}/certs/client/cert.pem \
--tlskey=${{ github.workspace }}/certs/client/key.pem version; then
echo "Docker (TLS) is ready!"
exit 0
fi
echo "Waiting for Docker (TLS) to be ready..."
sleep 3
done
echo "Docker (TLS) did not become ready in time."
exit 1
- name: Test
run: dotnet test -c Release --framework ${{ matrix.framework }} --no-build --logger console
working-directory: test