diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml new file mode 100644 index 0000000..2533199 --- /dev/null +++ b/.github/workflows/build-and-test.yml @@ -0,0 +1,67 @@ +name: Continuous Integration +on: + push: + pull_request: + schedule: + - cron: '42 15 * * *' +jobs: + build: + name: HHVM ${{matrix.hhvm}} - ${{matrix.os}} + strategy: + # Run tests on all OS's and HHVM versions, even if one fails + fail-fast: false + matrix: + os: [ ubuntu ] + hhvm: + - '4.62' + - latest + - nightly + runs-on: ${{matrix.os}}-latest + steps: + - uses: actions/checkout@v2 + - name: Install Composer + run: .github/workflows/install-composer.sh --install-dir=${{runner.temp}} + - name: Install HHVM (apt) + if: matrix.os == 'ubuntu' + 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.key + 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: Install HHVM (brew) + if: matrix.os == 'macos' + run: | + brew tap hhvm/hhvm + if [ "${{matrix.hhvm}}" = "latest" ]; then + brew install hhvm + else + brew install hhvm-${{matrix.hhvm}} + fi + - name: Inspect HHVM and Hack versions + run: | + hhvm --version + hh_client --version + - name: Create branch for version alias + run: git checkout -b CI_current_pull_request + - name: Install project dependencies + run: php ${{runner.temp}}/composer.phar install + - name: Typecheck + run: hh_client + - name: Run tests + run: vendor/bin/hacktest tests/ + - name: Run lint + if: matrix.hhvm != 'nightly' + run: vendor/bin/hhast-lint diff --git a/.github/workflows/hhvm.gpg.key b/.github/workflows/hhvm.gpg.key new file mode 100644 index 0000000..cd32c2f --- /dev/null +++ b/.github/workflows/hhvm.gpg.key @@ -0,0 +1,36 @@ +-----BEGIN PGP PUBLIC KEY BLOCK----- +Version: GnuPG v1 + +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 +=3DTP +-----END PGP PUBLIC KEY BLOCK----- diff --git a/.github/workflows/install-composer.sh b/.github/workflows/install-composer.sh new file mode 100755 index 0000000..94d1d81 --- /dev/null +++ b/.github/workflows/install-composer.sh @@ -0,0 +1,19 @@ +#!/bin/sh + +# From https://getcomposer.org/doc/faqs/how-to-install-composer-programmatically.md + +EXPECTED_CHECKSUM="$(wget -q -O - https://composer.github.io/installer.sig)" +php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" +ACTUAL_CHECKSUM="$(php -r "echo hash_file('sha384', 'composer-setup.php');")" + +if [ "$EXPECTED_CHECKSUM" != "$ACTUAL_CHECKSUM" ] +then + >&2 echo 'ERROR: Invalid installer checksum' + rm composer-setup.php + exit 1 +fi + +php composer-setup.php "$@" +RESULT=$? +rm composer-setup.php +exit $RESULT diff --git a/.travis.sh b/.travis.sh deleted file mode 100755 index 02daa4b..0000000 --- a/.travis.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/sh -set -ex -apt update -y -DEBIAN_FRONTEND=noninteractive apt install -y php-cli zip unzip -hhvm --version -php --version - -( - cd $(mktemp -d) - curl https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer -) -composer install - -hh_client - -vendor/bin/hacktest tests/ -# In prod, we have caching and no fallback handler. Check it. -HH_FORCE_IS_DEV=0 vendor/bin/hacktest tests/ -if !(hhvm --version | grep -q -- -dev); then - vendor/bin/hhast-lint -fi diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 9ace7ad..0000000 --- a/.travis.yml +++ /dev/null @@ -1,14 +0,0 @@ -sudo: required -language: generic -services: docker -env: -- HHVM_VERSION=4.62-latest -- HHVM_VERSION=latest -- 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: NzOQEd043YXWNPXrwYQLOZM86g3vHdJWNLtyXXSrGEH6565e62EaSfjmDldubnlwdVLBxAfF2JPAAcWgBpOZd3w3zF6+sKz/rl2fbOfHDEixLAEnpn9mqX6AYjs7/nj8+6nxeG5Vgjpy4FDCArQDwI6iTjohtyWFMYWmim90DfPNjZNijRt0P6wwPSJCTA9bH8bSHgiHr8cfVhGE2PQ0pNgeSWGSLLtrbrv8PJoVf15zW/I/CTMUHxEG7fd52YCqenk9ksnY1JZWbFamFFHUGJfHHAhsD5/O72r40CWJzC7o4dkOovup5plaJ4WhpYrBWKYIrXui3Ql98Dk7P0O3TBJc8K3ASpkBfiPR9sBvVu9HKOiZlD8fCXoFagrQSzXyYnKPJvI4sm546Evd1nx6iVDf2u11+hNzJKGp4wyzbkjOZjUgQI4rGuC34iPYUX8lTfzjJ2HDwKd3dQ2wa3FxcQX/e1r3cK+e7TahMFHZb1axn0Z83jK8Dh8NBnonjoK3pGgozqlWQlRlz7rxPair8OMVGFJ2jj0KAxEP0/uPtJgKy8LPt+m3haXO0FFZOFn3zkVPP/YDKOGmaaeaH3TTPPOq1MG0qnbcICRUH2/eJ0Rj8Uagxi7qW+VVC96pVkeBvDp9ULFDLFj0+AY49Do678QGijBMOyriwb5sRcGT7oQ= diff --git a/src/uri-patterns/UriPattern.php b/src/uri-patterns/UriPattern.php index 2a9ce04..bb31416 100644 --- a/src/uri-patterns/UriPattern.php +++ b/src/uri-patterns/UriPattern.php @@ -30,16 +30,13 @@ final public function getParts(): ImmVector { } final public function getParameters(): ImmVector { - return $this - ->parts - ->filter($x ==> $x is UriParameter) - ->map( - $x ==> { - assert($x is UriParameter); - return $x; - }, - ) - ->immutable(); + $out = Vector {}; + foreach($this->parts as $part) { + if($part is UriParameter) { + $out->add($part); + } + } + return $out->immutable(); } ///// Convenience Methods /////