Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 15 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,23 +59,31 @@ jobs:
echo "::error::The CONVERTAPI_STAGING_TOKEN secret is not available to this run (a pull request from a fork gets no secrets)"
exit 1
fi
npm test
# The staging API now and then answers 503 (no healthy upstream), so each test gets two retries.
npm run lint
npm run cover -- --retries 2

- name: Build
run: npm run build

# The examples call the production API and catch and print their own errors, so the preload points
# them at CONVERT_API_BASE_URI and any printed error fails the step.
# them at CONVERT_API_BASE_URI and any printed error fails an attempt. Up to three attempts, because
# the staging API now and then answers 503.
- name: Run the examples
env:
API_TOKEN: ${{ secrets.CONVERTAPI_STAGING_TOKEN }}
run: |
set -euo pipefail
node --require ./.github/examples-base-uri.js examples/ 2>&1 | tee examples.log
if grep -q '^Error' examples.log; then
echo "::error::An example failed, see the errors above"
exit 1
fi
for attempt in 1 2 3; do
node --require ./.github/examples-base-uri.js examples/ 2>&1 | tee examples.log
if ! grep -q '^Error' examples.log; then
Comment on lines +78 to +79
exit 0
fi
echo "::warning::Attempt $attempt: an example failed, see the errors above"
sleep 10
done
echo "::error::The examples failed three times"
exit 1

build:
name: build
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,10 @@ jobs:
- name: Lint and test
env:
CONVERT_API_SECRET: ${{ secrets.CONVERTAPI_STAGING_TOKEN }}
run: npm test
# The staging API now and then answers 503 (no healthy upstream), so each test gets two retries.
run: |
npm run lint
npm run cover -- --retries 2

- name: Set the version and build
env:
Expand Down
Loading