Skip to content

Commit 4169bf8

Browse files
committed
setup composer caching for all workflows
1 parent d03025d commit 4169bf8

6 files changed

+90
-28
lines changed

.github/workflows/integration-test-aura.yml

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,24 @@ jobs:
1616
name: "Running on all provided Aura instances"
1717
steps:
1818
- uses: actions/checkout@v4
19-
- name: Run tests
19+
20+
- name: Populate .env
2021
run: |
2122
echo "PHP_VERSION=8.1.31" > .env
2223
echo "CONNECTION=\"${{ secrets.AURA_PRO }}\"" >> .env
2324
24-
docker compose run --rm --no-deps \
25-
client sh -c "composer install && ./vendor/bin/phpunit -c phpunit.xml.dist --testsuite Integration"
25+
- name: Cache PHP deps
26+
id: cache-php-deps
27+
uses: actions/cache@v4
28+
with:
29+
path: vendor
30+
key: ${{ runner.os }}-php-8.1.31-${{ hashFiles('**/composer.json') }}
31+
restore-keys: |
32+
${{ runner.os }}-php-8.1.31-
33+
34+
- name: Install PHP deps
35+
if: steps.cache-php-deps.outputs.cache-hit != 'true'
36+
run: docker compose run --rm client composer install
37+
38+
- name: Run tests
39+
run: docker compose run --rm client ./vendor/bin/phpunit -c phpunit.xml.dist --testsuite Integration

.github/workflows/integration-test-cluster-neo4j-4.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,3 @@ jobs:
4646
4747
docker compose -f docker-compose-neo4j-4.yml run --rm client \
4848
./vendor/bin/phpunit -c phpunit.xml.dist --testsuite Integration
49-
50-
# tear down services
51-
docker compose -f docker-compose-neo4j-4.yml down --remove-orphans --volumes

.github/workflows/integration-test-cluster-neo4j-5.yml

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,20 @@ jobs:
2121
echo "PHP_VERSION=${{ matrix.php }}" > .env
2222
echo "CONNECTION=neo4j://neo4j:testtest@server1" >> .env
2323
24+
- name: Cache PHP deps
25+
id: cache-php-deps
26+
uses: actions/cache@v4
27+
with:
28+
path: vendor
29+
key: ${{ runner.os }}-php-${{ matrix.php }}-${{ hashFiles('**/composer.json') }}
30+
restore-keys: |
31+
${{ runner.os }}-php-${{ matrix.php }}-
32+
33+
- name: Install PHP deps
34+
if: steps.cache-php-deps.outputs.cache-hit != 'true'
35+
run: |
36+
docker compose run --rm client composer install
37+
2438
- name: Run integration tests
2539
run: |
2640
docker compose up -d --build --remove-orphans --wait \
@@ -31,7 +45,4 @@ jobs:
3145
3246
# install PHP deps and run PHPUnit inside the client container
3347
docker compose run --rm client \
34-
sh -c "composer install && ./vendor/bin/phpunit -c phpunit.xml.dist --testsuite Integration"
35-
36-
# tear down services
37-
docker compose down --remove-orphans --volumes
48+
./vendor/bin/phpunit -c phpunit.xml.dist --testsuite Integration

.github/workflows/integration-test-single-server.yml

Lines changed: 42 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,23 @@ jobs:
1616

1717
steps:
1818
- uses: actions/checkout@v4
19+
- name: Populate .env
20+
run: |
21+
echo "PHP_VERSION=${{ matrix.php }}" > .env
22+
23+
- name: Cache PHP deps
24+
id: cache-php-deps
25+
uses: actions/cache@v4
26+
with:
27+
path: vendor
28+
key: ${{ runner.os }}-php-${{ matrix.php }}-${{ hashFiles('**/composer.json') }}
29+
restore-keys: |
30+
${{ runner.os }}-php-${{ matrix.php }}-
31+
32+
- name: Install PHP deps
33+
if: steps.cache-php-deps.outputs.cache-hit != 'true'
34+
run: docker compose run --rm client composer install
35+
1936
- name: Run tests Neo4j 4
2037
run: |
2138
@@ -24,16 +41,14 @@ jobs:
2441
2542
docker compose -f docker-compose-neo4j-4.yml up -d --build --remove-orphans --wait neo4j
2643
27-
docker compose -f docker-compose-neo4j-4.yml run --rm --no-deps \
28-
client sh -c "composer install && ./vendor/bin/phpunit -c phpunit.xml.dist --testsuite Integration"
44+
docker compose -f docker-compose-neo4j-4.yml run --rm \
45+
client ./vendor/bin/phpunit -c phpunit.xml.dist --testsuite Integration
2946
3047
echo "PHP_VERSION=${{ matrix.php }}" > .env
3148
echo "CONNECTION=neo4j://neo4j:testtest@neo4j" >> .env
3249
33-
docker compose -f docker-compose-neo4j-4.yml run --rm --no-deps \
34-
client sh -c "./vendor/bin/phpunit -c phpunit.xml.dist --testsuite Integration"
35-
36-
docker compose -f docker-compose-neo4j-4.yml down --remove-orphans --volumes
50+
docker compose -f docker-compose-neo4j-4.yml run --rm \
51+
client phpunit.xml.dist --testsuite Integration
3752
3853
tests-v5:
3954
runs-on: ubuntu-latest
@@ -44,20 +59,37 @@ jobs:
4459

4560
steps:
4661
- uses: actions/checkout@v4
62+
- name: Populate .env
63+
run: |
64+
echo "PHP_VERSION=${{ matrix.php }}" > .env
65+
66+
- name: Cache PHP deps
67+
id: cache-php-deps
68+
uses: actions/cache@v4
69+
with:
70+
path: vendor
71+
key: ${{ runner.os }}-php-${{ matrix.php }}-${{ hashFiles('**/composer.json') }}
72+
restore-keys: |
73+
${{ runner.os }}-php-${{ matrix.php }}-
74+
75+
- name: Install PHP deps
76+
if: steps.cache-php-deps.outputs.cache-hit != 'true'
77+
run: docker compose run --rm client composer install
78+
4779
- name: Run tests Neo4j 5
4880
run: |
4981
echo "PHP_VERSION=${{ matrix.php }}" > .env
5082
echo "CONNECTION=bolt://neo4j:testtest@neo4j" >> .env
5183
5284
docker compose up -d --build --remove-orphans --wait neo4j
5385
54-
docker compose run --rm --no-deps \
55-
client sh -c "composer install && ./vendor/bin/phpunit -c phpunit.xml.dist --testsuite Integration"
86+
docker compose run --rm \
87+
client ./vendor/bin/phpunit -c phpunit.xml.dist --testsuite Integration
5688
5789
echo "PHP_VERSION=${{ matrix.php }}" > .env
5890
echo "CONNECTION=neo4j://neo4j:testtest@neo4j" >> .env
5991
60-
docker compose run --rm --no-deps \
61-
client sh -c "./vendor/bin/phpunit -c phpunit.xml.dist --testsuite Integration"
92+
docker compose run --rm \
93+
client /vendor/bin/phpunit -c phpunit.xml.dist --testsuite Integration
6294
6395
docker compose down --remove-orphans --volumes

.github/workflows/static-analysis.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,17 @@ jobs:
1919
with:
2020
php-version: "8.3.17"
2121

22-
- name: Cache Composer dependencies
22+
- name: Cache PHP deps
23+
id: cache-php-deps
2324
uses: actions/cache@v4
2425
with:
25-
path: /tmp/composer-cache
26-
key: ${{ runner.os }}-${{ hashFiles('**/composer.json') }}
26+
path: vendor
27+
key: ${{ runner.os }}-php-8.3.17-${{ hashFiles('**/composer.json') }}
28+
restore-keys: |
29+
${{ runner.os }}-php-8.3.17-
2730
28-
- name: Install dependencies
31+
- name: Install PHP deps
32+
if: steps.cache-php-deps.outputs.cache-hit != 'true'
2933
run: composer install
3034

3135
- name: "PHP-CS-Fixer"

.github/workflows/unit-test.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,17 @@ jobs:
2323
with:
2424
php-version: ${{ matrix.php }}
2525

26-
- name: Cache Composer dependencies
26+
- name: Cache PHP deps
27+
id: cache-php-deps
2728
uses: actions/cache@v4
2829
with:
29-
path: /tmp/composer-cache
30-
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
30+
path: vendor
31+
key: ${{ runner.os }}-php-${{ matrix.php }}-${{ hashFiles('**/composer.json') }}
32+
restore-keys: |
33+
${{ runner.os }}-php-${{ matrix.php }}-
3134
32-
- name: Install dependencies
35+
- name: Install PHP deps
36+
if: steps.cache-php-deps.outputs.cache-hit != 'true'
3337
run: composer install
3438

3539
- uses: php-actions/phpunit@v4

0 commit comments

Comments
 (0)