Skip to content

Commit

Permalink
ci: switch from travis to github actions (#7)
Browse files Browse the repository at this point in the history
also test on php from 7.0 to 7.4
  • Loading branch information
Lctrs committed Mar 23, 2021
1 parent 9972ee0 commit ad56b7c
Show file tree
Hide file tree
Showing 6 changed files with 1,067 additions and 310 deletions.
117 changes: 117 additions & 0 deletions .github/workflows/integrate.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
# https://docs.github.com/en/actions

name: "Integrate"

on:
pull_request: null
push:
branches:
- "master"

env:
PHP_EXTENSIONS: "curl, dom, json, simplexml, tokenizer, xmlwriter"

jobs:
static-code-analysis:
name: "Static Code Analysis"

runs-on: "ubuntu-latest"

strategy:
matrix:
php-version:
- "7.3"

dependencies:
- "locked"

steps:
- name: "Checkout"
uses: "actions/checkout@v2.3.4"

- name: "Install PHP with extensions"
uses: "shivammathur/setup-php@2.10.0"
with:
coverage: "none"
extensions: "${{ env.PHP_EXTENSIONS }}"
php-version: "${{ matrix.php-version }}"
tools: "composer:v1"

- name: "Install ${{ matrix.dependencies }} dependencies with composer"
uses: "ramsey/composer-install@1.3.0"
with:
dependency-versions: "${{ matrix.dependencies }}"

- name: "Create cache directory for vimeo/psalm"
run: "mkdir -p build/psalm"

- name: "Cache cache directory for vimeo/psalm"
uses: "actions/cache@v2.1.4"
with:
path: "build/psalm"
key: "php-${{ matrix.php-version }}-psalm-${{ github.sha }}"
restore-keys: "php-${{ matrix.php-version }}-psalm-"

- name: "Run vimeo/psalm"
run: "bin/psalm --config=psalm.xml --diff --show-info=false --stats --threads=4"

tests:
name: "Tests"

runs-on: "ubuntu-latest"

strategy:
matrix:
php-version:
- "7.0"
- "7.1"
- "7.2"
- "7.3"
- "7.4"

dependencies:
- "lowest"
- "locked"
- "highest"

steps:
- name: "Checkout"
uses: "actions/checkout@v2.3.4"

- name: "Install PHP with extensions"
uses: "shivammathur/setup-php@2.10.0"
with:
coverage: "xdebug"
extensions: "${{ env.PHP_EXTENSIONS }}"
php-version: "${{ matrix.php-version }}"
tools: "composer:v1"

- name: "Install ${{ matrix.dependencies }} dependencies with composer"
uses: "ramsey/composer-install@1.3.0"
with:
dependency-versions: "${{ matrix.dependencies }}"

- name: "Run specification tests phpspec/phpspec"
run: "bin/phpspec run --config=phpspec.yml"

- name: "Collect the test coverage report using php-coveralls/php-coveralls"
env:
COVERALLS_REPO_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
COVERALLS_PARALLEL: true
COVERALLS_FLAG_NAME: "${{ github.job }}-PHP-${{ matrix.php-version }} ${{ matrix.dependencies }}"
run: "bin/php-coveralls -v"

code-coverage:
name: "Code Coverage"

needs:
- "tests"

runs-on: "ubuntu-latest"

steps:
- name: "Send code coverage report to Coveralls"
uses: "coverallsapp/github-action@v1.1.2"
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
parallel-finished: true
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
/build/
vendor
bin
14 changes: 0 additions & 14 deletions .travis.yml

This file was deleted.

10 changes: 5 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@
}
],
"require": {
"prewk/result": "*",
"prewk/result": ">= 1.2.0",
"php": ">=7.0"
},
"require-dev": {
"phpspec/phpspec": "^3.2",
"leanphp/phpspec-code-coverage": "^3.1",
"satooshi/php-coveralls": "^1.0",
"vimeo/psalm": "^3.2"
"phpspec/phpspec": "^3.4.3",
"leanphp/phpspec-code-coverage": "^3.1.1",
"php-coveralls/php-coveralls": "^2.4.3",
"vimeo/psalm": "^3.2.12"
}
}

0 comments on commit ad56b7c

Please sign in to comment.