Merge pull request #430 from mrrobot47/cleanup/cron #173
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
on: | |
pull_request: | |
push: | |
branches: | |
- master | |
- develop | |
name: Test 👨🔧 | |
jobs: | |
test: #---------------------------------------------------------------------- | |
runs-on: ubuntu-latest | |
name: Behat Tests - PHP ${{ matrix.php }} | |
strategy: | |
fail-fast: false | |
matrix: | |
php: ['7.2', '7.3', '7.4', '8.0'] | |
steps: | |
- name: Check out source code | |
uses: actions/checkout@v2 | |
- name: Get Composer cache directory | |
id: composer-cache | |
run: echo "::set-output name=dir::$(composer config cache-files-dir)" | |
- name: Set up Composer caching | |
uses: actions/cache@v2 | |
env: | |
cache-name: cache-composer-dependencies | |
with: | |
path: ${{ steps.composer-cache.outputs.dir }} | |
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | |
restore-keys: | | |
${{ runner.os }}-composer- | |
- name: Set up PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: '${{ matrix.php }}' | |
coverage: none | |
tools: composer | |
extensions: pcntl, curl, sqlite3, zip, dom, mbstring, json | |
- name: Update docker | |
run: | | |
sudo apt purge nginx nginx-common docker docker-engine docker.io docker-ce containerd runc | |
curl -fsSL https://get.docker.com/ | sudo bash | |
sudo systemctl restart docker.service | |
- name: Install docker-compose | |
run: | | |
VERSION=$(curl --silent "https://api.github.com/repos/docker/compose/releases/latest" | | |
grep '"tag_name":' | | |
sed -E 's/.*"([^"]+)".*/\1/' | |
) | |
sudo curl -L "https://github.com/docker/compose/releases/download/$VERSION/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose | |
- name: Install dependencies | |
run: | | |
cd "$GITHUB_WORKSPACE/.." | |
git clone https://github.com/EasyEngine/easyengine.git easyengine --depth=1 | |
cd easyengine | |
rm -rf features | |
cp -R $GITHUB_WORKSPACE/features . | |
# Run composer install for master else update. | |
if [[ "$GITHUB_REF" = "refs/heads/master" ]]; then | |
composer install --prefer-dist --no-progress --no-interaction | |
else | |
sed -i 's/\(easyengine\/.*\):\ \".*\"/\1:\ \"dev-develop\"/' composer.json | |
composer update --prefer-dist --no-progress --no-interaction | |
fi | |
php -dphar.readonly=0 ./utils/make-phar.php easyengine.phar --quite > /dev/null | |
sudo php easyengine.phar cli info | |
- name: Test | |
shell: 'script -q -e -c "bash {0}"' | |
run: | | |
set -e | |
cd "$GITHUB_WORKSPACE/../easyengine" | |
sudo -E ./vendor/bin/behat | |
env: | |
COMPOSE_INTERACTIVE_NO_CLI: 1 | |
- name: Output logs | |
if: ${{ always() }} | |
run: | | |
[[ -f "/opt/easyengine/logs/install.log" ]] && cat /opt/easyengine/logs/install.log || echo 'No install log.' | |
[[ -f "/opt/easyengine/logs/ee.log" ]] && cat /opt/easyengine/logs/ee.log || echo 'No run log.' | |