Skip to content

Instantly share code, notes, and snippets.

@adamf
Created August 5, 2020 18:35
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adamf/d5d5833946ebea7f512bed74a504e419 to your computer and use it in GitHub Desktop.
Save adamf/d5d5833946ebea7f512bed74a504e419 to your computer and use it in GitHub Desktop.
Running minikube + tilt ci in a github action
#!/bin/bash
set -exu
PLATFORM=$(uname)
# If the minikube cluster doesn't exist, the return code is 7
# we'll test this later to see if we need to do a bunch of initial setup on
# services (eg, create RBAC for k8s, create DB users, etc)
MINIKUBE_STATUS_GREP_NON_EXISTENT=0
MEMORY_TARGET=26000
CPU_TARGET=4
DISK_TARGET=100g
if [ "$PLATFORM" == "Linux" ];
then
minikube config set driver docker
MEMORY_TARGET=6000
CPU_TARGET=2
DISK_TARGET=40g
fi
# TODO: once Tilt supports proper detection of minikube
# as the running environment, uncomment this and the
# corresponding code in the Tiltfile
# https://github.com/windmilleng/tilt/issues/3024
PROFILE_NAME="minikube-dev-${USER}-${HOSTNAME}"
minikube config set profile "${PROFILE_NAME}"
minikube config set cpus ${CPU_TARGET}
minikube config set memory ${MEMORY_TARGET}
minikube config set disk-size ${DISK_TARGET}
if [ "$PLATFORM" == "Darwin" ];
then
minikube config set driver hyperkit
fi
set +e
minikube status | grep Non
MINIKUBE_STATUS=$?
set -e
# The default minikube port (8443) is not the default kubernetes port (6443)
# some software hardcodes 6443, so we change the port here.
minikube start --apiserver-port=6443 --addons=metrics-server --addons=ingress --addons=dashboard --addons=logviewer
if [ ${MINIKUBE_STATUS} -eq ${MINIKUBE_STATUS_GREP_NON_EXISTENT} ];
then
./services/utils/do_initial_service_setup.sh
fi
name: TiltCI
on:
pull_request:
branches: [ main ]
jobs:
build:
timeout-minutes: 20
# The type of runner that the job will run on
runs-on: [ ubuntu-18.04 ]
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- name: setup deps
run: './common/dev_setup/install_core_tools.sh ci'
- name: make sure no minikube is running
run: 'minikube delete'
- name: run minikube
run: './run_minikube.sh'
# Runs a single command using the runners shell
- name: Tilt ci
run: '/usr/local/bin/tilt ci'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment