|
7 | 7 | pull_request:
|
8 | 8 |
|
9 | 9 | jobs:
|
10 |
| - build: |
11 |
| - name: 'PHP ${{ matrix.php.branch }}' |
| 10 | + determine-php-matrix: |
| 11 | + name: Figure out the packages we need to build |
12 | 12 | 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 }} |
13 | 35 | 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' |
25 | 36 | # We want to fix failures individually.
|
26 | 37 | fail-fast: false
|
| 38 | + matrix: |
| 39 | + php: ${{fromJson(needs.determine-php-matrix.outputs.php)}} |
| 40 | + operating-system: [ubuntu-latest, macOS-latest] |
| 41 | + |
27 | 42 | steps:
|
28 |
| - - uses: actions/checkout@v3 |
| 43 | + - name: Set up Git repository |
| 44 | + uses: actions/checkout@v2 |
| 45 | + with: |
| 46 | + fetch-depth: 1 |
29 | 47 |
|
30 | 48 | - name: Install Nix
|
31 |
| - uses: cachix/install-nix-action@v18 |
| 49 | + uses: cachix/install-nix-action@v16 |
32 | 50 |
|
33 | 51 | - name: Set up Nix cache
|
34 |
| - uses: cachix/cachix-action@v12 |
| 52 | + uses: cachix/cachix-action@v10 |
35 | 53 | with:
|
36 | 54 | 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 }}" |
48 | 56 |
|
49 | 57 | - name: Build PHP
|
50 |
| - run: nix-build -A outputs.checks.x86_64-linux.${{ steps.params.outputs.attr }}-php |
| 58 | + run: nix build .#${{ matrix.php }} |
51 | 59 |
|
52 | 60 | - 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 |
54 | 62 |
|
55 | 63 | - 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 |
57 | 65 |
|
58 | 66 | - 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 |
61 | 69 |
|
62 | 70 | - 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 |
65 | 73 |
|
66 | 74 | - 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 |
68 | 76 |
|
69 | 77 | - 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 |
71 | 79 |
|
72 | 80 | - 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 |
74 | 95 |
|
75 | 96 | - 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 |
77 | 112 |
|
78 | 113 | - 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