Only show one error at once (#2801)

* Do not show more than one error toast at a time

* use sha as file upload id

* again

* again

* again

* again

* fmt

* Hopefully fix flakiness

* move to macos-14-large

---------

Co-authored-by: Paul Tagliamonte <paul@zoo.dev>
Co-authored-by: Paul R. Tagliamonte <paul@kittycad.io>
This commit is contained in:
49fl
2024-06-26 14:04:23 -04:00
committed by GitHub
parent 68cdb68231
commit 0d4d7fa751
2 changed files with 24 additions and 12 deletions

View File

@ -38,6 +38,8 @@ jobs:
runs-on: ubuntu-latest-8-cores runs-on: ubuntu-latest-8-cores
needs: check-rust-changes needs: check-rust-changes
steps: steps:
- name: Tune GitHub-hosted runner network
uses: smorimoto/tune-github-hosted-runner-network@v1
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: actions/setup-node@v4 - uses: actions/setup-node@v4
with: with:
@ -90,14 +92,17 @@ jobs:
- name: build web - name: build web
run: yarn build:local run: yarn build:local
- name: Run ubuntu/chrome snapshots - name: Run ubuntu/chrome snapshots
continue-on-error: true
run: | run: |
yarn playwright test --project="Google Chrome" --update-snapshots e2e/playwright/snapshot-tests.spec.ts yarn playwright test --project="Google Chrome" --update-snapshots e2e/playwright/snapshot-tests.spec.ts
# remove test-results, messes with retry logic
rm -r test-results
env: env:
CI: true CI: true
token: ${{ secrets.KITTYCAD_API_TOKEN_DEV }} token: ${{ secrets.KITTYCAD_API_TOKEN_DEV }}
snapshottoken: ${{ secrets.KITTYCAD_API_TOKEN }} snapshottoken: ${{ secrets.KITTYCAD_API_TOKEN }}
- name: Clean up test-results
if: always()
continue-on-error: true
run: rm -r test-results
- name: check for changes - name: check for changes
id: git-check id: git-check
run: | run: |
@ -124,7 +129,7 @@ jobs:
- uses: actions/upload-artifact@v4 - uses: actions/upload-artifact@v4
if: steps.git-check.outputs.modified == 'true' if: steps.git-check.outputs.modified == 'true'
with: with:
name: playwright-report-ubuntu name: playwright-report-ubuntu-${{ github.sha }}
path: playwright-report/ path: playwright-report/
retention-days: 30 retention-days: 30
# if have previous run results, use them # if have previous run results, use them
@ -132,7 +137,7 @@ jobs:
if: always() if: always()
continue-on-error: true continue-on-error: true
with: with:
name: test-results-ubuntu name: test-results-ubuntu-${{ github.sha }}
path: test-results/ path: test-results/
- name: Run ubuntu/chrome flow retry failures - name: Run ubuntu/chrome flow retry failures
id: retry id: retry
@ -158,23 +163,25 @@ jobs:
- uses: actions/upload-artifact@v4 - uses: actions/upload-artifact@v4
if: always() if: always()
with: with:
name: test-results-ubuntu name: test-results-ubuntu-${{ github.sha }}
path: test-results/ path: test-results/
retention-days: 30 retention-days: 30
overwrite: true overwrite: true
- uses: actions/upload-artifact@v4 - uses: actions/upload-artifact@v4
if: always() if: always()
with: with:
name: playwright-report-ubuntu name: playwright-report-ubuntu-${{ github.sha }}
path: playwright-report/ path: playwright-report/
retention-days: 30 retention-days: 30
overwrite: true overwrite: true
playwright-macos: playwright-macos:
timeout-minutes: 60 timeout-minutes: 60
runs-on: macos-14 runs-on: macos-14-large
needs: check-rust-changes needs: check-rust-changes
steps: steps:
- name: Tune GitHub-hosted runner network
uses: smorimoto/tune-github-hosted-runner-network@v1
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: actions/setup-node@v4 - uses: actions/setup-node@v4
with: with:
@ -232,7 +239,7 @@ jobs:
if: ${{ always() }} if: ${{ always() }}
continue-on-error: true continue-on-error: true
with: with:
name: test-results-macos name: test-results-macos-${{ github.sha }}
path: test-results/ path: test-results/
- name: Run macos/safari flow retry failures - name: Run macos/safari flow retry failures
id: retry id: retry
@ -260,14 +267,14 @@ jobs:
- uses: actions/upload-artifact@v4 - uses: actions/upload-artifact@v4
if: ${{ always() }} if: ${{ always() }}
with: with:
name: test-results-macos name: test-results-macos-${{ github.sha }}
path: test-results/ path: test-results/
retention-days: 30 retention-days: 30
overwrite: true overwrite: true
- uses: actions/upload-artifact@v4 - uses: actions/upload-artifact@v4
if: ${{ always() }} if: ${{ always() }}
with: with:
name: playwright-report-macos name: playwright-report-macos-${{ github.sha }}
path: playwright-report/ path: playwright-report/
retention-days: 30 retention-days: 30
overwrite: true overwrite: true

View File

@ -29,7 +29,10 @@ export function cleanErrs<T>(
return [argsWOutErr.length !== value.length, argsWOutErr, argsWErr] return [argsWOutErr.length !== value.length, argsWOutErr, argsWErr]
} }
// Used to report errors to user at a certain point in execution /**
* Used to report errors to user at a certain point in execution
* @returns boolean
*/
export function trap<T>( export function trap<T>(
value: ExcludeErr<T> | Error, value: ExcludeErr<T> | Error,
opts?: { opts?: {
@ -43,6 +46,8 @@ export function trap<T>(
console.error(value) console.error(value)
opts?.suppress || opts?.suppress ||
toast.error((opts?.altErr ?? value ?? new Error('Unknown')).toString()) toast.error((opts?.altErr ?? value ?? new Error('Unknown')).toString(), {
id: 'error',
})
return true return true
} }