CI Build #112
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 " | |
- uses: actions/checkout@v4 | |
with: | |
repository: ch007m/fork-kindcontainer.git | |
ref: enable-featuregate | |
- name: Set up JDK 21 | |
uses: actions/setup-java@v4 | |
with: | |
distribution: temurin | |
java-version: 21 | |
- name: Build kindcontainer testcontainer project | |
id: build-kindcontainer | |
run: | | |
export SNAPSHOT_VERSION=$(gradle publishToMavenLocal --console=plain | grep 'Publishing to maven local' | awk -F':' '{print $NF}') | |
echo "SNAPSHOT_VERSION=$SNAPSHOT_VERSION" >> "$GITHUB_OUTPUT" | |
- run: | | |
echo Snapshot version of kind container: ${{ steps.build-kindcontainer.outputs.SNAPSHOT_VERSION }} | |
- 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 -Dtest=ArgoCDDeployTest \ | |
-Dtestcontainer.version=${{ steps.build-kindcontainer.outputs.SNAPSHOT_VERSION }} |