Skip to content

Integration test

Integration test #5509

name: Integration test
on:
push:
branches:
- main
schedule:
- cron: '0 0 * * *' # end of each day (UTC)
pull_request:
env:
TEST_FOLDER: remix-test
jobs:
test:
if: ${{ github.repository == 'primer/brand' }}
name: Remix.run
runs-on:
labels: ubuntu-latest-16-cores
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Caching dependencies
uses: actions/cache@v4
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Installing dependencies
run: npm ci --legacy-peer-deps && cd apps/docs && npm ci --legacy-peer-deps
- name: Build
run: npm run build:lib
- name: Bundling output
run: cd ./packages/react && npm pack
- name: Configuring Remix.run
run: npx create-remix@latest ./${{env.TEST_FOLDER}} --yes
- name: Retrieving package version
id: package-version
uses: martinbeentjes/npm-get-version-action@7aa1d82604bb2dbe377a64ca35e692e6fe333c9c
with:
path: packages/repo-configs
- name: Installing local build
run: |
cd ${{env.TEST_FOLDER}}
cp ../packages/react/primer-react-brand-${{ steps.package-version.outputs.current-version}}.tgz ./
npm install primer-react-brand-${{ steps.package-version.outputs.current-version}}.tgz vite-plugin-cjs-interop
- name: Prefer ESM imports
run: |
mv ./packages/e2e/integration-tests/fixtures/index.esm.ts ./packages/e2e/integration-tests/fixtures/index.ts
rm ./packages/e2e/integration-tests/fixtures/index.cjs.ts
- name: Copying required files
run: |
cp ./packages/e2e/integration-tests/remix.run/vite.config.ts ./${{env.TEST_FOLDER}}
cp ./packages/e2e/integration-tests/remix.run/_index.tsx ./${{env.TEST_FOLDER}}/app/routes
cp ./packages/e2e/integration-tests/remix.run/root.tsx ./${{env.TEST_FOLDER}}/app
cp -r ./packages/e2e/integration-tests/fixtures ./${{env.TEST_FOLDER}}/app
cp ./packages/e2e/cypress.config.js ./${{env.TEST_FOLDER}}
mkdir ${{env.TEST_FOLDER}}/integration-tests
cp -r ./packages/e2e/integration-tests/fixtures ./${{env.TEST_FOLDER}}/integration-tests
cp -r ./packages/e2e/integration-tests/tests ./${{env.TEST_FOLDER}}/integration-tests
- name: Testing compile-time build
run: cd ${{env.TEST_FOLDER}} && npm run build
# Disabling this step as there is a hydration inconsistency between cypress and remix.run.
# We should monitor and reenable this asap:
# more info: https://github.com/remix-run/remix/issues/2570
#- name: Test runtime for errors and warnings
# run: |
# rm ${{env.TEST_FOLDER}}/cypress.config.ts
# cd ${{env.TEST_FOLDER}} && npx start-server-and-test 'dev' 3000 'npx cypress run --spec "./integration-tests/tests/*" --config video=false'