File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -59,23 +59,31 @@ jobs:
5959 echo "::error::The CONVERTAPI_STAGING_TOKEN secret is not available to this run (a pull request from a fork gets no secrets)"
6060 exit 1
6161 fi
62- npm test
62+ # The staging API now and then answers 503 (no healthy upstream), so each test gets two retries.
63+ npm run lint
64+ npm run cover -- --retries 2
6365
6466 - name : Build
6567 run : npm run build
6668
6769 # The examples call the production API and catch and print their own errors, so the preload points
68- # them at CONVERT_API_BASE_URI and any printed error fails the step.
70+ # them at CONVERT_API_BASE_URI and any printed error fails an attempt. Up to three attempts, because
71+ # the staging API now and then answers 503.
6972 - name : Run the examples
7073 env :
7174 API_TOKEN : ${{ secrets.CONVERTAPI_STAGING_TOKEN }}
7275 run : |
7376 set -euo pipefail
74- node --require ./.github/examples-base-uri.js examples/ 2>&1 | tee examples.log
75- if grep -q '^Error' examples.log; then
76- echo "::error::An example failed, see the errors above"
77- exit 1
78- fi
77+ for attempt in 1 2 3; do
78+ node --require ./.github/examples-base-uri.js examples/ 2>&1 | tee examples.log
79+ if ! grep -q '^Error' examples.log; then
80+ exit 0
81+ fi
82+ echo "::warning::Attempt $attempt: an example failed, see the errors above"
83+ sleep 10
84+ done
85+ echo "::error::The examples failed three times"
86+ exit 1
7987
8088 build :
8189 name : build
Original file line number Diff line number Diff line change @@ -144,7 +144,10 @@ jobs:
144144 - name : Lint and test
145145 env :
146146 CONVERT_API_SECRET : ${{ secrets.CONVERTAPI_STAGING_TOKEN }}
147- run : npm test
147+ # The staging API now and then answers 503 (no healthy upstream), so each test gets two retries.
148+ run : |
149+ npm run lint
150+ npm run cover -- --retries 2
148151
149152 - name : Set the version and build
150153 env :
You can’t perform that action at this time.
0 commit comments