Skip to content

Commit

Permalink
NIFI-12191 install and run Colima for MacOS docker and integration te…
Browse files Browse the repository at this point in the history
…st GitHub Actions
  • Loading branch information
ChrisSamo632 committed Oct 23, 2023
1 parent fc66771 commit ab4e900
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 15 deletions.
30 changes: 19 additions & 11 deletions .github/workflows/docker-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest ]
os: [ ubuntu-latest, macos-latest ]
version: [ 21 ]
timeout-minutes: 120
runs-on: ${{ matrix.os }}
Expand All @@ -124,21 +124,11 @@ jobs:
distribution: 'zulu'
java-version: ${{ matrix.version }}
cache: 'maven'

- name: Set up Docker
if: ${{ runner.os == 'macOS' }}
run: |-
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew install docker
colima start
sudo ln -s ~/.colima/docker.sock /var/run/docker.sock
- name: System Information
run: |
hostname
if [ "${{ runner.os }}" = "macOS" ]; then top -l 1 | grep PhysMem && sysctl machdep.cpu; else cat /proc/cpuinfo && cat /proc/meminfo; fi
df
docker info
- name: Build Assemblies
env:
Expand All @@ -148,6 +138,24 @@ jobs:
${{ env.MAVEN_COMMAND }}
${{ env.MAVEN_BUILD_ARGUMENTS }}
${{ env.MAVEN_BUILD_PROJECTS }}
# prepare Docker for building and running images; Colima needs more memory that its default to start NiFi
- name: Set up Docker
if: ${{ runner.os == 'macOS' }}
run: |-
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew install docker
brew install colima
colima start --memory 3
docker context use colima
sudo rm -f /var/run/docker.sock
sudo ln -s "${HOME}/.colima/default/docker.sock" /var/run/docker.sock
colima version
- name: System Information
run: |
docker info
# run nifi-toolkit docker build and tests before cleaning modules
- name: Run NiFi Toolkit Docker Tests
env:
Expand Down
17 changes: 13 additions & 4 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest ]
os: [ ubuntu-latest, macos-latest ]
version: [ 21 ]
timeout-minutes: 120
runs-on: ${{ matrix.os }}
Expand All @@ -105,15 +105,24 @@ jobs:
java-version: ${{ matrix.version }}
cache: 'maven'

# many integration-tests use Docker to run Testcontainers; MacOS doesn't come with Docker, so we need to install it
# many integration-tests use Docker to run Testcontainers; MacOS doesn't come with Docker, so we need to install Colima
# need to override some Testcontainers settings for using Colima on MacOS with sufficient memory for test services
- name: Set up Docker
if: ${{ runner.os == 'macOS' }}
run: |-
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew install docker
colima start
brew install colima
colima start --memory 4
docker context use colima
sudo ln -s ~/.colima/docker.sock /var/run/docker.sock
echo "TESTCONTAINERS_DOCKER_SOCKET_OVERRIDE=/var/run/docker.sock" >> "$GITHUB_ENV"
echo "DOCKER_HOST=unix://${HOME}/.colima/default/docker.sock" >> "$GITHUB_ENV"
sudo rm -f /var/run/docker.sock
sudo ln -s "${HOME}/.colima/default/docker.sock" /var/run/docker.sock
colima version
- name: System Information
run: |
hostname
Expand Down

0 comments on commit ab4e900

Please sign in to comment.