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 #77 from ergebnis/fix/required
Browse files Browse the repository at this point in the history
Fix: Run build when ergebnis/composer-normalize is not required as well
  • Loading branch information
localheinz authored Feb 2, 2020
2 parents 500cb04 + 605a8f9 commit 31dcf39
Show file tree
Hide file tree
Showing 8 changed files with 72 additions and 14 deletions.
24 changes: 24 additions & 0 deletions .build/not-required/composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"name": "ergebnis/composer-normalize-action",
"type": "library",
"description": "Provides a GitHub action for running ergebnis/composer-normalize.",
"homepage": "https://github.com/ergebnis/composer-normalize-action",
"license": "MIT",
"authors": [
{
"name": "Andreas Möller",
"email": "am@localheinz.com"
}
],
"require": {
"php": "^7.3"
},
"config": {
"preferred-install": "dist",
"sort-packages": true
},
"support": {
"issues": "https://github.com/ergebnis/composer-normalize-action/issues",
"source": "https://github.com/ergebnis/composer-normalize-action"
}
}
19 changes: 19 additions & 0 deletions .build/not-required/composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

File renamed without changes.
File renamed without changes.
8 changes: 4 additions & 4 deletions .github/settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ branches:
required_approving_review_count: 1
required_status_checks:
contexts:
- "Docker image (no)"
- "Docker image (yes)"
- "GitHub Action (no)"
- "GitHub Action (yes)"
- "Docker image (not-required)"
- "Docker image (required)"
- "GitHub Action (not-required)"
- "GitHub Action (required)"
strict: false
restrictions: null

Expand Down
24 changes: 18 additions & 6 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ jobs:

runs-on: "ubuntu-latest"

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

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

Expand All @@ -22,28 +28,34 @@ jobs:
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:/app ${{ env.DOCKER_IMAGE }}:latest"
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:/app ${{ env.DOCKER_IMAGE }}:latest --diff --indent-size=1 --indent-style=space --no-update-lock"
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/composer.json --diff --indent-size=2 --indent-style=space --no-update-lock"
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"

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

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

- name: "Copy composer.json from .build into root directory"
run: "cp .build/composer.json composer.json"
- 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: "./"
Expand All @@ -59,4 +71,4 @@ jobs:
- name: "Run GitHub Action with custom behavior, specifying argument and options"
uses: "./"
with:
args: ".build/composer.json --diff --indent-size=1 --indent-style=tab --no-update-lock"
args: ".build/${{ matrix.required }}/composer.json --diff --indent-size=1 --indent-style=tab --no-update-lock"
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1 @@
/vendor/
vendor/
9 changes: 6 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,14 @@ it: docker ## Runs the docker target
docker: ## Builds, tags, and runs the Docker image
docker build --tag ${DOCKER_IMAGE} .
# Run Docker image with default behaviour
docker run --interactive --rm --tty --workdir=/app --volume ${PWD}/.build:/app ${DOCKER_IMAGE}:latest
docker run --interactive --rm --tty --workdir=/app --volume ${PWD}/.build/not-required:/app ${DOCKER_IMAGE}:latest
docker run --interactive --rm --tty --workdir=/app --volume ${PWD}/.build/required:/app ${DOCKER_IMAGE}:latest
# Run Docker image with custom behaviour, specifying options
docker run --interactive --rm --tty --workdir=/app --volume ${PWD}/.build:/app ${DOCKER_IMAGE}:latest --diff --indent-size=1 --indent-style=space --no-update-lock
docker run --interactive --rm --tty --workdir=/app --volume ${PWD}/.build/not-required:/app ${DOCKER_IMAGE}:latest --diff --indent-size=1 --indent-style=space --no-update-lock
docker run --interactive --rm --tty --workdir=/app --volume ${PWD}/.build/required:/app ${DOCKER_IMAGE}:latest --diff --indent-size=1 --indent-style=space --no-update-lock
# Run Docker image with custom behaviour, specifying argument and options
docker run --interactive --rm --tty --workdir=/app --volume ${PWD}:/app ${DOCKER_IMAGE}:latest .build/composer.json --diff --indent-size=2 --indent-style=space --no-update-lock
docker run --interactive --rm --tty --workdir=/app --volume ${PWD}:/app ${DOCKER_IMAGE}:latest .build/not-required/composer.json --diff --indent-size=2 --indent-style=space --no-update-lock
docker run --interactive --rm --tty --workdir=/app --volume ${PWD}:/app ${DOCKER_IMAGE}:latest .build/required/composer.json --diff --indent-size=2 --indent-style=space --no-update-lock

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}'

0 comments on commit 31dcf39

Please sign in to comment.