Skip to content

Commit

Permalink
chore: Update snapshots when updating dictionaries (#3932)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason3S committed Dec 25, 2022
1 parent 38ac568 commit 1eee3a9
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 2 deletions.
78 changes: 78 additions & 0 deletions .github/workflows/update-dictionaries.yml
Expand Up @@ -213,10 +213,88 @@ jobs:
path: temp/*.diff
retention-days: 1

update-snapshots:
if: ${{ needs.check-dictionaries.outputs.patch }}
runs-on: ubuntu-latest
needs:
- build
- calc-ref
- check-dictionaries

env:
REF_BRANCH: ${{ needs.calc-ref.outputs.ref }}
PATCH: ${{ needs.check-dictionaries.outputs.patch }}

steps:
- name: Build Results
run: |
echo "key: ${{ needs.build.outputs.key }}"
echo "path: ${{ needs.build.outputs.path }}"
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ env.REF_BRANCH }}

- name: Setup pnpm
uses: pnpm/action-setup@v2.2.4

- name: Patch
run: |
echo "$PATCH" | git apply
- name: Use Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
cache: "pnpm"

- run: pnpm -v

- name: Cache Build
id: step-cache-build
uses: actions/cache@v3
with:
key: ${{ needs.build.outputs.key }}
path: ${{ needs.build.outputs.path }}

- name: Cached Results
run: |
echo Build Cache: ${{ steps.step-cache-build.outputs.cache-hit && 'Hit' || 'Miss' }}
- name: Install
run: pnpm i

- name: Has pnpm has failed?
if: ${{ failure() }}
run: |
ls -alF /home/runner/.pnpm/_logs/*.log
cat /home/runner/.pnpm/_logs/*.log
- name: Check Build
if: ${{ !steps.step-cache-build.outputs.cache-hit }}
run: exit 1

- name: Update update-snapshots-only
run: |
pnpm run test:update-snapshots
- name: Store Update Snapshot Diff
run: |
mkdir temp || echo temp already exists
git diff integration-tests/config integration-tests/repositories integration-tests/snapshots > temp/update_snapshot.diff
- name: store diff
uses: actions/upload-artifact@v3
with:
name: diffs
path: temp/*.diff
retention-days: 1

pr-setup:
runs-on: ubuntu-latest
needs:
- integrations
- update-snapshots
- calc-ref
- check-dictionaries

Expand Down
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -39,6 +39,7 @@
"symlink": "node build_tools/bin/symlink.js packages test-packages",
"test-watch": "pnpm -r run --parallel test-watch",
"test": "pnpm -r run test && pnpm run test-schema",
"test:update-snapshots": "pnpm run -r test:update-snapshot",
"test-bin": "pnpm run test-bin-spell && pnpm run test-bin-spell-cache-content && pnpm run test-bin-spell-cache-metadata && pnpm run test-bin-trace && pnpm run test-bin-check",
"test-bin-check": "node ./bin.js check README.md",
"test-bin-spell": "node ./bin.js -c cspellrc.json --no-progress --no-cache",
Expand Down
2 changes: 1 addition & 1 deletion packages/cspell-lib/package.json
Expand Up @@ -24,7 +24,7 @@
"test-watch": "jest --watch",
"prepublishOnly": "pnpm run clean-build",
"test": "jest",
"update-snapshot": "jest --updateSnapshot"
"test:update-snapshot": "jest --updateSnapshot"
},
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion packages/cspell/package.json
Expand Up @@ -46,7 +46,7 @@
"test-watch": "jest --watch",
"prepublishOnly": "pnpm run clean-build",
"test": "jest",
"update-snapshot": "jest --updateSnapshot"
"test:update-snapshot": "jest --updateSnapshot"
},
"repository": {
"type": "git",
Expand Down

0 comments on commit 1eee3a9

Please sign in to comment.