-
-
Notifications
You must be signed in to change notification settings - Fork 534
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add "smoke-test/examples" workflow (#1825)
- Loading branch information
1 parent
dff7fac
commit 009e8fa
Showing
3 changed files
with
83 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
name: smoke-test | ||
|
||
on: | ||
# Always run smoke tests upon a successful | ||
# "ci" job completion on "main". | ||
workflow_run: | ||
workflows: ['ci'] | ||
branches: [main] | ||
types: [completed] | ||
# Also allow on-demand smoke test runs. | ||
# Useful when testing a particular branch | ||
# for compatibility with the examples. | ||
workflow_dispatch: | ||
|
||
jobs: | ||
examples: | ||
if: ${{ github.event.workflow_run.conclusion == 'success' }} | ||
runs-on: macos-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18 | ||
|
||
- name: Set up PNPM | ||
uses: pnpm/action-setup@v2 | ||
with: | ||
version: 7.12 | ||
|
||
- name: Install dependencies | ||
run: pnpm install | ||
|
||
- name: Test examples | ||
run: ./config/scripts/smoke-test.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
COMMIT_HASH=$(git rev-parse HEAD) | ||
MSW_VERSION="0.0.0-$COMMIT_HASH" | ||
echo "Latest commit: $COMMIT_HASH" | ||
echo "In-progress MSW version: $MSW_VERSION" | ||
|
||
PKG_JSON_COPY="package.json.copy" | ||
cp package.json $PKG_JSON_COPY | ||
|
||
pnpm version $MSW_VERSION --no-git-tag-version --allow-same-version | ||
|
||
echo "" | ||
echo "Packing MSW..." | ||
pnpm pack | ||
|
||
EXAMPLES_REPO=https://github.com/mswjs/examples.git | ||
EXAMPLES_DIR=./examples | ||
echo "" | ||
echo "Cloning the examples from "$EXAMPLES_REPO"..." | ||
|
||
if [[ -d "$EXAMPLES_DIR" ]]; then | ||
echo "Examples already cloned, skipping..." | ||
else | ||
git clone $EXAMPLES_REPO $EXAMPLES_DIR | ||
fi | ||
|
||
echo "" | ||
echo "Installing dependencies..." | ||
cd $EXAMPLES_DIR | ||
pnpm install | ||
|
||
echo "" | ||
echo "Linking MSW..." | ||
pnpm add msw --filter="with-*" file:../../../msw-$MSW_VERSION.tgz | ||
pnpm ls msw | ||
|
||
echo "" | ||
echo "Running tests..." | ||
CI=1 pnpm test ; (cd ../ && mv $PKG_JSON_COPY ./package.json) |