From 249529480db5b19ad898fdc2da7d087c4e00020a Mon Sep 17 00:00:00 2001 From: azjezz Date: Thu, 1 Oct 2020 01:35:21 +0100 Subject: [PATCH] migrate from travis ci to github actions --- .coveralls.yml | 3 -- .github/workflows/coding-standards.yml | 25 +++++++++++ .github/workflows/security-analysis.yml | 25 +++++++++++ .github/workflows/static-analysis.yml | 25 +++++++++++ .github/workflows/unit-tests.yml | 56 +++++++++++++++++++++++++ .travis.yml | 41 ------------------ README.md | 5 ++- composer.json | 4 +- 8 files changed, 137 insertions(+), 47 deletions(-) delete mode 100644 .coveralls.yml create mode 100644 .github/workflows/coding-standards.yml create mode 100644 .github/workflows/security-analysis.yml create mode 100644 .github/workflows/static-analysis.yml create mode 100644 .github/workflows/unit-tests.yml delete mode 100644 .travis.yml diff --git a/.coveralls.yml b/.coveralls.yml deleted file mode 100644 index 428247c..0000000 --- a/.coveralls.yml +++ /dev/null @@ -1,3 +0,0 @@ -coverage_clover: tests/logs/clover.xml -json_path: tests/logs/coveralls-upload.json -service_name: travis-ci diff --git a/.github/workflows/coding-standards.yml b/.github/workflows/coding-standards.yml new file mode 100644 index 0000000..8097bfd --- /dev/null +++ b/.github/workflows/coding-standards.yml @@ -0,0 +1,25 @@ +name: "coding standards" + +on: ["pull_request", "push"] + +jobs: + coding-standards: + name: "coding standards" + runs-on: "ubuntu-latest" + steps: + - name: "checkout" + uses: "actions/checkout@v2" + + - name: "installing PHP" + uses: "shivammathur/setup-php@v2" + with: + php-version: "7.4" + ini-values: memory_limit=-1 + tools: composer:v2 + extensions: bcmath, mbstring, intl, sodium, json + + - name: "installing dependencies" + run: "composer update --no-interaction --no-progress" + + - name: "checking coding standards ( codesniffer )" + run: "composer cs:check" diff --git a/.github/workflows/security-analysis.yml b/.github/workflows/security-analysis.yml new file mode 100644 index 0000000..2d8df44 --- /dev/null +++ b/.github/workflows/security-analysis.yml @@ -0,0 +1,25 @@ +name: "security analysis" + +on: ["pull_request", "push"] + +jobs: + security-analysis: + name: "security anaylsis" + runs-on: "ubuntu-latest" + steps: + - name: "checkout" + uses: "actions/checkout@v2" + + - name: "installing PHP" + uses: "shivammathur/setup-php@v2" + with: + php-version: "7.4" + ini-values: memory_limit=-1 + tools: composer:v2 + extensions: bcmath, mbstring, intl, sodium, json + + - name: "installing dependencies" + run: "composer update --no-interaction --no-progress" + + - name: "running security analysis ( psalm )" + run: "composer security:analysis" diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml new file mode 100644 index 0000000..362aa3c --- /dev/null +++ b/.github/workflows/static-analysis.yml @@ -0,0 +1,25 @@ +name: "static analysis" + +on: ["pull_request", "push"] + +jobs: + static-analysis: + name: "static anaylsis" + runs-on: "ubuntu-latest" + steps: + - name: "checkout" + uses: "actions/checkout@v2" + + - name: "installing PHP" + uses: "shivammathur/setup-php@v2" + with: + php-version: "7.4" + ini-values: memory_limit=-1 + tools: composer:v2 + extensions: bcmath, mbstring, intl, sodium, json + + - name: "installing dependencies" + run: "composer update --no-interaction --no-progress" + + - name: "running static analysis ( psalm )" + run: "vendor/bin/psalm --output-format=github --shepherd --stats" diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml new file mode 100644 index 0000000..b893a2e --- /dev/null +++ b/.github/workflows/unit-tests.yml @@ -0,0 +1,56 @@ +name: "unit tests" + +on: ["pull_request", "push"] + +jobs: + unit-tests: + name: "unit tests" + + runs-on: ${{ matrix.operating-system }} + + strategy: + matrix: + dependencies: + - "highest" + php-version: + - "7.4" + operating-system: + - "ubuntu-latest" + + steps: + - name: "checkout" + uses: "actions/checkout@v2" + + - name: "installing PHP" + uses: "shivammathur/setup-php@v2" + with: + coverage: "pcov" + php-version: "${{ matrix.php-version }}" + ini-values: memory_limit=-1 + tools: composer:v2, cs2pr + extensions: bcmath, mbstring, intl, sodium, json + + - name: "caching dependencies" + uses: "actions/cache@v2" + with: + path: | + ~/.composer/cache + vendor + key: "php-${{ matrix.php-version }}-${{ matrix.dependencies }}" + restore-keys: "php-${{ matrix.php-version }}-${{ matrix.dependencies }}" + + - 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: "running unit tests ( phpunit )" + run: "composer test:unit" + + - name: "sending code coverage data to coveralls" + env: + COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: "composer code:coverage" diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index e2f9087..0000000 --- a/.travis.yml +++ /dev/null @@ -1,41 +0,0 @@ -dist: trusty -language: php -sudo: required -os: - - linux - -jobs: - include: - - php: 7.4 - - php: nightly - env: NIGHTLY_BUILD=true - allow_failures: - - env: NIGHTLY_BUILD=true - fast_finish: true - -cache: - directories: - - $HOME/.composer/cache/files - - -before_install: - - git clone -b stable https://github.com/jedisct1/libsodium.git - - cd libsodium && sudo ./configure && sudo make check && sudo make install && cd .. - -install: - - pecl channel-update pecl.php.net - - pecl install libsodium - - php --version - - composer self-update - - composer --version - - if [[ $NIGHTLY_BUILD = 'true' ]]; then composer install --ignore-platform-reqs; else composer install; fi - -script: - - composer test:unit - - if [[ $NIGHTLY_BUILD != 'true' ]]; then composer cs:check; fi - - if [[ $NIGHTLY_BUILD != 'true' ]]; then composer type:check; fi - - if [[ $NIGHTLY_BUILD != 'true' ]]; then composer security:analysis; fi - -after_script: - - if [[ $NIGHTLY_BUILD != 'true' ]]; then composer code:coverage; fi - - if [[ $NIGHTLY_BUILD != 'true' ]]; then composer type:coverage; fi diff --git a/README.md b/README.md index f91156a..7dbb102 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,9 @@ # Psl - PHP Standard Library -[![TravisCI Build Status](https://travis-ci.com/azjezz/psl.svg?branch=develop)](https://travis-ci.com/azjezz/psl) +![unit tests status](https://github.com/azjezz/psl/workflows/.github/workflows/unit-tests.yml/badge.svg?branch=develop) +![static analysis status](https://github.com/azjezz/psl/workflows/.github/workflows/static-analysis.yml/badge.svg?branch=develop) +![security analysis status](https://github.com/azjezz/psl/workflows/.github/workflows/security-analysis.yml/badge.svg?branch=develop) +![coding standards status](https://github.com/azjezz/psl/workflows/.github/workflows/coding-standards.yml/badge.svg?branch=develop) [![Scrutinizer Build Status](https://scrutinizer-ci.com/g/azjezz/psl/badges/build.png?b=develop)](https://scrutinizer-ci.com/g/azjezz/psl/build-status/develop) [![Coverage Status](https://coveralls.io/repos/github/azjezz/psl/badge.svg?branch=develop)](https://coveralls.io/github/azjezz/psl?branch=develop) [![Type Coverage](https://shepherd.dev/github/azjezz/psl/coverage.svg)](https://shepherd.dev/github/azjezz/psl) diff --git a/composer.json b/composer.json index 5dfbc45..5223724 100644 --- a/composer.json +++ b/composer.json @@ -19,7 +19,7 @@ "require-dev": { "vimeo/psalm": "dev-master", "phpunit/phpunit": "^9.0", - "php-coveralls/php-coveralls": "^2.2", + "cedx/coveralls": "^13.2", "roave/security-advisories": "dev-master", "squizlabs/php_codesniffer": "^3.5" }, @@ -42,7 +42,7 @@ "type:check": "psalm", "type:coverage": "psalm --shepherd", "test:unit": "phpunit", - "code:coverage": "php-coveralls -v", + "code:coverage": "coveralls tests/logs/clover.xml", "security:analysis": "psalm --taint-analysis", "check": [ "@cs:check",