migrate from travis ci to github actions

This commit is contained in:
azjezz 2020-10-01 01:35:21 +01:00 committed by Saif Eddin G
parent 9d3fd7829a
commit 249529480d
8 changed files with 137 additions and 47 deletions

View File

@ -1,3 +0,0 @@
coverage_clover: tests/logs/clover.xml
json_path: tests/logs/coveralls-upload.json
service_name: travis-ci

25
.github/workflows/coding-standards.yml vendored Normal file
View File

@ -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"

25
.github/workflows/security-analysis.yml vendored Normal file
View File

@ -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"

25
.github/workflows/static-analysis.yml vendored Normal file
View File

@ -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"

56
.github/workflows/unit-tests.yml vendored Normal file
View File

@ -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"

View File

@ -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

View File

@ -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)

View File

@ -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",