-
Notifications
You must be signed in to change notification settings - Fork 0
121 lines (97 loc) · 4.44 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
name: CI Build
on:
workflow_dispatch:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
strategy:
matrix:
os: [ubuntu-latest,macos-13]
runs-on: ${{ matrix.os }}
steps:
- name: Set up Homebrew on Linux
if: matrix.os == 'ubuntu-latest'
uses: Homebrew/actions/setup-homebrew@master
- if: matrix.os == 'ubuntu-latest'
name: Remove old executable of crun and stop docker service
run: |
# Remove the old crun executable to let brew to install a newer one ...
sudo apt-get remove crun
sudo apt-get remove podman
sudo systemctl stop docker.socket
sudo systemctl stop docker
- name: Install podman v5 using homebrew
run: |
# What brew will install: https://ghcr.io/v2/homebrew/core/podman/manifests/5.3.2_1
brew install podman
- name: Install and launch podman service
if: matrix.os == 'ubuntu-latest'
run: |
brew services start podman
# reconfigure timeouts for podman to be compatible with java docker api
sudo mkdir -p /etc/containers/containers.conf.d
printf "[engine]\nservice_timeout=91\n" | sudo tee -a /etc/containers/containers.conf.d/service-timeout.conf
# restart to allow config to take effect
brew services restart podman
- name: Create linux's vm on macos
if: matrix.os == 'macos-13'
run: |
podman machine init --cpus 4 -m 4096
podman machine inspect | jq -r '.[].Resources'
podman machine start --log-level debug
# reconfigure timeouts inside podman vm to be compatible with java docker api
echo 'mkdir -p /etc/containers/containers.conf.d && printf "[engine]\nservice_timeout=91\n" > /etc/containers/containers.conf.d/service-timeout.conf && systemctl restart podman.socket' | podman machine ssh --username root --
- name: Expose the podman API and podman.socket
if: matrix.os == 'ubuntu-latest'
run: |
podman system service --time=0 &
- name: Podman information
run: |
echo "Podman version: " $(podman info -f json | jq -r .version.Version)
echo "Podman rootless: " $(podman info -f json | jq -r .host.security.rootless)
echo "Podman sock path: " $(podman info -f json | jq -r .host.remoteSocket.path)
- name: Set DOCKER_HOST for linux and env
if: matrix.os == 'ubuntu-latest'
run: |
echo "Podman sock path: unix://${XDG_RUNTIME_DIR}/podman/podman.sock"
echo "PODMAN_SOCK_PATH=${XDG_RUNTIME_DIR}/podman/podman.sock" >> $GITHUB_ENV
echo "ARGOCD_RESOURCE_TIMEOUT=180" >> $GITHUB_ENV
- name: Set DOCKER_HOST for macos and env
if: matrix.os == 'macos-13'
run: |
# >> Using /var/folders/28/g86pgjxj0wl1nkd_85c2krjw0000gn/T/podman/podman-machine-default.sock
echo "Podman sock path: $(podman machine inspect --format '{{.ConnectionInfo.PodmanSocket.Path}}')"
echo PODMAN_SOCK_PATH=$(podman machine inspect --format '{{.ConnectionInfo.PodmanSocket.Path}}') >> $GITHUB_ENV
echo "ARGOCD_RESOURCE_TIMEOUT=360" >> $GITHUB_ENV
- name: Login to Docker Hub
run: |
podman login docker.io \
-u ${{ vars.DOCKERHUB_USERNAME }} \
-p ${{ secrets.DOCKERHUB_TOKEN }} \
--compat-auth-file $HOME/.docker/config.json
- name: Let's pull an image within the VM
if: matrix.os == 'macos-13'
run: |
echo "Let's pull an image ...."
podman machine ssh "podman pull kindest/node:v1.31.0 "
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 21
- uses: actions/checkout@v4
- name: Perform CI test
env:
PODMAN_SOCK_PATH: ${{ env.PODMAN_SOCK_PATH }}
ARGOCD_RESOURCE_TIMEOUT: ${{ env.ARGOCD_RESOURCE_TIMEOUT }}
run: |
export TESTCONTAINERS_RYUK_DISABLED=true
# export TESTCONTAINERS_DOCKER_SOCKET_OVERRIDE=/var/run/docker.sock
export TESTCONTAINERS_DOCKER_SOCKET_OVERRIDE=$PODMAN_SOCK_PATH
export DOCKER_HOST=unix://$PODMAN_SOCK_PATH
export DOCKER_CONFIG=$HOME/.docker
export ARGOCD_RESOURCE_TIMEOUT=$ARGOCD_RESOURCE_TIMEOUT
mvn -B test