Skip to content

Commit ead082d

Browse files
authored
Merge pull request #18 from gennadiylitvinyuk/patch-1
Improved usage instructions in readme file
2 parents 8818806 + 7cd29f4 commit ead082d

File tree

1 file changed

+31
-2
lines changed

1 file changed

+31
-2
lines changed

README.md

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,16 @@ Generally speaking, you will use this in combination with the [laminas/laminas-c
5959

6060
## Usage
6161

62+
Create `.github/workflows/continuous-integration.yml` file with following content:
63+
6264
```yaml
65+
name: "Continuous Integration"
66+
67+
on:
68+
pull_request:
69+
push:
70+
branches:
71+
6372
jobs:
6473
matrix:
6574
name: Generate job matrix
@@ -70,7 +79,6 @@ jobs:
7079
- name: Gather CI configuration
7180
id: matrix
7281
uses: laminas/laminas-ci-matrix-action@v1
73-
7482
qa:
7583
name: QA Checks
7684
needs: [matrix]
@@ -87,6 +95,27 @@ jobs:
8795
job: ${{ matrix.job }}
8896
```
8997
98+
The same can be achieved with our reusable workflow:
99+
100+
```yaml
101+
name: "Continuous Integration"
102+
103+
on:
104+
pull_request:
105+
push:
106+
branches:
107+
108+
jobs:
109+
ci:
110+
uses: laminas/workflow-continuous-integration/.github/workflows/[email protected]
111+
```
112+
113+
> ### Duplicate CI runs
114+
>
115+
> When pull requests are opened from branches in the same repository, the CI pipeline could run twice for the same commit: once when pushed to a branch and once when the PR is opened.
116+
> Workflow triggers can be adjusted to only run for specific branches or to skip branches using simple glob patterns.
117+
> See the GitHub documentation for [Events that trigger workflows](https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#running-your-workflow-only-when-a-push-to-specific-branches-occurs) for more info.
118+
90119
> ### actions/checkout not required
91120
>
92121
> The action will perform a checkout of the repository at the requested reference as part of its work, and therefore does not require the actions/checkout action as a preceding step.
@@ -219,7 +248,7 @@ The tricks to remember are:
219248
As an example, if you wanted to run the CS checks under PHP 7.4 using locked dependencies, you could do something like the following:
220249

221250
```bash
222-
$ docker run -v $(realpath .):/github/workspace -w=/github/workspace laminas-check-runner:latest '{"php":"7.4","dependencies":"locked","extensions":[],"ini":["memory_limit=-1"],"command":"./vendor/bin/phpcs"}'
251+
$ docker run -v $(realpath .):/github/workspace -w=/github/workspace ghcr.io/laminas/laminas-continuous-integration:1 '{"php":"7.4","dependencies":"locked","extensions":[],"ini":["memory_limit=-1"],"command":"./vendor/bin/phpcs"}'
223252
```
224253

225254
The trick to remember: the job JSON should generally be in single quotes, to allow the `"` characters used to delimit properties and strings in the JSON to not cause interpolation issues.

0 commit comments

Comments
 (0)