Setup GitHub Actions (#3966)

This commit is contained in:
Dylan T 2020-12-11 22:25:08 +00:00 committed by GitHub
parent 1c43538238
commit 8b53e4150e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

59
.github/workflows/main.yml vendored Normal file
View File

@ -0,0 +1,59 @@
name: CI
on:
push:
pull_request:
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# 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
with:
submodules: true
- name: Restore PHP build cache
id: php-build-cache
uses: actions/cache@v2
with:
path: "./bin"
key: "php-build-generic-${{ hashFiles('./build/php/compile.sh') }}"
- name: Compile PHP
if: steps.php-build-cache.outputs.cache-hit != 'true'
run: |
sudo apt update && sudo apt install -y re2c libtool libtool-bin
march=x86-64 ./build/php/compile.sh -j8
- name: Prefix PHP to PATH
run: echo "$(pwd)/bin/php7/bin" >> $GITHUB_PATH
- name: Install Composer
run: curl -sS https://getcomposer.org/installer | php
- name: Restore Composer package cache
uses: actions/cache@v2
with:
path: |
~/.composer/cache/files
~/.composer/cache/vcs
key: composer-cache
- name: Install Composer dependencies
run: php composer.phar install --prefer-dist --no-interaction
- name: Run PHPStan
run: ./vendor/bin/phpstan analyze --no-progress --memory-limit=2G
- name: Run PHPUnit tests
run: ./vendor/bin/phpunit --bootstrap vendor/autoload.php --fail-on-warning tests/phpunit
- name: Run integration tests
run: ./tests/travis.sh -t4