From ad7404bfa0c6ddb92fa90c7214249f3d2feb0297 Mon Sep 17 00:00:00 2001 From: Jennifer Mah <42650198+JenniferMah@users.noreply.github.com> Date: Tue, 25 Jan 2022 12:03:01 -0800 Subject: [PATCH] chore: migrate to Github actions (#149) --- .codeclimate.yml | 18 -------- .github/workflows/test-and-deploy.yml | 64 +++++++++++++++++++++++++++ .travis.yml | 35 --------------- README.md | 2 +- test/unit/FilesExistTest.php | 8 +--- 5 files changed, 66 insertions(+), 61 deletions(-) delete mode 100644 .codeclimate.yml create mode 100644 .github/workflows/test-and-deploy.yml delete mode 100644 .travis.yml diff --git a/.codeclimate.yml b/.codeclimate.yml deleted file mode 100644 index 0bd0385..0000000 --- a/.codeclimate.yml +++ /dev/null @@ -1,18 +0,0 @@ -engines: - duplication: - enabled: true - config: - languages: - - "php" - phpcodesniffer: - enabled: true - config: - file_extensions: "php" - standard: "PSR1,PSR2" -ratings: - paths: - - "**.php" -exclude_paths: - - "examples/**/*" - - "test/**/*" - - "vendor/**/*" \ No newline at end of file diff --git a/.github/workflows/test-and-deploy.yml b/.github/workflows/test-and-deploy.yml new file mode 100644 index 0000000..f013d34 --- /dev/null +++ b/.github/workflows/test-and-deploy.yml @@ -0,0 +1,64 @@ +name: Test +on: + push: + branches: [ '*' ] + tags: [ '*' ] + pull_request: + branches: [ main ] + schedule: + # Run automatically at 8AM PST Monday-Friday + - cron: '0 15 * * 1-5' + workflow_dispatch: + +jobs: + test: + name: Test + runs-on: ubuntu-latest + timeout-minutes: 20 + strategy: + matrix: + php: [ 5.6, 7.0, 7.1, 7.2, 7.3, 7.4 ] + dependencies: + - "lowest" + - "highest" + + steps: + - name: Checkout php-http-client + uses: actions/checkout@v2 + + - name: Setup PHP Action + uses: shivammathur/setup-php@2.15.0 + with: + php-version: ${{ matrix.php }} + id: php + + - name: Composer webhook config + run: composer config -g github-oauth.github.com ${{ secrets.GITHUB_TOKEN }} + + - name: Install dependencies + run: composer install + + - name: Update Dependencies + if: ${{ matrix.dependencies == 'lowest' }} + run: composer update --prefer-lowest --prefer-stable -n + + - name: Run Tests + run: make test + + notify-on-failure: + name: Slack notify on failure + if: ${{ failure() && github.ref == 'refs/heads/main' && github.event_name != 'pull_request' }} + needs: [test] + runs-on: ubuntu-latest + steps: + - uses: rtCamp/action-slack-notify@v2 + env: + SLACK_COLOR: failure + SLACK_ICON_EMOJI: ':github:' + SLACK_MESSAGE: ${{ format('Build {2} in {1} failed{3} {0}/{1}/actions/runs/{2}', github.server_url, github.repository, github.run_id, ':') }} + SLACK_TITLE: Build Failure + SLACK_USERNAME: GitHub Actions + SLACK_MSG_AUTHOR: twilio-dx + SLACK_FOOTER: Posted automatically using GitHub Actions + SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} + MSG_MINIMAL: true diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index ecffde3..0000000 --- a/.travis.yml +++ /dev/null @@ -1,35 +0,0 @@ -language: php -php: -- 5.6 -- 7.0 -- 7.1 -- 7.2 -- 7.3 -- 7.4 -env: - matrix: - - dependencies=lowest - - dependencies=highest - global: - - composer_flags="--no-interaction --no-ansi --no-progress --no-suggest --verbose" -before_install: -- composer self-update -- composer clear-cache -install: -- if [ -n "$GIT_HUB_TOKEN" ]; then composer config -g github-oauth.github.com "$GIT_HUB_TOKEN"; - fi; -- if [ "$dependencies" = "highest" ]; then composer update $composer_flags; fi; -- if [ "$dependencies" = "lowest" ]; then composer update $composer_flags --prefer-lowest - --prefer-stable; fi; -script: -- vendor/bin/phpunit test/unit -after_success: -- bash <(curl -s https://codecov.io/bash) -notifications: - slack: - if: branch = main - on_pull_requests: false - on_success: never - on_failure: change - rooms: - secure: EW/neaxTh/KtmV2DB1f3D2vVokKicWFE95t/dFyvwdsg0xW3lZdy2dO1JhOVdetqB4JUpKt5euwgvAf0QMiOVtn4eKhan2viLkK0SIYKy89T+Q8h+QlUNksdUSBGSDTYTs/CwC7408nOgGzGKdwVlr2uHrOnruN3OgMgikXMDykmzucUoiN8NeS1rMrjkRG5VqjnA2zkhhTyRfYBuM14hy6g8KDXQWUDRsdty7N7hwALe1R/h9jULSKUWh2eY2zsv6KVFvlsHABBCYUBSE9SRNH5QigkR1D0iLbaRixyfPOdza2vHq4blsQKLKf2j4XTV8hP+o0Mce8hmEFx9M4K66EpoYZDFsBQgB9kQGaCP6GuOH/isnujOGu0YmKrHruB6ByK0Exec4XuwrdI3IWYAe1EjHfa9yC1dJ1MR8rEGgsNCSrJcjlbH8XWgelMprLnCSciKM0uEt11k6ogHd9plE6T2cXEwrtDPGa9FwkIfDeOE6AndF9PkoCptiFpH/PKRfouc9UqYUZTsSTf556GciHOelMphNey0ODIbpZc8NwwgnMwFeHwnx8l0olZvjhFtnkESmdegO26WYA4dYKrykQNc96yz2iji8hbE/NYoyNLv54DDhDH0cTDMYqGfJXGvVcB48kP2BT5A8inGXCL7QgjT0LKNb0kYBXw669Olvk= diff --git a/README.md b/README.md index 880fa3a..d249e67 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ ![SendGrid Logo](twilio_sendgrid_logo.png) -[![Travis Badge](https://travis-ci.com/sendgrid/php-http-client.svg?branch=main)](https://travis-ci.com/sendgrid/php-http-client) +[![Tests](https://github.com/sendgrid/php-http-client/actions/workflows/test-and-deploy.yml/badge.svg)](https://github.com/sendgrid/php-http-client/actions/workflows/test-and-deploy.yml) [![Latest Version on Packagist](https://img.shields.io/packagist/v/sendgrid/php-http-client.svg?style=flat-square)](https://packagist.org/packages/sendgrid/php-http-client) [![Twitter Follow](https://img.shields.io/twitter/follow/sendgrid.svg?style=social&label=Follow)](https://twitter.com/sendgrid) [![GitHub contributors](https://img.shields.io/github/contributors/sendgrid/php-http-client.svg)](https://github.com/sendgrid/php-http-client/graphs/contributors) diff --git a/test/unit/FilesExistTest.php b/test/unit/FilesExistTest.php index 7cc027b..c160381 100644 --- a/test/unit/FilesExistTest.php +++ b/test/unit/FilesExistTest.php @@ -11,9 +11,7 @@ public function testFileArePresentInRepo() $rootDir = __DIR__ . '/../..'; $this->assertFileExists("$rootDir/.gitignore"); - #$this->assertFileExists("$rootDir/.env_sample"); - $this->assertFileExists("$rootDir/.travis.yml"); - $this->assertFileExists("$rootDir/.codeclimate.yml"); + $this->assertFileExists("$rootDir/.github/workflows/test-and-deploy.yml"); $this->assertFileExists("$rootDir/CHANGELOG.md"); $this->assertFileExists("$rootDir/CODE_OF_CONDUCT.md"); $this->assertFileExists("$rootDir/CONTRIBUTING.md"); @@ -24,9 +22,5 @@ public function testFileArePresentInRepo() $this->assertFileExists("$rootDir/README.md"); $this->assertFileExists("$rootDir/TROUBLESHOOTING.md"); $this->assertFileExists("$rootDir/USAGE.md"); - #$this->assertFileExists("$rootDir/USE_CASES.md"); - - #$composeExists = file_exists('./docker-compose.yml') || file_exists('./docker/docker-compose.yml'); - #$this->assertTrue($composeExists); } }