Skip to content

Commit 2ca5c87

Browse files
committed
ci: trigger builds on macOS
1 parent d66a484 commit 2ca5c87

File tree

1 file changed

+88
-39
lines changed

1 file changed

+88
-39
lines changed

.github/workflows/build.yaml

Lines changed: 88 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -7,73 +7,122 @@ on:
77
pull_request:
88

99
jobs:
10-
build:
11-
name: 'PHP ${{ matrix.php.branch }}'
10+
determine-php-matrix:
11+
name: Figure out the packages we need to build
1212
runs-on: ubuntu-latest
13+
14+
outputs:
15+
php: ${{ steps.set-php-matrix.outputs.php }}
16+
17+
steps:
18+
- name: Set up Git repository
19+
uses: actions/checkout@v3
20+
21+
- name: Install Nix
22+
uses: cachix/install-nix-action@v18
23+
24+
- id: set-php-matrix
25+
run: |
26+
echo "::set-output name=php::$(
27+
nix eval --json --impure \
28+
--expr 'builtins.attrNames (import ./.).packages.x86_64-linux'
29+
)"
30+
31+
build:
32+
name: "Build #${{ matrix.php }} on ${{ matrix.operating-system }}"
33+
needs: [determine-php-matrix]
34+
runs-on: ${{ matrix.operating-system }}
1335
strategy:
14-
matrix:
15-
php:
16-
- branch: '8.2'
17-
- branch: '8.1'
18-
- branch: '8.0'
19-
- branch: '7.4'
20-
- branch: '7.3'
21-
- branch: '7.2'
22-
- branch: '7.1'
23-
- branch: '7.0'
24-
- branch: '5.6'
2536
# We want to fix failures individually.
2637
fail-fast: false
38+
matrix:
39+
php: ${{fromJson(needs.determine-php-matrix.outputs.php)}}
40+
operating-system: [ubuntu-latest, macOS-latest]
41+
2742
steps:
28-
- uses: actions/checkout@v3
43+
- name: Set up Git repository
44+
uses: actions/checkout@v2
45+
with:
46+
fetch-depth: 1
2947

3048
- name: Install Nix
31-
uses: cachix/install-nix-action@v18
49+
uses: cachix/install-nix-action@v16
3250

3351
- name: Set up Nix cache
34-
uses: cachix/cachix-action@v12
52+
uses: cachix/cachix-action@v10
3553
with:
3654
name: fossar
37-
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
38-
39-
- name: Set job parameters
40-
id: params
41-
run: |
42-
branch=${{ matrix.php.branch }}
43-
major=${branch%%.*}
44-
minor=${branch#*.}
45-
attr=php$major$minor
46-
echo "major=$major" >> $GITHUB_OUTPUT
47-
echo "attr=$attr" >> $GITHUB_OUTPUT
55+
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"
4856

4957
- name: Build PHP
50-
run: nix-build -A outputs.checks.x86_64-linux.${{ steps.params.outputs.attr }}-php
58+
run: nix build .#${{ matrix.php }}
5159

5260
- name: Build Imagick extension
53-
run: nix-build -A outputs.checks.x86_64-linux.${{ steps.params.outputs.attr }}-imagick
61+
run: nix build .#${{ matrix.php }}.extensions.imagick
5462

5563
- name: Build Redis extension
56-
run: nix-build -A outputs.checks.x86_64-linux.${{ steps.params.outputs.attr }}-redis
64+
run: nix build .#${{ matrix.php }}.extensions.redis
5765

5866
- name: Build Redis 3 extension
59-
if: ${{ steps.params.outputs.major < 8 }}
60-
run: nix-build -A outputs.checks.x86_64-linux.${{ steps.params.outputs.attr }}-redis3
67+
continue-on-error: true
68+
run: nix build .#${{ matrix.php }}.extensions.redis3
6169

6270
- name: Build MySQL extension
63-
if: ${{ steps.params.outputs.major < 7 }}
64-
run: nix-build -A outputs.checks.x86_64-linux.${{ steps.params.outputs.attr }}-mysql
71+
continue-on-error: true
72+
run: nix build .#${{ matrix.php }}.extensions.mysql
6573

6674
- name: Build Xdebug extension
67-
run: nix-build -A outputs.checks.x86_64-linux.${{ steps.params.outputs.attr }}-xdebug
75+
run: nix build .#${{ matrix.php }}.extensions.xdebug
6876

6977
- name: Build Tidy extension
70-
run: nix-build -A outputs.checks.x86_64-linux.${{ steps.params.outputs.attr }}-tidy
78+
run: nix build .#${{ matrix.php }}.extensions.tidy
7179

7280
- name: Check that composer PHAR works
73-
run: nix-build -A outputs.checks.x86_64-linux.${{ steps.params.outputs.attr }}-composer-phar
81+
run: |
82+
nix develop --impure --expr '
83+
let
84+
self = import ./.;
85+
composer =
86+
self.outputs.packages.${builtins.currentSystem}.${{ matrix.php }}.packages.composer;
87+
pkgs = import self.inputs.nixpkgs { };
88+
in
89+
pkgs.mkShell {
90+
packages = [
91+
composer
92+
];
93+
}
94+
' -c composer --version
7495
7596
- name: Validate php.extensions.mysqli default unix socket path
76-
run: nix-build -A outputs.checks.x86_64-linux.${{ steps.params.outputs.attr }}-mysqli-socket-path
97+
run: |
98+
nix develop --impure --expr '
99+
let
100+
self = import ./.;
101+
php =
102+
self.outputs.packages.${builtins.currentSystem}.${{ matrix.php }}.withExtensions
103+
({ all, ... }: [ all.mysqli ]);
104+
pkgs = import self.inputs.nixpkgs { };
105+
in
106+
pkgs.mkShell {
107+
packages = [
108+
php
109+
];
110+
}
111+
' -c php -r "echo ini_get('mysqli.default_socket') . PHP_EOL;" | grep /run/mysqld/mysqld.sock
77112
78113
- name: Validate php.extensions.pdo_mysql default unix socket path
79-
run: nix-build -A outputs.checks.x86_64-linux.${{ steps.params.outputs.attr }}-pdo_mysql-socket-path
114+
run: |
115+
nix develop --impure --expr '
116+
let
117+
self = import ./.;
118+
php =
119+
self.outputs.packages.${builtins.currentSystem}.${{ matrix.php }}.withExtensions
120+
({ all, ... }: [ all.pdo_mysql ]);
121+
pkgs = import self.inputs.nixpkgs { };
122+
in
123+
pkgs.mkShell {
124+
packages = [
125+
php
126+
];
127+
}
128+
' -c php -r "echo ini_get('pdo_mysql.default_socket') . PHP_EOL;" | grep /run/mysqld/mysqld.sock

0 commit comments

Comments
 (0)