From 0649cd9705a33e8be1f9b3eb76ca93a1b5ae899e Mon Sep 17 00:00:00 2001 From: azjezz Date: Sun, 15 Nov 2020 16:48:21 +0100 Subject: [PATCH] migrate to github actions --- .gitattributes | 6 +- .github/workflows/coding-standards.yml | 96 +++++++++++++++++++++++ .github/workflows/hhvm.gpg | 36 +++++++++ .github/workflows/static-analysis.yml | 101 +++++++++++++++++++++++++ .github/workflows/unit-tests.yml | 101 +++++++++++++++++++++++++ .travis.sh | 30 -------- .travis.yml | 24 ------ 7 files changed, 337 insertions(+), 57 deletions(-) create mode 100644 .github/workflows/coding-standards.yml create mode 100644 .github/workflows/hhvm.gpg create mode 100644 .github/workflows/static-analysis.yml create mode 100644 .github/workflows/unit-tests.yml delete mode 100755 .travis.sh delete mode 100644 .travis.yml diff --git a/.gitattributes b/.gitattributes index 0e5711a..10fadf7 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,5 +1,5 @@ *.hack linguist-language=Hack -/tests export-ignore -.travis.sh export-ignore -.travis.yml export-ignore +/tests/ export-ignore +/.github/ export-ignore +composer.lock export-ignore diff --git a/.github/workflows/coding-standards.yml b/.github/workflows/coding-standards.yml new file mode 100644 index 0000000..9b21701 --- /dev/null +++ b/.github/workflows/coding-standards.yml @@ -0,0 +1,96 @@ +name: "coding standards" + +on: ["pull_request", "push"] + +jobs: + coding-standards: + name: "coding standards" + + runs-on: ${{ matrix.os }} + + strategy: + matrix: + dependencies: + - "lowest" + - "highest" + hhvm: + - "4.83" + - "latest" + - "nightly" + os: + - "macos-latest" + - "ubuntu-latest" + + steps: + - name: "checkout" + uses: "actions/checkout@v2" + + - name: "installing PHP" + uses: "shivammathur/setup-php@v2" + with: + php-version: "7.4" + tools: composer + + - name: "inspecting PHP and Composer versions" + run: | + php --version + composer --version + + - name: "installing HHVM (apt)" + if: matrix.os == 'ubuntu-latest' + run: | + set -ex + export DEBIAN_FRONTEND=noninteractive + sudo apt-get update + sudo apt-get install -y software-properties-common apt-transport-https + sudo apt-key add .github/workflows/hhvm.gpg + if [ "${{matrix.hhvm}}" = 'nightly' ]; then + sudo add-apt-repository https://dl.hhvm.com/ubuntu + sudo apt-get install -y hhvm-nightly + elif [ "${{matrix.hhvm}}" = 'latest' ]; then + sudo add-apt-repository https://dl.hhvm.com/ubuntu + sudo apt-get install -y hhvm + else + DISTRO=$(lsb_release --codename --short) + sudo add-apt-repository \ + "deb https://dl.hhvm.com/ubuntu ${DISTRO}-${{matrix.hhvm}} main" + sudo apt-get install -y hhvm + fi + + - name: "installing HHVM (brew)" + if: matrix.os == 'macos-latest' + run: | + brew tap hhvm/hhvm + if [ "${{matrix.hhvm}}" = 'latest' ]; then + brew install hhvm + else + brew install hhvm-${{matrix.hhvm}} + fi + + - name: "inspecting HHVM and Hack versions" + run: | + hhvm --version + hh_client --version + + - name: "caching dependencies" + uses: "actions/cache@v2" + with: + path: | + ~/.composer/cache + vendor + key: "hhvm-${{ matrix.hhvm }}-${{ matrix.os }}" + restore-keys: "hhvm-dependencies-${{ matrix.php-version }}-${{ matrix.os }}" + + - name: "installing lowest dependencies" + if: ${{ matrix.dependencies == 'lowest' }} + run: "composer update --prefer-lowest --no-interaction --no-progress" + + - name: "installing highest dependencies" + if: ${{ matrix.dependencies == 'highest' }} + run: "composer update --no-interaction --no-progress" + + - name: "dumping autoloader" + run: "hhvm vendor/bin/hh-autoload" + + - name: "lint" + run: "hhvm vendor/bin/hhast-lint" diff --git a/.github/workflows/hhvm.gpg b/.github/workflows/hhvm.gpg new file mode 100644 index 0000000..cd32c2f --- /dev/null +++ b/.github/workflows/hhvm.gpg @@ -0,0 +1,36 @@ +-----BEGIN PGP PUBLIC KEY BLOCK----- +Version: GnuPG v1 + +mQINBFn8koEBEAC2tPtkphj8gZYHI9mTNUHfQalDo+MNWTGUTNB42asjhTNjipzM +VSxjaZSl5cMLg5YCRuT0AbSIe529FH23yEElc03cGVGgoEnmXtE4+2v7Xa30wCGO +5oUxKfbVatsxEs1y8QEr5Gt+CUFmsApOKgiZq0M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375okr/RLP/pC4/x8ZM6GqLv4qTEOk6qWM7hWXhPRJ1TSVgCHv19 +jki5AkwV4EcROpFmJzfW6V9i4swJKJvYXLr58W0vogsUc8zqII4Sl7JUKZ/oN4jQ +QX138r85fLawla/R0i30njmY7fJYKRwHeshgwHg6vqKobTiPuLarwn0Arv7G7ILP +RjbH/8Pi+U2l8Fm/SjHMZA6gcJteRHjTgjkxSAZ19MyA08YqahJafRUVDY9QhUJb +FkHhptZRf9qRji3+Njhog6s8EGACJSEOwmngAViFVz+UUyOXY94yoHvb19meNecj +ArL3604gOqX3TSSWD1Dcu4kBMwQTAQgAHRYhBDau9k0CB+fu41LUh1oW5ygb56RJ +BQJZ/JVnAAoJEFoW5ygb56RJ15oH/0g4hrylc79TD9xA1vEUexyOdWniY4lwH9yI +/DaFznIMsE1uxmZ0FE9VX5Ks8IFR+3P9mNDQVf9xlVhnR7N597aKtU5GrpbvtlJy +CoQVtzBqYKcuLC4ZFRiB33HwZrZIxTPH27UUaj1QBz748zIMC6wvtldshjNAAeRr +Jz28twPO2D7svNIaPt2+OXAuRs2yUhitcsDLBV0UlOQ8xH+hzWANyhaJAS7p0k35 +kyFOG+n6+2qQkGdlHHuqEzdCL3EiOiK6RrvbWNUnwiG3BdZWgs43hZZBAseX3CHu +MM3vIX/Fc/kuuaCWi2ysyKf7jyi/RiVIAKuLbxAB8eHsyo2G5lA= +=3DTP +-----END PGP PUBLIC KEY BLOCK----- diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml new file mode 100644 index 0000000..ce9af4f --- /dev/null +++ b/.github/workflows/static-analysis.yml @@ -0,0 +1,101 @@ +name: "static analysis" + +on: ["pull_request", "push"] + +jobs: + static-analysis: + name: "static analysis" + + runs-on: ${{ matrix.os }} + + strategy: + matrix: + dependencies: + - "lowest" + - "highest" + - "locked" + hhvm: + - "4.83" + - "latest" + - "nightly" + os: + - "macos-latest" + - "ubuntu-latest" + + steps: + - name: "checkout" + uses: "actions/checkout@v2" + + - name: "installing PHP" + uses: "shivammathur/setup-php@v2" + with: + php-version: "7.4" + tools: composer + + - name: "inspecting PHP and Composer versions" + run: | + php --version + composer --version + + - name: "installing HHVM (apt)" + if: matrix.os == 'ubuntu-latest' + run: | + set -ex + export DEBIAN_FRONTEND=noninteractive + sudo apt-get update + sudo apt-get install -y software-properties-common apt-transport-https + sudo apt-key add .github/workflows/hhvm.gpg + if [ "${{matrix.hhvm}}" = 'nightly' ]; then + sudo add-apt-repository https://dl.hhvm.com/ubuntu + sudo apt-get install -y hhvm-nightly + elif [ "${{matrix.hhvm}}" = 'latest' ]; then + sudo add-apt-repository https://dl.hhvm.com/ubuntu + sudo apt-get install -y hhvm + else + DISTRO=$(lsb_release --codename --short) + sudo add-apt-repository \ + "deb https://dl.hhvm.com/ubuntu ${DISTRO}-${{matrix.hhvm}} main" + sudo apt-get install -y hhvm + fi + + - name: "installing HHVM (brew)" + if: matrix.os == 'macos-latest' + run: | + brew tap hhvm/hhvm + if [ "${{matrix.hhvm}}" = 'latest' ]; then + brew install hhvm + else + brew install hhvm-${{matrix.hhvm}} + fi + + - name: "inspecting HHVM and Hack versions" + run: | + hhvm --version + hh_client --version + + - name: "caching dependencies" + uses: "actions/cache@v2" + with: + path: | + ~/.composer/cache + vendor + key: "hhvm-${{ matrix.hhvm }}-${{ matrix.os }}" + restore-keys: "hhvm-dependencies-${{ matrix.php-version }}-${{ matrix.os }}" + + - name: "installing lowest dependencies" + if: ${{ matrix.dependencies == 'lowest' }} + run: "composer update --prefer-lowest --no-interaction" + + - name: "installing highest dependencies" + if: ${{ matrix.dependencies == 'highest' }} + run: "composer update --no-interaction" + + - name: "installing locked dependencies" + if: ${{ matrix.dependencies == 'locked' }} + run: "composer install --no-interaction" + + - name: "dumping autoloader" + run: "hhvm vendor/bin/hh-autoload" + + - name: "static analysis" + run: "hh_client" diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml new file mode 100644 index 0000000..12d0b44 --- /dev/null +++ b/.github/workflows/unit-tests.yml @@ -0,0 +1,101 @@ +name: "unit tests" + +on: ["pull_request", "push"] + +jobs: + unit-tests: + name: "unit tests" + + runs-on: ${{ matrix.os }} + + strategy: + matrix: + dependencies: + - "lowest" + - "highest" + - "locked" + hhvm: + - "4.83" + - "latest" + - "nightly" + os: + - "macos-latest" + - "ubuntu-latest" + + steps: + - name: "checkout" + uses: "actions/checkout@v2" + + - name: "installing PHP" + uses: "shivammathur/setup-php@v2" + with: + php-version: "7.4" + tools: composer + + - name: "inspecting PHP and Composer versions" + run: | + php --version + composer --version + + - name: "installing HHVM (apt)" + if: matrix.os == 'ubuntu-latest' + run: | + set -ex + export DEBIAN_FRONTEND=noninteractive + sudo apt-get update + sudo apt-get install -y software-properties-common apt-transport-https + sudo apt-key add .github/workflows/hhvm.gpg + if [ "${{matrix.hhvm}}" = 'nightly' ]; then + sudo add-apt-repository https://dl.hhvm.com/ubuntu + sudo apt-get install -y hhvm-nightly + elif [ "${{matrix.hhvm}}" = 'latest' ]; then + sudo add-apt-repository https://dl.hhvm.com/ubuntu + sudo apt-get install -y hhvm + else + DISTRO=$(lsb_release --codename --short) + sudo add-apt-repository \ + "deb https://dl.hhvm.com/ubuntu ${DISTRO}-${{matrix.hhvm}} main" + sudo apt-get install -y hhvm + fi + + - name: "installing HHVM (brew)" + if: matrix.os == 'macos-latest' + run: | + brew tap hhvm/hhvm + if [ "${{matrix.hhvm}}" = 'latest' ]; then + brew install hhvm + else + brew install hhvm-${{matrix.hhvm}} + fi + + - name: "inspecting HHVM and Hack versions" + run: | + hhvm --version + hh_client --version + + - name: "caching dependencies" + uses: "actions/cache@v2" + with: + path: | + ~/.composer/cache + vendor + key: "hhvm-${{ matrix.hhvm }}-${{ matrix.os }}" + restore-keys: "hhvm-dependencies-${{ matrix.php-version }}-${{ matrix.os }}" + + - name: "installing lowest dependencies" + if: ${{ matrix.dependencies == 'lowest' }} + run: "composer update --prefer-lowest --no-interaction" + + - name: "installing highest dependencies" + if: ${{ matrix.dependencies == 'highest' }} + run: "composer update --no-interaction" + + - name: "installing locked dependencies" + if: ${{ matrix.dependencies == 'locked' }} + run: "composer install --no-interaction" + + - name: "dumping autoloader" + run: "hhvm vendor/bin/hh-autoload" + + - name: "running unit tests" + run: "hhvm vendor/bin/hacktest tests" diff --git a/.travis.sh b/.travis.sh deleted file mode 100755 index 0b7de45..0000000 --- a/.travis.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/sh -set -ex -apt update -y -DEBIAN_FRONTEND=noninteractive apt install -y php-cli zip unzip -hhvm --version -php --version -if [ ! -e .git/refs/heads/master ]; then - # - Travis clones with `--branch`, then moves to a detached HEAD state - # - if we're on a detached HEAD, Composer uses master to resolve branch - # aliases. - # So, create the master branch :p - git branch master HEAD -fi - -( - cd $(mktemp -d) - curl https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer -) - -if (hhvm --version | grep -q -- -dev); then - # Doesn't exist in master, but keep it here so that we can test release - # branches on nightlies too - rm -f composer.lock -fi - -composer --version - -composer install - -composer check diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index c8ff078..0000000 --- a/.travis.yml +++ /dev/null @@ -1,24 +0,0 @@ -dist: trusty -language: shell -services: docker -os: - - linux - -env: - - HHVM_VERSION=4.56-latest - - HHVM_VERSION=latest - - HHVM_VERSION=nightly - -jobs: - allow_failures: - - env: HHVM_VERSION=nightly - -install: - - docker pull hhvm/hhvm:$HHVM_VERSION - -script: - - docker run --rm -w /var/source -v $(pwd):/var/source hhvm/hhvm:$HHVM_VERSION ./.travis.sh - -notifications: - slack: - secure: fZ74Yt9xxelrIZiWBe74X6zCNV+RCbI2aD0EjB8P6d3ovIdyHc+JOe/AFDwUwU8tuKBYt1DpiMnw/rFQQwu2Y6CQnAjgGtG+ScCCVhy5OJvHqFTmMt/XMs9Hrgdylak3IofaI6D/4Du+E9ZMXHgXGVgjQQr0SNMsj1s70sSd97oiW4t4Kn5hxlAbZK7EWCs2BWwyTtVJD96UOEJrBK59lD0wQvfv0wSV948Wwnms70cPgO26Fa+pdBGsv4Ho475Dzu/y4JuO/kqMMzodZtMSm7FNDrppwqgX3qYkfGBI/foQ5IpBn5gGcG5w3RhZLXsNhLDrULcEHtF1Ptfo5PQGUArN8KPRf91Mju2CGICg3wy6GMEm+iXHdPWzUkCaQPhw4ty6ix+fm2ELatXW4BGGXANJzL6UNUGuQPh4Z2oVeX8zEFpUAA+PJRzd6FPYdQDdI3Xj8P445x/KQ+Mg4f2wCR/YKTkjWbkYKzqvjvssgrDGkbQfhXWAOr5/NgKj0/vRovT66Tra14UncjZdM6yHUOqeMq5KfDboEBXoj7+jZG1cQmtSErUoFF2CUyI/Jqva7symsJbjOYSVTKv6BAgoL+CncdLcTPGFLzavLiavkqp4Gd3ErWoeOWqFY0ZYByY4cLcnwLtL0TrY6Y9fdzFeJLmN6xhxTteuw3Ils66K/fw=