Skip to content

Commit bbb3a8f

Browse files
committed
add tests against sucrase build
1 parent 335d44f commit bbb3a8f

File tree

1 file changed

+305
-0
lines changed

1 file changed

+305
-0
lines changed

.github/workflows/build.yml

+305
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,45 @@ jobs:
105105
# `job_build` can't see `job_install_deps` and what it returned)
106106
dependency_cache_key: ${{ needs.job_install_deps.outputs.dependency_cache_key }}
107107

108+
# This isn't a full `yarn build` using sucrase - it's just the cache from the normal build, with `build/cjs` and
109+
# `build/esm` overwritten by sucrase. This way we don't need to worry about all of the other random stuff which
110+
# packages build, because it will already be there.
111+
job_build_with_sucrase:
112+
name: Sucrase Build
113+
needs: [job_install_deps, job_build]
114+
runs-on: ubuntu-latest
115+
timeout-minutes: 20
116+
steps:
117+
- name: Check out current commit (${{ env.HEAD_COMMIT }})
118+
uses: actions/checkout@v2
119+
with:
120+
ref: ${{ env.HEAD_COMMIT }}
121+
- name: Set up Node
122+
uses: actions/setup-node@v1
123+
- name: Check dependency cache
124+
uses: actions/cache@v2
125+
with:
126+
path: ${{ env.CACHED_DEPENDENCY_PATHS }}
127+
key: ${{ needs.job_install_deps.outputs.dependency_cache_key }}
128+
- name: Check tsc build cache
129+
uses: actions/cache@v2
130+
with:
131+
path: ${{ env.CACHED_BUILD_PATHS }}
132+
key: ${{ env.BUILD_CACHE_KEY }}
133+
- name: Check sucrase build cache
134+
uses: actions/cache@v2
135+
id: cache_built_sucrase_packages
136+
with:
137+
path: ${{ env.CACHED_BUILD_PATHS }}
138+
key: ${{ env.BUILD_CACHE_KEY }}-sucrase
139+
- name: Build packages with sucrase
140+
if: steps.cache_built_sucrase_packages.outputs.cache-hit == ''
141+
run: 'yarn build:rollup'
142+
outputs:
143+
# this needs to be passed on, because the `needs` context only looks at direct ancestors (so steps which depend on
144+
# `job_build` can't see `job_install_deps` and what it returned)
145+
dependency_cache_key: ${{ needs.job_install_deps.outputs.dependency_cache_key }}
146+
108147
job_size_check:
109148
name: Size Check
110149
needs: job_build
@@ -492,3 +531,269 @@ jobs:
492531
run: |
493532
cd packages/node-integration-tests
494533
yarn test
534+
535+
job_unit_test_sucrase:
536+
name: Sucrase Test (Node ${{ matrix.node }})
537+
needs: job_build_with_sucrase
538+
continue-on-error: true
539+
timeout-minutes: 30
540+
runs-on: ubuntu-latest
541+
strategy:
542+
matrix:
543+
node: [8, 10, 12, 14, 16]
544+
steps:
545+
- name: Check out current commit (${{ env.HEAD_COMMIT }})
546+
uses: actions/checkout@v2
547+
with:
548+
ref: ${{ env.HEAD_COMMIT }}
549+
- name: Set up Node
550+
uses: actions/setup-node@v1
551+
with:
552+
node-version: ${{ matrix.node }}
553+
- name: Check dependency cache
554+
uses: actions/cache@v2
555+
with:
556+
path: ${{ env.CACHED_DEPENDENCY_PATHS }}
557+
key: ${{ needs.job_build_with_sucrase.outputs.dependency_cache_key }}
558+
- name: Check build cache
559+
uses: actions/cache@v2
560+
with:
561+
path: ${{ env.CACHED_BUILD_PATHS }}
562+
key: ${{ env.BUILD_CACHE_KEY }}-sucrase
563+
- name: Run tests
564+
env:
565+
NODE_VERSION: ${{ matrix.node }}
566+
run: |
567+
[[ $NODE_VERSION == 8 ]] && yarn add --dev --ignore-engines --ignore-scripts --ignore-workspace-root-check [email protected]
568+
yarn test-ci
569+
- name: Compute test coverage
570+
uses: codecov/codecov-action@v1
571+
572+
job_nextjs_integration_test_sucrase:
573+
name: Sucrase Test @sentry/nextjs on (Node ${{ matrix.node }})
574+
needs: job_build_with_sucrase
575+
continue-on-error: true
576+
timeout-minutes: 30
577+
runs-on: ubuntu-latest
578+
strategy:
579+
matrix:
580+
node: [10, 12, 14, 16]
581+
steps:
582+
- name: Check out current commit (${{ env.HEAD_COMMIT }})
583+
uses: actions/checkout@v2
584+
with:
585+
ref: ${{ env.HEAD_COMMIT }}
586+
- name: Set up Node
587+
uses: actions/setup-node@v1
588+
with:
589+
node-version: ${{ matrix.node }}
590+
- name: Check dependency cache
591+
uses: actions/cache@v2
592+
with:
593+
path: ${{ env.CACHED_DEPENDENCY_PATHS }}
594+
key: ${{ needs.job_build_with_sucrase.outputs.dependency_cache_key }}
595+
- name: Check build cache
596+
uses: actions/cache@v2
597+
with:
598+
path: ${{ env.CACHED_BUILD_PATHS }}
599+
key: ${{ env.BUILD_CACHE_KEY }}-sucrase
600+
- name: Run tests
601+
env:
602+
NODE_VERSION: ${{ matrix.node }}
603+
run: |
604+
cd packages/nextjs
605+
yarn test:integration
606+
607+
# Ember tests are separate from the rest because they are the slowest part of the test suite, and making them a
608+
# separate job allows them to run in parallel with the other tests.
609+
job_ember_tests_sucrase:
610+
name: Sucrase Test @sentry/ember
611+
needs: job_build_with_sucrase
612+
continue-on-error: true
613+
timeout-minutes: 30
614+
runs-on: ubuntu-latest
615+
steps:
616+
- name: Check out current commit (${{ env.HEAD_COMMIT }})
617+
uses: actions/checkout@v2
618+
with:
619+
ref: ${{ env.HEAD_COMMIT }}
620+
# TODO: removing `fetch-depth` below seems to have no effect, and the commit which added it had no description,
621+
# so it's not clear why it's necessary. That said, right now ember tests are xfail, so it's a little hard to
622+
# tell if it's safe to remove. Once ember tests are fixed, let's try again with it turned off, and if all goes
623+
# well, we can pull it out.
624+
fetch-depth: 0
625+
- name: Set up Node
626+
uses: actions/setup-node@v1
627+
with:
628+
# The only danger with Ember in terms of Node versions is that the build tool, ember-cli, won't work if Node
629+
# is too old. Since Oct 2019, Node 10 has been the oldest version supported by ember-cli, so test against
630+
# that. If it passes, newer versions of Node should also be fine. This saves us from having to run the Ember
631+
# tests in our Node matrix above.
632+
node-version: '10'
633+
- name: Check dependency cache
634+
uses: actions/cache@v2
635+
with:
636+
path: ${{ env.CACHED_DEPENDENCY_PATHS }}
637+
key: ${{ needs.job_build_with_sucrase.outputs.dependency_cache_key }}
638+
- name: Check build cache
639+
uses: actions/cache@v2
640+
with:
641+
path: ${{ env.CACHED_BUILD_PATHS }}
642+
key: ${{ env.BUILD_CACHE_KEY }}-sucrase
643+
- name: Run Ember tests
644+
run: yarn test --scope=@sentry/ember
645+
- name: Compute test coverage
646+
uses: codecov/codecov-action@v1
647+
648+
job_browser_playwright_tests_sucrase:
649+
name: Sucrase Playwright - ${{ (matrix.tracing_only && 'Browser + Tracing') || 'Browser' }} (${{ matrix.bundle }})
650+
needs: job_build_with_sucrase
651+
runs-on: ubuntu-latest
652+
strategy:
653+
matrix:
654+
bundle:
655+
- esm
656+
- cjs
657+
tracing_only:
658+
- true
659+
- false
660+
exclude:
661+
# `tracing_only` only makes a difference for bundles - tests of the esm and cjs builds always include the
662+
# tracing tests
663+
- bundle: esm
664+
tracing_only: false
665+
- bundle: cjs
666+
tracing_only: false
667+
steps:
668+
- name: Check out current commit (${{ env.HEAD_COMMIT }})
669+
uses: actions/checkout@v2
670+
with:
671+
ref: ${{ env.HEAD_COMMIT }}
672+
- name: Set up Node
673+
uses: actions/setup-node@v1
674+
with:
675+
node-version: '16'
676+
- name: Check dependency cache
677+
uses: actions/cache@v2
678+
with:
679+
path: ${{ env.CACHED_DEPENDENCY_PATHS }}
680+
key: ${{ needs.job_build_with_sucrase.outputs.dependency_cache_key }}
681+
- name: Check build cache
682+
uses: actions/cache@v2
683+
with:
684+
path: ${{ env.CACHED_BUILD_PATHS }}
685+
key: ${{ env.BUILD_CACHE_KEY }}-sucrase
686+
- name: Run Playwright tests
687+
env:
688+
PW_BUNDLE: ${{ matrix.bundle }}
689+
PW_TRACING_ONLY: ${{ matrix.tracing_only }}
690+
run: |
691+
cd packages/integration-tests
692+
yarn run playwright install-deps webkit
693+
yarn test:ci
694+
695+
job_browser_integration_tests_sucrase:
696+
name: Sucrase Old Browser Integration Tests (${{ matrix.browser }})
697+
needs: job_build_with_sucrase
698+
runs-on: ubuntu-latest
699+
timeout-minutes: 10
700+
continue-on-error: true
701+
strategy:
702+
matrix:
703+
browser:
704+
- ChromeHeadless
705+
- FirefoxHeadless
706+
- WebkitHeadless
707+
steps:
708+
- name: Check out current commit (${{ env.HEAD_COMMIT }})
709+
uses: actions/checkout@v2
710+
with:
711+
ref: ${{ env.HEAD_COMMIT }}
712+
- name: Set up Node
713+
uses: actions/setup-node@v1
714+
- name: Check dependency cache
715+
uses: actions/cache@v2
716+
with:
717+
path: ${{ env.CACHED_DEPENDENCY_PATHS }}
718+
key: ${{ needs.job_build_with_sucrase.outputs.dependency_cache_key }}
719+
- name: Check build cache
720+
uses: actions/cache@v2
721+
with:
722+
path: ${{ env.CACHED_BUILD_PATHS }}
723+
key: ${{ env.BUILD_CACHE_KEY }}-sucrase
724+
- name: Run integration tests
725+
env:
726+
KARMA_BROWSER: ${{ matrix.browser }}
727+
run: |
728+
cd packages/browser
729+
[[ $KARMA_BROWSER == WebkitHeadless ]] && yarn run playwright install-deps webkit
730+
yarn test:integration
731+
732+
job_browser_build_tests_sucrase:
733+
name: Sucrase Browser Build Tests
734+
needs: job_build_with_sucrase
735+
runs-on: ubuntu-latest
736+
timeout-minutes: 5
737+
continue-on-error: true
738+
steps:
739+
- name: Check out current commit (${ env.HEAD_COMMIT }})
740+
uses: actions/checkout@v2
741+
with:
742+
ref: ${{ env.HEAD_COMMIT }}
743+
- name: Set up Node
744+
uses: actions/setup-node@v1
745+
with:
746+
node-version: '16'
747+
- name: Check dependency cache
748+
uses: actions/cache@v2
749+
with:
750+
path: ${{ env.CACHED_DEPENDENCY_PATHS }}
751+
key: ${{ needs.job_build_with_sucrase.outputs.dependency_cache_key }}
752+
- name: Check build cache
753+
uses: actions/cache@v2
754+
with:
755+
path: ${{ env.CACHED_BUILD_PATHS }}
756+
key: ${{ env.BUILD_CACHE_KEY }}-sucrase
757+
- name: Run browser build tests
758+
run: |
759+
cd packages/browser
760+
yarn test:package
761+
- name: Run utils build tests
762+
run: |
763+
cd packages/utils
764+
yarn test:package
765+
766+
job_node_integration_tests_sucrase:
767+
name: Sucrase Node SDK Integration Tests (${{ matrix.node }})
768+
needs: job_build_with_sucrase
769+
runs-on: ubuntu-latest
770+
timeout-minutes: 10
771+
continue-on-error: true
772+
strategy:
773+
matrix:
774+
node: [10, 12, 14, 16]
775+
steps:
776+
- name: Check out current commit (${{ github.sha }})
777+
uses: actions/checkout@v2
778+
with:
779+
ref: ${{ env.HEAD_COMMIT }}
780+
- name: Set up Node
781+
uses: actions/setup-node@v1
782+
with:
783+
node-version: ${{ matrix.node }}
784+
- name: Check dependency cache
785+
uses: actions/cache@v2
786+
with:
787+
path: ${{ env.CACHED_DEPENDENCY_PATHS }}
788+
key: ${{ needs.job_build_with_sucrase.outputs.dependency_cache_key }}
789+
- name: Check build cache
790+
uses: actions/cache@v2
791+
with:
792+
path: ${{ env.CACHED_BUILD_PATHS }}
793+
key: ${{ env.BUILD_CACHE_KEY }}-sucrase
794+
- name: Run integration tests
795+
env:
796+
NODE_VERSION: ${{ matrix.node }}
797+
run: |
798+
cd packages/node-integration-tests
799+
yarn test

0 commit comments

Comments
 (0)