Skip to content

Commit

Permalink
Merge pull request #38 from localheinz/feature/github-actions
Browse files Browse the repository at this point in the history
Enhancement: Switch to GitHub Actions
  • Loading branch information
localheinz committed Jun 17, 2020
2 parents f5ec1e8 + bc8901d commit e4ce568
Show file tree
Hide file tree
Showing 7 changed files with 135 additions and 17 deletions.
17 changes: 17 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -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
9 changes: 9 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -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
39 changes: 39 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -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.
54 changes: 54 additions & 0 deletions .github/workflows/integrate.yaml
Original file line number Diff line number Diff line change
@@ -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"
15 changes: 0 additions & 15 deletions .travis.yml

This file was deleted.

14 changes: 14 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -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)
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit e4ce568

Please sign in to comment.