|
26 | 26 | php-version: "8.2" |
27 | 27 | coverage: none |
28 | 28 |
|
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 |
30 | 42 | run: composer install --no-interaction --no-progress |
31 | 43 |
|
32 | 44 | - name: Check generated files |
|
60 | 72 | php-version: ${{ matrix.php-version }} |
61 | 73 | coverage: none |
62 | 74 |
|
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 |
64 | 88 | run: composer install --no-interaction --no-progress |
65 | 89 |
|
66 | 90 | - name: Run PHPStan |
@@ -102,19 +126,48 @@ jobs: |
102 | 126 | extensions: sqlite3 |
103 | 127 | coverage: pcov |
104 | 128 |
|
| 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 | + |
105 | 141 | - name: Setup Node.js |
106 | 142 | uses: actions/setup-node@v3 |
107 | 143 | with: |
108 | 144 | node-version: 18.x |
| 145 | + cache: npm |
| 146 | + cache-dependency-path: tools/*/package-lock.json |
109 | 147 |
|
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 |
111 | 153 | 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 |
114 | 157 |
|
115 | 158 | - name: Start Mockoon CLI |
116 | 159 | 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 |
118 | 171 |
|
119 | 172 | - name: Run PHPUnit tests and generate code coverage report |
120 | 173 | run: vendor/bin/phpunit --no-coverage --coverage-clover=coverage.xml |
|
0 commit comments