From 8b53e4150e8eaa718d49973d49042bcf1faaa1bf Mon Sep 17 00:00:00 2001 From: Dylan T Date: Fri, 11 Dec 2020 22:25:08 +0000 Subject: [PATCH] Setup GitHub Actions (#3966) --- .github/workflows/main.yml | 59 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 000000000..fef4346f8 --- /dev/null +++ b/.github/workflows/main.yml @@ -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