devilbox/.github/workflows/ci-smoke-macos.yml.off
2019-11-24 01:02:51 +01:00

263 lines
7.9 KiB
Plaintext

---
# -------------------------------------------------------------------------------------------------
# Job Name
# -------------------------------------------------------------------------------------------------
name: MacOS
# -------------------------------------------------------------------------------------------------
# When to run
# -------------------------------------------------------------------------------------------------
on:
# Runs on Pull Requests
pull_request:
# Runs on master Branch and Tags
push:
branches:
- master
tags:
- '[0-9]+.[0-9]+*'
# -------------------------------------------------------------------------------------------------
# What to run
# -------------------------------------------------------------------------------------------------
jobs:
smoke_macos:
runs-on: macos-latest
strategy:
fail-fast: false
matrix:
php:
- "7.2"
httpd:
- "nginx-stable"
name: "[PHP ${{ matrix.php }}] vs [${{ matrix.httpd }}]"
steps:
# ------------------------------------------------------------
# Checkout repository
# ------------------------------------------------------------
- name: Checkout repository
uses: actions/checkout@v1
- name: "[Pre] Install Requirements"
shell: bash
run: |
brew install coreutils
brew install bash
brew install socat
- name: "[Pre] Install Docker"
shell: bash
run: |
brew install docker docker-machine-driver-xhyve
sudo chown root:wheel $(brew --prefix)/opt/docker-machine-driver-xhyve/bin/docker-machine-driver-xhyve
sudo chmod u+s $(brew --prefix)/opt/docker-machine-driver-xhyve/bin/docker-machine-driver-xhyve
while ! docker-machine create --driver xhyve default; do
docker-machine rm -f default
sleep 1;
done
# Export variable (this target)
eval "$(docker-machine env default)"
DOCKER_TLS_VERIFY="$( docker-machine env default | grep DOCKER_TLS_VERIFY | sed -e 's/.*="//g' -e 's/"$//g' )"
DOCKER_HOST="$( docker-machine env default | grep DOCKER_HOST | sed -e 's/.*="//g' -e 's/"$//g' )"
DOCKER_CERT_PATH="$( docker-machine env default | grep DOCKER_CERT_PATH | sed -e 's/.*="//g' -e 's/"$//g' )"
DOCKER_MACHINE_NAME="$( docker-machine env default | grep DOCKER_MACHINE_NAME | sed -e 's/.*="//g' -e 's/"$//g' )"
# Export variable (this other targets)
# https://help.github.com/en/actions/automating-your-workflow-with-github-actions/development-tools-for-github-actions#set-an-environment-variable-set-env
echo ::set-env name=DOCKER_TLS_VERIFY::${DOCKER_TLS_VERIFY}
echo ::set-env name=DOCKER_HOST::${DOCKER_HOST}
echo ::set-env name=DOCKER_CERT_PATH::${DOCKER_CERT_PATH}
echo ::set-env name=DOCKER_MACHINE_NAME::${DOCKER_MACHINE_NAME}
# Show info
docker-machine ls
docker-machine env default
docker version
- name: "[Pre] Install Docker Compose"
shell: bash
run: |
sudo curl -L https://github.com/docker/compose/releases/download/1.25.0/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
docker-compose version
- name: "[Pre] Setup Docker machine"
shell: bash
run: |
# Setup DNS records
echo "127.0.0.1 localhost" | sudo tee -a /etc/hosts
# Portforwarding from DOCKER_HOST to local
HOST="$( echo "${DOCKER_HOST}" | sed -e 's|^tcp://||g' -e 's|:.*||g' )"
echo "${HOST}"
sudo socat -s -d -d tcp-listen:80,reuseaddr,fork tcp:${HOST}:80 &
sleep 2
sudo socat -s -d -d tcp-listen:443,reuseaddr,fork tcp:${HOST}:443 &
sleep 2
if ! netstat -an | grep -i LISTEN | grep -E '(:80)|(\.80)\s'; then
netstat -an | grep -i LISTEN;
false;
fi
if ! netstat -an | grep -i LISTEN | grep -E '(:443)|(\.443)\s'; then
netstat -an | grep -i LISTEN;
false;
fi
host localhost
curl -sS -I 'http://localhost:80' || true
curl -sS -I 'https://localhost:443' || true
- name: "[Info] Show environment"
shell: bash
run: |
env
if: success() || failure()
- name: "[Info] Show network"
shell: bash
run: |
netstat -an || true
ss -tlun || true
if: success() || failure()
# ------------------------------------------------------------
# Setup
# ------------------------------------------------------------
- name: Configure
shell: bash
run: |
cd .tests/
# Set the two candidates to test against
make configure KEY=PHP_SERVER VAL=${PHP}
make configure KEY=HTTPD_SERVER VAL=${HTTPD}
# 3306 is taken, so chose another one
make configure KEY=HOST_PORT_MYSQL VAL=3307
env:
PHP: ${{ matrix.php }}
HTTPD: ${{ matrix.httpd }}
if: success() || failure()
- name: Pull images
shell: bash
run: |
cd .tests/
make pull
if: success() || failure()
- name: Startup
shell: bash
run: |
cd .tests/
make start
if: success() || failure()
- name: Docker logs
shell: bash
run: |
cd .tests/
make logs
if: success() || failure()
# ------------------------------------------------------------
# Run tests
# ------------------------------------------------------------
- name: Test Modules
shell: bash
run: |
cd .tests/
make test-smoke-modules
if: success() || failure()
- name: Test Config
shell: bash
run: |
cd .tests/
make test-smoke-config
if: success() || failure()
- name: Test Intranet
shell: bash
run: |
cd .tests/
make test-smoke-intranet
if: success() || failure()
- name: Test Vendors
shell: bash
run: |
cd .tests/
make test-smoke-vendors
if: success() || failure()
- name: Test Vhosts
shell: bash
run: |
cd .tests/
make test-smoke-vhosts
if: success() || failure()
- name: Test Reverse Proxy
shell: bash
run: |
cd .tests/
make test-smoke-rproxies
if: success() || failure()
- name: Test SSL
shell: bash
run: |
cd .tests/
make test-smoke-ssl
if: success() || failure()
- name: Test Bind
shell: bash
run: |
cd .tests/
make test-smoke-bind
if: success() || failure()
- name: Test Autostart
shell: bash
run: |
cd .tests/
make test-smoke-autostart
if: success() || failure()
- name: "Test Framework: CakePHP"
shell: bash
run: |
cd .tests/
make test-smoke-framework-cakephp
if: success() || failure()
- name: "Test Framework: Drupal"
shell: bash
run: |
cd .tests/
make test-smoke-framework-drupal
if: success() || failure()
- name: "Test Framework: Wordpress"
shell: bash
run: |
cd .tests/
make test-smoke-framework-wordpress
if: success() || failure()
# ------------------------------------------------------------
# Finish
# ------------------------------------------------------------
- name: "[Post] Docker logs"
shell: bash
run: |
cd .tests/
make logs
if: success() || failure()