Skip to content
This repository has been archived by the owner on Mar 6, 2021. It is now read-only.

Commit

Permalink
Merge pull request #43 from localheinz/feature/synchronize
Browse files Browse the repository at this point in the history
Enhancement: Synchronize project tooling configuration with localheinz/php-library-template
  • Loading branch information
localheinz authored Sep 16, 2019
2 parents 943ef44 + 05bd7a2 commit b2011c7
Show file tree
Hide file tree
Showing 11 changed files with 165 additions and 113 deletions.
65 changes: 13 additions & 52 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,75 +1,36 @@
# CONTRIBUTING

We are using [Travis CI](https://travis-ci.com) as a continuous integration system.
We are using [GitHub Actions](https://github.com/features/actions) as continuous integration system.

For details, see [`.travis.yml`](../.travis.yml).
For details, see

## Coding Standards
* [`workflows/continuous-integration.yml`](workflows/continuous-integration.yml).
* [`workflows/continuous-deployment.yml`](workflows/continuous-deployment.yml).

We are using [`friendsofphp/php-cs-fixer`](https://github.com/FriendsOfPHP/PHP-CS-Fixer) to enforce coding standards.
## Docker Image

Run

```
$ make cs
$ make docker
```

to automatically fix coding standard violations.
to build, tag, and run the Docker image locally.

## Static Code Analysis

We are using [`phpstan/phpstan`](https://github.com/phpstan/phpstan) to statically analyze the code.

Run

```
$ make stan
```

to run a static code analysis.

## Tests

We are using [`phpunit/phpunit`](https://github.com/sebastianbergmann/phpunit) to drive the development.

Run

```
$ make test
```

to run all the tests.

## Mutation Testing

We are using [`infection/infection`](https://github.com/infection/infection) to ensure a minimum quality of the tests.

Enable `xdebug` and run

```
$ make infection
```

to run mutation tests.

## Benchmarks

We are using [`phpbench/phpbench`](http://github.com/phpbench/phpbench) to benchmark performance and memory consumption.
## Extra lazy?

Run

```
$ make bench
$ make
```

to run all the benchmarks.
to build, tag, and run the Docker image locally.

## Extra lazy?

Run
:bulb: Run

```
$ make
$ make help
```

to enforce coding standards, perform a static code analysis, run tests, and run benchmarks!
to display a list of available targets with corresponding descriptions.
1 change: 1 addition & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
custom: https://www.buymeacoffee.com/localheinz
github: localheinz
patreon: localheinz
39 changes: 39 additions & 0 deletions .github/settings.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# https://github.com/probot/settings

branches:
- name: master
protection:
enforce_admins: false
required_pull_request_reviews:
dismiss_stale_reviews: true
require_code_owner_reviews: true
required_approving_review_count: 1
required_status_checks:
contexts:
- "Docker"
strict: false
restrictions: null

labels:
- name: bug
color: ee0701

- name: enhancement
color: 0e8a16

- name: stale
color: eeeeee

repository:
allow_merge_commit: true
allow_rebase_merge: false
allow_squash_merge: false
default_branch: master
description: ":octocat: + :musical_note: Provides a GitHub action for running localheinz/composer-normalize."
has_downloads: true
has_issues: true
has_pages: false
has_projects: false
has_wiki: false
name: composer-normalize-action
private: false
10 changes: 0 additions & 10 deletions .github/stale.yml

This file was deleted.

35 changes: 35 additions & 0 deletions .github/workflows/continuous-deployment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# https://help.github.com/en/categories/automating-your-workflow-with-github-actions

on:
release:
types:
- created

name: "Continuous Deployment"

jobs:
deploy:
name: "Deploy"

runs-on: ubuntu-latest

steps:
- name: "Checkout"
if: "'refs/heads/master' == github.ref || startsWith('refs/tags/', github.ref)"
uses: actions/checkout@master

- name: "Build and tag Docker image"
if: "'refs/heads/master' == github.ref || startsWith('refs/tags/', github.ref)"
run: $(which docker) build --tag localheinz/composer-normalize-action ${GITHUB_WORKSPACE}

- name: "Docker Login"
if: "'refs/heads/master' == github.ref || startsWith('refs/tags/', github.ref)"
run: echo ${{ secrets.DOCKER_PASSWORD }} | $(which docker) login --password-stdin --username ${{ secrets.DOCKER_USERNAME }}"

- name: "Push Docker image"
if: "'refs/heads/master' == github.ref || startsWith('refs/tags/', github.ref)"
run: $(which docker) push localheinz/composer-normalize-action:$(bash ./.github/workflows/tag-name.sh ${GITHUB_REF})

- name: "Docker Logout"
if: "'refs/heads/master' == github.ref || startsWith('refs/tags/', github.ref)"
run: $(which docker) logout
23 changes: 23 additions & 0 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# https://help.github.com/en/categories/automating-your-workflow-with-github-actions

on:
- pull_request
- push

name: "Continuous Integration"

jobs:
build:
name: "Build"

runs-on: ubuntu-latest

steps:
- name: "Checkout"
uses: actions/checkout@master

- name: "Build and tag Docker image"
run: $(which docker) build --tag localheinz/composer-normalize-action ${GITHUB_WORKSPACE}

- name: "Run Docker image"
run: $(which docker) run --interactive --rm --workdir=/normalizer --volume ${GITHUB_WORKSPACE}/.build:/normalizer localheinz/composer-normalize-action:latest
26 changes: 26 additions & 0 deletions .github/workflows/stale.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# https://github.com/actions/stale

name: "Close stale issues and pull requests"
on:
schedule:
- cron: "0 * * * *"

jobs:
stale:
runs-on: ubuntu-latest
steps:
- uses: actions/stale@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
days-before-stale: 60
days-before-close: 5
stale-issue-label: 'stale'
stale-issue-message: >
This issue has been automatically marked as stale because it has not had
recent activity. It will be closed if no further activity occurs. Thank you
for your contributions.
stale-pr-message: >
This PR has been automatically marked as stale because it has not had
recent activity. It will be closed if no further activity occurs. Thank you
for your contributions.
stale-pr-label: 'stale'
19 changes: 19 additions & 0 deletions .github/workflows/tag-name.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env bash

GITHUB_REF=$1

if [[ -n $GITHUB_REF && $GITHUB_REF == "refs/heads/master" ]]; then
echo 'latest';

exit 0
fi

if [[ -n $GITHUB_REF && $GITHUB_REF == refs/tags/* ]]; then
echo "${GITHUB_REF#refs/tags/}";

exit 0
fi

echo "Unable to determine tag name"

exit 1;
46 changes: 0 additions & 46 deletions .travis.yml

This file was deleted.

9 changes: 6 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
.PHONY: docker it
.PHONY: docker help it

it: docker
it: docker ## Runs the docker target

docker:
docker: ## Builds, tags, and runs the Docker image
docker build --tag localheinz/composer-normalize-action .
docker run --interactive --rm --tty --workdir=/normalizer --volume ${PWD}/.build:/normalizer localheinz/composer-normalize-action:latest

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}'
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# composer-normalize-action

[![Build Status](https://travis-ci.com/localheinz/composer-normalize-action.svg?branch=master)](https://travis-ci.com/localheinz/composer-normalize-action)
[![CI Status](https://github.com/localheinz/composer-normalize-action/workflows/Continuous%20Integration/badge.svg)](https://github.com/localheinz/composer-normalize-action/actions)
[![CD Status](https://github.com/localheinz/composer-normalize-action/workflows/Continuous%20Deployment/badge.svg)](https://github.com/localheinz/composer-normalize-action/actions)

## What does this action do?

Expand Down Expand Up @@ -31,7 +32,7 @@ jobs:
### Docker image
As an integration with [Travis CI](https://travis-ci.com) automatically builds and pushes a Docker image when a new tag is created in this repository, the recommended way to use this GitHub action is to reference the pre-built Docker image directly, as seen above.
As Docker images are automatically built and pushed on a merge to `master` or when a new tag is created in this repository, the recommended way to use this GitHub action is to reference the pre-built Docker image directly, as seen above.

:bulb: The Docker image can also be executed directly by running

Expand Down

0 comments on commit b2011c7

Please sign in to comment.