From 997975c82e529cee3fb2f32e9ad404b2920d3652 Mon Sep 17 00:00:00 2001 From: Anthony Chambers Date: Sat, 13 Feb 2021 15:37:03 +0000 Subject: [PATCH 1/7] feat: switch from travis to github actions Required since Travis is going away, and GHA is more neatly integrated, anyway --- .github/workflows/ci.yml | 49 ++++++++++++++++++++++++++++++++++++++++ .travis.yml | 34 ---------------------------- 2 files changed, 49 insertions(+), 34 deletions(-) create mode 100644 .github/workflows/ci.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..b57e222 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,49 @@ +name: CI + +on: [ push ] + +jobs: + build: + runs-on: ${{ matrix.operating-system }} + strategy: + matrix: + operating-system: [ubuntu-latest, windows-latest, macOS-latest] + php-versions: [ '7.1', '7.2', '7.3', '7.4' ] + name: PHP ${{ matrix.php-versions }} ${{ matrix.operating-system }} + steps: + - name: Checkout code + uses: actions/checkout@v2 + - name: Install PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php-versions }} + extensions: intl #optional + ini-values: "post_max_size=256M" #optional + - name: Cache vendor directory + uses: actions/cache@preview + with: + path: vendor + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} + restore-keys: | + ${{ runner.os }}-composer- + - name: Prepare FS + run: mkdir -p build/logs + - name: Validate composer.json and composer.lock + run: composer validate + - name: Install dependencies + run: composer install --prefer-dist --no-progress --no-suggest --no-interaction + - name: PHPUnit + run: vendor/bin/phpunit --coverage-clover build/logs/clover.xml + - name: PHPCS + run: vendor/bin/phpcs --standard=psr2 src/ -n + - name: Coveralls + run: | + composer require --dev php-coveralls/php-coveralls + php vendor/bin/php-coveralls -v + - name: CodeClimate + uses: paambaati/codeclimate-action@v2.7.5 + env: + CC_TEST_REPORTER_ID: ${{secrets.CC_TEST_REPORTER_ID}} + with: + coverageLocations: | + ${{github.workspace}}/build/logs/clover.xml:clover diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index d4b26a1..0000000 --- a/.travis.yml +++ /dev/null @@ -1,34 +0,0 @@ -language: php - -env: - global: - - CC_TEST_REPORTER_ID=7e798e45a94f35d7d9f99f34b8de5d41694eff3f89681b03acd908191efe3e28 - -php: -- 7.1 -- 7.2 -- 7.3 -- 7.4 - -install: -- travis_retry composer install --no-interaction --prefer-source -- composer require --dev php-coveralls/php-coveralls - -before_script: - - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter - - chmod +x ./cc-test-reporter - - ./cc-test-reporter before-build - -script: -- mkdir -p build/logs -- vendor/bin/phpunit --coverage-clover build/logs/clover.xml -- vendor/bin/phpcs --standard=psr2 src/ -n - -matrix: - fast_finish: true - -after_success: -- travis_retry php vendor/bin/php-coveralls -v - -after_script: - - ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT From deed178e47f085de43a273676e3da07ca323bf44 Mon Sep 17 00:00:00 2001 From: Anthony Chambers Date: Sat, 13 Feb 2021 15:41:19 +0000 Subject: [PATCH 2/7] chore: update ci to use coveralls action --- .github/workflows/ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b57e222..53f7d3d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -37,9 +37,9 @@ jobs: - name: PHPCS run: vendor/bin/phpcs --standard=psr2 src/ -n - name: Coveralls - run: | - composer require --dev php-coveralls/php-coveralls - php vendor/bin/php-coveralls -v + uses: coverallsapp/github-action@master + with: + github-token: ${{ secrets.GITHUB_TOKEN }} - name: CodeClimate uses: paambaati/codeclimate-action@v2.7.5 env: From 9e73c80230cb42cfc3b851669f9942f6ea4840cb Mon Sep 17 00:00:00 2001 From: Anthony Chambers Date: Sat, 13 Feb 2021 15:43:02 +0000 Subject: [PATCH 3/7] fix: ci yaml indentation fix --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 53f7d3d..4612b28 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -38,8 +38,8 @@ jobs: run: vendor/bin/phpcs --standard=psr2 src/ -n - name: Coveralls uses: coverallsapp/github-action@master - with: - github-token: ${{ secrets.GITHUB_TOKEN }} + with: + github-token: ${{ secrets.GITHUB_TOKEN }} - name: CodeClimate uses: paambaati/codeclimate-action@v2.7.5 env: From bb299e60f8fa12d1c037212356e772869a63415a Mon Sep 17 00:00:00 2001 From: Anthony Chambers Date: Sat, 13 Feb 2021 15:51:40 +0000 Subject: [PATCH 4/7] refactor: make coverage reports one-time --- .github/workflows/ci.yml | 36 ++++++++++++++++++++++++++---------- 1 file changed, 26 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4612b28..ab163c5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,13 +19,6 @@ jobs: php-version: ${{ matrix.php-versions }} extensions: intl #optional ini-values: "post_max_size=256M" #optional - - name: Cache vendor directory - uses: actions/cache@preview - with: - path: vendor - key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} - restore-keys: | - ${{ runner.os }}-composer- - name: Prepare FS run: mkdir -p build/logs - name: Validate composer.json and composer.lock @@ -36,10 +29,33 @@ jobs: run: vendor/bin/phpunit --coverage-clover build/logs/clover.xml - name: PHPCS run: vendor/bin/phpcs --standard=psr2 src/ -n - - name: Coveralls - uses: coverallsapp/github-action@master + Coverage: + name: Coverage Reports + runs-on: ubuntu-latest + continue-on-error: true + steps: + - name: Checkout code + uses: actions/checkout@v2 + - name: Install PHP + uses: shivammathur/setup-php@v2 with: - github-token: ${{ secrets.GITHUB_TOKEN }} + php-version: 7.4 + extensions: intl #optional + ini-values: "post_max_size=256M" #optional + - name: Prepare FS + run: mkdir -p build/logs + - name: Validate composer.json and composer.lock + run: composer validate + - name: Install dependencies + run: composer install --prefer-dist --no-progress --no-suggest --no-interaction + - name: PHPUnit + run: vendor/bin/phpunit --coverage-clover build/logs/clover.xml + - name: Coveralls + env: + COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + composer global require php-coveralls/php-coveralls + php-coveralls --coverage_clover=build/logs/clover.xml -v - name: CodeClimate uses: paambaati/codeclimate-action@v2.7.5 env: From a44393a3ea4c31bd3afe65e13205a6f9b9854034 Mon Sep 17 00:00:00 2001 From: Anthony Chambers Date: Sat, 13 Feb 2021 15:53:11 +0000 Subject: [PATCH 5/7] fix: yaml indentation again! --- .github/workflows/ci.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ab163c5..10f0606 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -29,7 +29,7 @@ jobs: run: vendor/bin/phpunit --coverage-clover build/logs/clover.xml - name: PHPCS run: vendor/bin/phpcs --standard=psr2 src/ -n - Coverage: + coverage: name: Coverage Reports runs-on: ubuntu-latest continue-on-error: true @@ -53,9 +53,9 @@ jobs: - name: Coveralls env: COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - composer global require php-coveralls/php-coveralls - php-coveralls --coverage_clover=build/logs/clover.xml -v + run: | + composer global require php-coveralls/php-coveralls + php-coveralls --coverage_clover=build/logs/clover.xml -v - name: CodeClimate uses: paambaati/codeclimate-action@v2.7.5 env: From a70df81d9f4524b749dc83fe93d5888e1db11313 Mon Sep 17 00:00:00 2001 From: Anthony Chambers Date: Sat, 13 Feb 2021 15:59:33 +0000 Subject: [PATCH 6/7] chore: adding .gitattributes _Hopefully_ fixes the failing Windows CS tests because of the \r\n linebreaks --- .gitattributes | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..f49596b --- /dev/null +++ b/.gitattributes @@ -0,0 +1,14 @@ +# Set the default behavior, in case people don't have core.autocrlf set. +* text=auto + +# Explicitly declare text files you want to always be normalized and converted +# to native line endings on checkout. +*.php text +*.md text + +# Declare files that will always have CRLF line endings on checkout. +#*.sln text eol=crlf + +# Denote all files that are truly binary and should not be modified. +*.png binary +*.jpg binary From 629445b12bd385c011c5e35d8e551f7562258d3a Mon Sep 17 00:00:00 2001 From: Anthony Chambers Date: Sat, 13 Feb 2021 16:08:03 +0000 Subject: [PATCH 7/7] fix: trying to resolve eol for windows tests --- .gitattributes | 4 ++-- .github/workflows/ci.yml | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.gitattributes b/.gitattributes index f49596b..ffe334e 100644 --- a/.gitattributes +++ b/.gitattributes @@ -3,8 +3,8 @@ # Explicitly declare text files you want to always be normalized and converted # to native line endings on checkout. -*.php text -*.md text +*.php text eol=lf +*.md text eol=lf # Declare files that will always have CRLF line endings on checkout. #*.sln text eol=crlf diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 10f0606..dcf5d61 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,6 +11,10 @@ jobs: php-versions: [ '7.1', '7.2', '7.3', '7.4' ] name: PHP ${{ matrix.php-versions }} ${{ matrix.operating-system }} steps: + - name: Git Configure + run: | + git config --global core.autocrlf false + git config --global core.eol lf - name: Checkout code uses: actions/checkout@v2 - name: Install PHP