Skip to content

Commit 6da9d87

Browse files
committed
Merge branch 'update-ci'
2 parents bc8a478 + ad48ed1 commit 6da9d87

File tree

15 files changed

+4335
-13
lines changed

15 files changed

+4335
-13
lines changed

.github/workflows/ci.yml

Lines changed: 59 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,19 @@ jobs:
2626
php-version: "8.2"
2727
coverage: none
2828

29-
- name: Install dependencies
29+
- name: Get Composer cache directory
30+
id: get-composer-cache
31+
shell: bash
32+
run: printf 'cache_dir=%s\n' "$(composer config cache-files-dir)" >>"$GITHUB_OUTPUT"
33+
34+
- name: Cache PHP dependencies
35+
uses: actions/cache@v3
36+
with:
37+
path: ${{ steps.get-composer-cache.outputs.cache_dir }}
38+
key: composer-cache-${{ runner.os }}-${{ hashFiles('**/composer.json', '**/composer.lock') }}
39+
restore-keys: composer-cache-${{ runner.os }}-
40+
41+
- name: Install PHP dependencies
3042
run: composer install --no-interaction --no-progress
3143

3244
- name: Check generated files
@@ -60,7 +72,19 @@ jobs:
6072
php-version: ${{ matrix.php-version }}
6173
coverage: none
6274

63-
- name: Install dependencies
75+
- name: Get Composer cache directory
76+
id: get-composer-cache
77+
shell: bash
78+
run: printf 'cache_dir=%s\n' "$(composer config cache-files-dir)" >>"$GITHUB_OUTPUT"
79+
80+
- name: Cache PHP dependencies
81+
uses: actions/cache@v3
82+
with:
83+
path: ${{ steps.get-composer-cache.outputs.cache_dir }}
84+
key: composer-cache-${{ runner.os }}-${{ hashFiles('**/composer.json', '**/composer.lock') }}
85+
restore-keys: composer-cache-${{ runner.os }}-
86+
87+
- name: Install PHP dependencies
6488
run: composer install --no-interaction --no-progress
6589

6690
- name: Run PHPStan
@@ -102,19 +126,48 @@ jobs:
102126
extensions: sqlite3
103127
coverage: pcov
104128

129+
- name: Get Composer cache directory
130+
id: get-composer-cache
131+
shell: bash
132+
run: printf 'cache_dir=%s\n' "$(composer config cache-files-dir)" >>"$GITHUB_OUTPUT"
133+
134+
- name: Cache PHP dependencies
135+
uses: actions/cache@v3
136+
with:
137+
path: ${{ steps.get-composer-cache.outputs.cache_dir }}
138+
key: composer-cache-${{ runner.os }}-${{ hashFiles('**/composer.json', '**/composer.lock') }}
139+
restore-keys: composer-cache-${{ runner.os }}-
140+
105141
- name: Setup Node.js
106142
uses: actions/setup-node@v3
107143
with:
108144
node-version: 18.x
145+
cache: npm
146+
cache-dependency-path: tools/*/package-lock.json
109147

110-
- name: Install dependencies
148+
- name: Install PHP dependencies
149+
run: composer install --no-interaction --no-progress
150+
151+
- name: Install Node.js dependencies
152+
shell: bash
111153
run: |
112-
composer install --no-interaction --no-progress
113-
npm install -g @mockoon/cli
154+
for file in tools/*/package-lock.json; do
155+
(cd "${file%/*}" && npm install)
156+
done
114157
115158
- name: Start Mockoon CLI
116159
shell: bash
117-
run: mockoon-cli start --port 3001 --log-transaction --data tests/fixtures/.mockoon/JsonPlaceholderApi.json &
160+
run: |
161+
tools/mockoon-cli/node_modules/.bin/mockoon-cli start --port 3001 --log-transaction --data tests/fixtures/.mockoon/JsonPlaceholderApi.json &
162+
i=-1
163+
while :; do
164+
jobs %% &>/dev/null
165+
if ((++i == 60)); then
166+
echo "mockoon-cli server unresponsive after $i seconds" >&2
167+
false
168+
fi
169+
curl -sI http://localhost:3001 >/dev/null && echo "mockoon-cli server up after $i seconds" && break || sleep 1
170+
done
118171
119172
- name: Run PHPUnit tests and generate code coverage report
120173
run: vendor/bin/phpunit --no-coverage --coverage-clover=coverage.xml

.github/workflows/documentation.yml

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55
branches:
66
- main
77
paths:
8-
- "apigen/**"
8+
- "**/apigen/**"
99
- "src/**"
1010

1111
concurrency:
@@ -27,15 +27,27 @@ jobs:
2727
php-version: "8.2"
2828
coverage: none
2929

30+
- name: Get Composer cache directory
31+
id: get-composer-cache
32+
shell: bash
33+
run: printf 'cache_dir=%s\n' "$(composer config cache-files-dir)" >>"$GITHUB_OUTPUT"
34+
35+
- name: Cache PHP dependencies
36+
uses: actions/cache@v3
37+
with:
38+
path: ${{ steps.get-composer-cache.outputs.cache_dir }}
39+
key: composer-cache-${{ runner.os }}-${{ hashFiles('**/composer.json', '**/composer.lock') }}
40+
restore-keys: composer-cache-${{ runner.os }}-
41+
3042
- name: Install dependencies
3143
run: composer install --no-interaction --no-progress
3244

3345
- name: Install ApiGen and its dependencies
34-
working-directory: apigen
46+
working-directory: tools/apigen
3547
run: composer install --no-interaction --no-progress
3648

3749
- name: Run ApiGen
38-
run: apigen/vendor/bin/apigen -c apigen/apigen.neon --output .ci/docs/api --verbose
50+
run: tools/apigen/vendor/bin/apigen -c tools/apigen/apigen.neon --output .ci/docs/api --verbose
3951

4052
- name: Upload GitHub Pages artifact
4153
uses: actions/upload-pages-artifact@v1

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@ You can build the API documentation locally by running the following commands in
3030
the top-level directory. It should appear in `docs/api` after a few seconds.
3131

3232
```shell
33-
composer -d apigen install
33+
composer -d tools/apigen install
3434
```
3535

3636
```shell
37-
apigen/vendor/bin/apigen -c apigen/apigen.neon
37+
tools/apigen/vendor/bin/apigen -c tools/apigen/apigen.neon
3838
```
3939

4040
Other documentation is available [here][docs] and in the source code.

apigen/.gitignore

Lines changed: 0 additions & 2 deletions
This file was deleted.

tools/apigen/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/vendor
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)