From bc8901d1e80145e86a06bca86cb1d23528b7ff73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20M=C3=B6ller?= Date: Wed, 17 Jun 2020 23:04:34 +0200 Subject: [PATCH] Enhancement: Switch to GitHub Actions --- .editorconfig | 17 ++++++++++ .gitattributes | 9 ++++++ .github/CONTRIBUTING.md | 39 +++++++++++++++++++++++ .github/workflows/integrate.yaml | 54 ++++++++++++++++++++++++++++++++ .travis.yml | 15 --------- Makefile | 14 +++++++++ README.md | 4 +-- 7 files changed, 135 insertions(+), 17 deletions(-) create mode 100644 .editorconfig create mode 100644 .gitattributes create mode 100644 .github/CONTRIBUTING.md create mode 100644 .github/workflows/integrate.yaml delete mode 100644 .travis.yml create mode 100644 Makefile diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..00f2b26 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,17 @@ +root = true + +[*] +charset = utf-8 +indent_size = 4 +indent_style = space +insert_final_newline = true +trim_trailing_whitespace = true + +[*.json] +indent_size = 4 + +[*.{yaml,yml}] +indent_size = 2 + +[Makefile] +indent_style = tab diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..0382e9c --- /dev/null +++ b/.gitattributes @@ -0,0 +1,9 @@ +/.github/ export-ignore +/tests/ export-ignore +/.codeclimate.yml export-ignore +/.gitattributes export-ignore +/.gitignore export-ignore +/.php_cs export-ignore +/infection.json export-ignore +/Makefile export-ignore +/phpunit.xml.dist export-ignore diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md new file mode 100644 index 0000000..810db72 --- /dev/null +++ b/.github/CONTRIBUTING.md @@ -0,0 +1,39 @@ +# CONTRIBUTING + +We are using [GitHub Actions](https://github.com/features/actions) as a continuous integration system. + +For details, take a look at the following workflow configuration files: + +- [`workflows/integrate.yaml`](workflows/integrate.yaml) + +## Tests + +We are using [`phpunit/phpunit`](https://github.com/sebastianbergmann/phpunit) to drive the development. + +Run + +```sh +$ make tests +``` + +to run all the tests. + +## Extra lazy? + +Run + +```sh +$ make +``` + +to run tests! + +## Help + +:bulb: Run + +```sh +$ make help +``` + +to display a list of available targets with corresponding descriptions. diff --git a/.github/workflows/integrate.yaml b/.github/workflows/integrate.yaml new file mode 100644 index 0000000..6286ee5 --- /dev/null +++ b/.github/workflows/integrate.yaml @@ -0,0 +1,54 @@ +# https://help.github.com/en/categories/automating-your-workflow-with-github-actions + +name: "Integrate" + +on: # yamllint disable-line rule:truthy + pull_request: null + push: + branches: + - "master" + +jobs: + tests: + name: "Tests" + + runs-on: "ubuntu-latest" + + strategy: + matrix: + php-version: + - "5.4" + - "5.5" + - "5.6" + - "7.0" + + dependencies: + - "locked" + + steps: + - name: "Checkout" + uses: "actions/checkout@v2" + + - name: "Install PHP with extensions" + uses: "shivammathur/setup-php@v2" + with: + coverage: "none" + php-version: "${{ matrix.php-version }}" + + - name: "Determine composer cache directory" + id: "determine-composer-cache-directory" + run: "echo \"::set-output name=directory::$(composer config cache-dir)\"" + + - name: "Cache dependencies installed with composer" + uses: "actions/cache@v2" + with: + path: "${{ steps.determine-composer-cache-directory.outputs.directory }}" + key: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('composer.lock') }}" + restore-keys: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-" + + - name: "Install locked dependencies from composer.lock" + if: "matrix.dependencies == 'locked'" + run: "composer install --no-interaction --no-progress --no-suggest" + + - name: "Run tests with phpunit/phpunit" + run: "vendor/bin/phpunit --configuration=phpunit.xml.dist" diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index ab19249..0000000 --- a/.travis.yml +++ /dev/null @@ -1,15 +0,0 @@ -language: php - -sudo: false - -php: - - 5.4 - - 5.5 - - 5.6 - - 7.0 - -before_script: - - composer install - -script: - - phpunit diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..39c8bd3 --- /dev/null +++ b/Makefile @@ -0,0 +1,14 @@ +.PHONY: it +it: tests ## Runs the tests target + +.PHONY: help +help: ## Displays this list of targets with descriptions + @grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[32m%-30s\033[0m %s\n", $$1, $$2}' + +.PHONY: tests +tests: vendor ## Runs tests with phpunit/phpunit + vendor/bin/phpunit --configuration=phpunit.xml.dist + +vendor: composer.json composer.lock + composer validate --strict + composer install --no-interaction --no-progress --no-suggest diff --git a/README.md b/README.md index 8ea3812..99af0c0 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Tree -[![Build Status](https://travis-ci.org/nicmart/Tree.svg?branch=master)](https://travis-ci.org/nicmart/Tree) +[![Integrate](https://github.com/nicmart/Tree/workflows/Integrate/badge.svg?branch=master)](https://github.com/nicmart/Tree/actions) [![Latest Stable Version](https://poser.pugx.org/nicmart/tree/v/stable)](https://packagist.org/packages/nicmart/tree) [![Total Downloads](https://poser.pugx.org/nicmart/tree/downloads)](https://packagist.org/packages/nicmart/tree) [![License](https://poser.pugx.org/nicmart/tree/license)](https://packagist.org/packages/nicmart/tree) @@ -161,7 +161,7 @@ Let's see how to build the following tree, where the nodes label are represents /|\ D E F /| - G H + G H ``` And here is the code: