Skip to content

Commit f8c799b

Browse files
committed
Merge branch 1.38.x into 2.0.x
2 parents 1c7a77f + ead082d commit f8c799b

File tree

6 files changed

+380
-298
lines changed

6 files changed

+380
-298
lines changed

Dockerfile

Lines changed: 33 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,27 @@
1+
ARG NODE_MAJOR=20
2+
13
# Aliasing base images, so we can change just this, when needing to upgrade or pull base layers
24
FROM ubuntu:22.04 AS base-distro
3-
FROM composer:2.4.4 AS composer
4-
5+
FROM composer:2.6.6 AS composer
56

67
FROM base-distro AS install-markdownlint
8+
ARG NODE_MAJOR
9+
ENV NODE_MAJOR=$NODE_MAJOR
710

811
# Install system dependencies first - these don't change much
9-
RUN export DEBIAN_FRONTEND=noninteractive \
10-
&& (curl -ssL https://deb.nodesource.com/setup_20.x | bash -) \
12+
RUN set -eux; \
13+
export DEBIAN_FRONTEND=noninteractive \
14+
&& apt update \
15+
&& apt install -y --no-install-recommends \
16+
ca-certificates \
17+
curl \
18+
gnupg \
19+
&& mkdir -p /etc/apt/keyrings \
20+
&& curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg \
21+
&& echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list \
1122
&& apt update \
1223
&& apt install -y --no-install-recommends \
13-
npm \
24+
nodejs \
1425
&& apt clean
1526

1627
COPY setup/markdownlint/package.json \
@@ -30,32 +41,39 @@ RUN cd /markdownlint \
3041

3142

3243
FROM base-distro
33-
44+
ARG NODE_MAJOR
3445
LABEL "repository"="http://github.com/laminas/laminas-continuous-integration-action"
3546
LABEL "homepage"="http://github.com/laminas/laminas-continuous-integration-action"
3647
LABEL "maintainer"="https://github.com/laminas/technical-steering-committee/"
3748

3849
ENV COMPOSER_HOME=/usr/local/share/composer \
3950
DEBIAN_FRONTEND=noninteractive \
40-
ACCEPT_EULA=Y
51+
ACCEPT_EULA=Y \
52+
NODE_MAJOR=$NODE_MAJOR
4153

4254
# This may look a bit long, but it's just a big `apt install` section, followed by a cleanup,
4355
# so that we get a single compact layer, with not too many layer overwrites.
44-
RUN export OS_VERSION=$(cat /etc/os-release | grep VERSION_ID | cut -d '"' -f2) \
56+
RUN set -eux; \
57+
export OS_VERSION=$(cat /etc/os-release | grep VERSION_ID | cut -d '"' -f2) \
4558
&& apt update \
4659
&& apt upgrade -y \
4760
&& apt install -y --no-install-recommends \
4861
curl \
4962
gpg-agent \
5063
software-properties-common \
64+
ca-certificates \
65+
gnupg \
5166
&& (curl -sSL https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor | tee /etc/apt/trusted.gpg.d/microsoft.gpg) \
5267
&& add-apt-repository -y ppa:ondrej/php \
5368
&& curl -sSL https://packages.microsoft.com/config/ubuntu/$OS_VERSION/prod.list | tee /etc/apt/sources.list.d/microsoft.list \
54-
&& (curl -ssL https://deb.nodesource.com/setup_20.x | bash -) \
69+
&& mkdir -p /etc/apt/keyrings \
70+
&& curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg \
71+
&& echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list \
5572
&& apt update \
5673
&& apt install -y --no-install-recommends \
5774
# Base dependencies
5875
git \
76+
nodejs \
5977
jq \
6078
libxml2-utils \
6179
libzip-dev \
@@ -71,6 +89,7 @@ RUN export OS_VERSION=$(cat /etc/os-release | grep VERSION_ID | cut -d '"' -f2)
7189
php-pear \
7290
\
7391
php8.0-cli \
92+
php8.0-bcmath \
7493
php8.0-bz2 \
7594
php8.0-curl \
7695
php8.0-dev \
@@ -86,6 +105,7 @@ RUN export OS_VERSION=$(cat /etc/os-release | grep VERSION_ID | cut -d '"' -f2)
86105
php8.0-zip \
87106
\
88107
php8.1-cli \
108+
php8.1-bcmath \
89109
php8.1-bz2 \
90110
php8.1-curl \
91111
php8.1-dev \
@@ -101,6 +121,7 @@ RUN export OS_VERSION=$(cat /etc/os-release | grep VERSION_ID | cut -d '"' -f2)
101121
php8.1-zip \
102122
\
103123
php8.2-cli \
124+
php8.2-bcmath \
104125
php8.2-bz2 \
105126
php8.2-curl \
106127
php8.2-dev \
@@ -116,6 +137,7 @@ RUN export OS_VERSION=$(cat /etc/os-release | grep VERSION_ID | cut -d '"' -f2)
116137
php8.2-zip \
117138
\
118139
php8.3-cli \
140+
php8.3-bcmath \
119141
php8.3-bz2 \
120142
php8.3-curl \
121143
php8.3-dev \
@@ -176,15 +198,14 @@ COPY composer.json \
176198
/tools/
177199

178200
# Set default PHP version based on the `composer.json` `config.platform.php` setting
179-
RUN export DEFAULT_PHP_VERSION=$(jq -r '.config.platform.php | sub("(?<minor>[0-9.]).99$"; "\(.minor)")' /tools/composer.json) \
201+
RUN set -eux; \
202+
export DEFAULT_PHP_VERSION=$(jq -r '.config.platform.php | sub("(?<minor>[0-9.]).99$"; "\(.minor)")' /tools/composer.json) \
180203
&& update-alternatives --set php /usr/bin/php$DEFAULT_PHP_VERSION \
181204
&& update-alternatives --set phpize /usr/bin/phpize$DEFAULT_PHP_VERSION \
182205
&& update-alternatives --set php-config /usr/bin/php-config$DEFAULT_PHP_VERSION \
183206
&& echo "DEFAULT_PHP_VERSION=${DEFAULT_PHP_VERSION}" >> /etc/environment
184207

185208
RUN cd /tools \
186-
# Install `ext-bcmath` as it seems to be a requirement for `roave/backward-compatibility-check`
187-
&& apt install -y php-bcmath \
188209
&& composer install \
189210
--classmap-authoritative \
190211
# Cleanup composer files from external tools folder

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 8.2 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":"8.2","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":"8.2","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)