Skip to content

Commit 401ced8

Browse files
committed
add tests against sucrase build
1 parent 396a9d9 commit 401ced8

File tree

1 file changed

+301
-0
lines changed

1 file changed

+301
-0
lines changed

.github/workflows/build.yml

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

0 commit comments

Comments
 (0)