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

Commit

Permalink
Enhancement: Synchronize with ergebns/php-library-template
Browse files Browse the repository at this point in the history
  • Loading branch information
localheinz committed May 4, 2020
1 parent 20e4d31 commit 993cfcd
Show file tree
Hide file tree
Showing 16 changed files with 382 additions and 138 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ trim_trailing_whitespace = true
[*.json]
indent_size = 2

[*.yml]
[*.{yaml,yml}]
indent_size = 2

[Makefile]
Expand Down
12 changes: 6 additions & 6 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/.build/ export-ignore
/.github/ export-ignore
/.editorconfig export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/Makefile export-ignore
/.build/ export-ignore
/.github/ export-ignore
/.editorconfig export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/Makefile export-ignore
25 changes: 22 additions & 3 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,25 @@
# CONTRIBUTING

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

For details, see [`workflows/continuous-integration.yml`](workflows/continuous-integration.yml).
For details, take a look at the following workflow configuration files:

- [`workflows/deploy.yaml`](workflows/deploy.yaml)
- [`workflows/integrate.yaml`](workflows/integrate.yaml)
- [`workflows/prune.yaml`](workflows/prune.yaml)
- [`workflows/triage.yaml`](workflows/triage.yaml)

## Coding Standards

We are using [`yamllint`](https://github.com/adrienverge/yamllint) to enforce coding standards in YAML files.

If you do not have `yamllint` installed yet, run

```
$ brew install yamllint
```

to install `yamllint`.

## Docker Image

Expand All @@ -22,7 +39,9 @@ Run
$ make
```

to build, tag, and run the Docker image locally.
to enforce coding standards, build, tag, and run the Docker image locally!

## Help

:bulb: Run

Expand Down
30 changes: 23 additions & 7 deletions .github/settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,34 +19,48 @@ branches:
- "GitHub Action (not-required)"
- "GitHub Action (required)"
strict: false
restrictions: null
restrictions:

# https://developer.github.com/v3/repos/branches/#parameters-1

# Note: User, app, and team restrictions are only available for organization-owned repositories.
# Set to null to disable when using this configuration for a repository on a personal account.

apps: []
teams: []
users:
- "ergebnis-bot"

# https://developer.github.com/v3/issues/labels/#create-a-label
# https://developer.github.com/v3/issues/labels/#update-a-label

labels:
- name: "bug"
color: "#ee0701"
color: "ee0701"
description: ""

- name: "dependency"
color: "#0366d6"
color: "0366d6"
description: ""

- name: "enhancement"
color: "#0e8a16"
color: "0e8a16"
description: ""

- name: "merge"
color: "6f42c1"
description: ""

- name: "question"
color: "#cc317c"
color: "cc317c"
description: ""

- name: "security"
color: "#ee0701"
color: "ee0701"
description: ""

- name: "stale"
color: "#eeeeee"
color: "eeeeee"
description: ""

# https://developer.github.com/v3/repos/#edit
Expand All @@ -55,7 +69,9 @@ repository:
allow_merge_commit: true
allow_rebase_merge: false
allow_squash_merge: false
archived: false
default_branch: "master"
delete_branch_on_merge: true
description: ":octocat: + :musical_note: Provides a GitHub action for running ergebnis/composer-normalize."
has_downloads: true
has_issues: true
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/deploy.yml → .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,26 @@

name: "Deploy"

on:
on: # yamllint disable-line rule:truthy
push:
branches:
- "master"
tags:
- "**"

env:
DOCKER_IMAGE: "ergebnis/composer-normalize-action"
DOCKER_USERNAME: "ergebnis"

jobs:
build:
name: "Build and deploy"
name: "Deploy"

runs-on: "ubuntu-latest"

env:
DOCKER_IMAGE: "ergebnis/composer-normalize-action"
DOCKER_USERNAME: "ergebnis"

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

- name: "Build Docker image"
run: "docker build --tag ${{ env.DOCKER_IMAGE }}:latest ."
Expand Down
163 changes: 163 additions & 0 deletions .github/workflows/integrate.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
# 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"

env:
DOCKER_IMAGE: "ergebnis/composer-normalize-action"

jobs:
docker-image:
name: "Docker image"

runs-on: "ubuntu-latest"

strategy:
matrix:
required:
- "not-required"
- "required"

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

- name: "Build Docker image"
run: "docker build --tag ${DOCKER_IMAGE}:latest ."

- name: "Run Docker image with default behaviour"
run: "docker run --interactive --rm --workdir=/app --volume ${GITHUB_WORKSPACE}/.build/${{ matrix.required }}:/app ${{ env.DOCKER_IMAGE }}:latest"

- name: "Run Docker image with custom behaviour, specifying options"
run: "docker run --interactive --rm --workdir=/app --volume ${GITHUB_WORKSPACE}/.build/${{ matrix.required }}:/app ${{ env.DOCKER_IMAGE }}:latest --diff --indent-size=1 --indent-style=space --no-update-lock"

- name: "Run Docker image with custom behaviour, specifying argument and options"
run: "docker run --interactive --rm --workdir=/app --volume ${GITHUB_WORKSPACE}:/app ${{ env.DOCKER_IMAGE }}:latest .build/${{ matrix.required }}/composer.json --diff --indent-size=2 --indent-style=space --no-update-lock"

github-action:
name: "GitHub Action"

runs-on: "ubuntu-latest"

strategy:
matrix:
required:
- "not-required"
- "required"

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

- name: "Copy composer.json from .build/${{ matrix.required }} into root directory"
run: "cp .build/${{ matrix.required }}/composer.json composer.json"

- name: "Run GitHub Action with default behavior"
uses: "./"

- name: "Run GitHub Action with custom behavior, specifying options"
uses: "./"
with:
args: "--diff --indent-size=1 --indent-style=tab --no-update-lock"

- name: "Remove composer.json from root directory"
run: "rm composer.json"

- name: "Run GitHub Action with custom behavior, specifying argument and options"
uses: "./"
with:
args: ".build/${{ matrix.required }}/composer.json --diff --indent-size=1 --indent-style=tab --no-update-lock"

merge:
name: "Merge"

runs-on: "ubuntu-latest"

needs:
- "docker-image"
- "github-action"

if: >
github.event_name == 'pull_request' &&
github.event.pull_request.draft == false && (
github.event.action == 'opened' ||
github.event.action == 'reopened' ||
github.event.action == 'synchronize'
) && (
(github.actor == 'localheinz' && contains(github.event.pull_request.labels.*.name, 'merge'))
)
steps:
- name: "Request review from @ergebnis-bot"
uses: "actions/[email protected]"
with:
github-token: "${{ secrets.ERGEBNIS_BOT_TOKEN }}"
script: |
const pullRequest = context.payload.pull_request
const repository = context.repo
const reviewers = [
"ergebnis-bot",
]
await github.pulls.createReviewRequest({
owner: repository.owner,
pull_number: pullRequest.number,
repo: repository.repo,
reviewers: reviewers,
})
- name: "Assign @ergebnis-bot"
uses: "actions/[email protected]"
with:
github-token: "${{ secrets.ERGEBNIS_BOT_TOKEN }}"
script: |
const pullRequest = context.payload.pull_request
const repository = context.repo
const reviewers = [
"ergebnis-bot",
]
await github.issues.addAssignees({
assignees: reviewers,
issue_number: pullRequest.number,
owner: repository.owner,
repo: repository.repo,
})
- name: "Approve pull request"
uses: "actions/[email protected]"
if: "github.actor != 'ergebnis-bot'"
with:
github-token: "${{ secrets.ERGEBNIS_BOT_TOKEN }}"
script: |
const pullRequest = context.payload.pull_request
const repository = context.repo
await github.pulls.createReview({
event: "APPROVE",
owner: repository.owner,
pull_number: pullRequest.number,
repo: repository.repo,
})
- name: "Merge pull request"
uses: "actions/[email protected]"
with:
github-token: "${{ secrets.ERGEBNIS_BOT_TOKEN }}"
script: |
const pullRequest = context.payload.pull_request
const repository = context.repo
await github.pulls.merge({
merge_method: "merge",
owner: repository.owner,
pull_number: pullRequest.number,
repo: repository.repo,
})
74 changes: 0 additions & 74 deletions .github/workflows/integrate.yml

This file was deleted.

Loading

0 comments on commit 993cfcd

Please sign in to comment.