Last active
May 4, 2021 06:32
-
-
Save catthehacker/68702214908bcb10a8977bef0b087ba3 to your computer and use it in GitHub Desktop.
Docker on macOS on GitHub Actions taken from https://github.com/nektos/act
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
test-macos: | |
name: Test on MacOS | |
runs-on: macos-latest | |
continue-on-error: true # Don't let macos test fail whole workflow | |
env: | |
ISO_PATH: ~/.docker/machine/cache/boot2docker.iso | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-go@v1 | |
with: | |
go-version: 1.16 | |
- uses: actions/cache@v2 | |
if: ${{ !env.ACT }} | |
with: | |
path: ~/go/pkg/mod | |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-go- | |
- uses: actions/cache@v2 | |
with: | |
key: boot2docker | |
path: ${{ env.ISO_PATH }} | |
restore-keys: boot2docker | |
- name: Install Docker on macOS | |
run: | | |
printf " ๐ ๏ธ Downloading boot2docker.iso ๐ ๏ธ \n\n" | |
mkdir -p ~/.docker/machine/cache/ | |
test -f ${{ env.ISO_PATH }} && printf " ๐ ๏ธ ${{ env.ISO_PATH }} successfully restored ๐ ๏ธ \n\n" || wget "https://github.com/boot2docker/boot2docker/releases/download/v19.03.12/boot2docker.iso" -O ${{ env.ISO_PATH }} | |
printf " ๐ ๏ธ Installing Docker from Homebrew ๐ ๏ธ \n\n" | |
brew install docker docker-machine | |
printf " ๐ ๏ธ Creating Docker VM ๐ ๏ธ \n\n" | |
docker-machine create --driver virtualbox --virtualbox-boot2docker-url ${{ env.ISO_PATH }} default | |
docker-machine env default | |
printf " ๐ ๏ธ Adding Docker VM info to environment ๐ ๏ธ \n\n" | |
eval "$(docker-machine env default)" | |
echo "DOCKER_TLS_VERIFY=$DOCKER_TLS_VERIFY" | tee -a $GITHUB_ENV | |
echo "DOCKER_HOST=$DOCKER_HOST" | tee -a $GITHUB_ENV | |
echo "DOCKER_CERT_PATH=$DOCKER_CERT_PATH" | tee -a $GITHUB_ENV | |
echo "DOCKER_MACHINE_NAME=$DOCKER_MACHINE_NAME" | tee -a $GITHUB_ENV | |
printf " ๐ ๏ธ Install Qemu for running containers with different architecture ๐ ๏ธ \n\n" | |
docker run --rm --privileged tonistiigi/binfmt --install all | |
printf " ๐ ๏ธ Finished installing Docker ๐ ๏ธ \n\n" | |
- run: go test -v -timeout 30m -cover ./... | |
env: | |
CGO_ENABLED: 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment