#!/bin/sh
#
# Execute the Circle CI jobs locally
#
# @author      Steve Talbot
# @copyright   Copyright (c) Solviq Ltd 2019
# @license     MIT

# CircleCI checkout is based on git ls-files
if [ -f .circleci/local.env ]; then
    git add -f .circleci/local.env
fi

mkdir -p .tmp
circleci config process .circleci/config.yml >.tmp/circleci-config.yml

circleci local execute --skip-checkout --job build-php73 --config .tmp/circleci-config.yml
circleci local execute --skip-checkout --job build-php70 --config .tmp/circleci-config.yml
circleci local execute --skip-checkout --job build-php56 --config .tmp/circleci-config.yml

# Ensure local.env is not committed by accident
if [ -f .circleci/local.env ]; then
    git rm --cached .circleci/local.env
fi
