Skip to content

Commit 0c25ad0

Browse files
committed
one thing at a time.
1 parent a708cb4 commit 0c25ad0

File tree

1 file changed

+54
-7
lines changed

1 file changed

+54
-7
lines changed

.github/workflows/tests.yaml

+54-7
Original file line numberDiff line numberDiff line change
@@ -39,20 +39,67 @@ jobs:
3939
steps:
4040
- uses: actions/checkout@v4
4141

42+
- name: 'Define vars'
43+
id: vars
44+
shell: bash -e {0}
45+
# language=sh
46+
run: |
47+
_phpunit_version=
48+
case "${{ inputs.php-version }}" in
49+
8.1) _phpunit_version='10.5' ;;
50+
8.2) _phpunit_version='11.1' ;;
51+
8.3) _phpunit_version='11.1' ;;
52+
8.4) _phpunit_version='11.1' ;;
53+
*) echo "Unsupported PHP version: ${{ inputs.php-version }}" && exit 1 ;;
54+
esac
55+
echo "phpunit-version=${_phpunit_version}" >> $GITHUB_OUTPUT
56+
4257
- uses: shivammathur/setup-php@v2
4358
with:
4459
php-version: ${{ matrix.php-version }}
4560
extensions: json
4661
ini-values: precision=14,serialize_precision=-1
4762

48-
- name: 'Composer update'
49-
# language=bash
63+
- name: 'Install jq'
64+
uses: dcarbone/install-jq-action@v3
65+
with:
66+
force: true
67+
68+
- name: 'Set composer dep versions'
69+
shell: bash -e {0}
70+
# language=sh
71+
run: |
72+
tmpf="$(mktemp)"
73+
jq -rcM '."require-dev"."phpunit/phpunit" = "^${{ steps.vars.outputs.phpunit-version }}"' composer.json > "${tmpf}"
74+
mv "${tmpf}" composer.json
75+
76+
- name: 'Get composer cache directory'
77+
id: composer-cache
78+
shell: bash -e {0}
79+
# language=sh
5080
run: |
51-
composer update \
52-
--no-ansi \
53-
--no-interaction \
54-
--no-scripts \
55-
--no-progress
81+
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
82+
83+
- name: 'Init composer dep cache'
84+
id: cache
85+
uses: actions/cache@v4
86+
with:
87+
path: ${{ steps.composer-cache.outputs.dir }}
88+
key: "composer-${{ runner.os }}-${{ inputs.php-version }}-${{ steps.vars.outputs.phpunit-version }}-${{ hashFiles('composer.lock') }}"
89+
90+
- name: 'Install composer deps'
91+
shell: bash -e {0}
92+
# language=sh
93+
run: |
94+
rm composer.lock
95+
composer update --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist
96+
97+
- name: 'Save composer dep cache'
98+
if: steps.cache.outputs.cache-hit != 'true' && steps.cache.outputs.cache-hit != true
99+
uses: actions/cache/save@v4
100+
with:
101+
path: ${{ steps.composer-cache.outputs.dir }}
102+
key: "composer-${{ runner.os }}-${{ inputs.php-version }}-${{ steps.vars.outputs.phpunit-version }}-${{ hashFiles('composer.lock') }}"
56103

57104
- name: 'Install Consul'
58105
# language=bash

0 commit comments

Comments
 (0)