Added basic tests #894
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: test | |
on: push | |
env: | |
E2E_DATAVERSE_IMAGE_TAG: unstable | |
jobs: | |
e2e: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
cache: 'npm' | |
- name: Create .npmrc | |
run: | | |
cp .npmrc.example .npmrc | |
sed -i -e 's/<YOUR_GITHUB_AUTH_TOKEN>/${{ secrets.GITHUB_TOKEN }}/g' .npmrc | |
sed -i -e 's/<YOUR_NPM_AUTH_TOKEN>/${{ secrets.NPM_AUTH_TOKEN }}/g' .npmrc | |
- name: Install Dependencies | |
run: npm install | |
- name: Build Dataverse Design System | |
working-directory: packages/design-system | |
run: npm run build | |
- name: Create and populate .env file | |
env: | |
DATAVERSE_BACKEND_URL: 'http://localhost:8000' | |
run: | | |
touch .env | |
echo VITE_DATAVERSE_BACKEND_URL="$DATAVERSE_BACKEND_URL" >> .env | |
shell: bash | |
- name: Update registry for the containerized development environment | |
working-directory: dev-env | |
run: | | |
sed -i~ '/^REGISTRY=/s/=.*/=docker.io/' .env | |
shell: bash | |
- name: Start containers | |
working-directory: dev-env | |
run: ./run-env.sh "$E2E_DATAVERSE_IMAGE_TAG" | |
- name: Wait for containers to be ready | |
run: timeout 600s sh -c 'while ! docker logs dev_dataverse_bootstrap 2>&1 | grep -q "your instance has been configured"; do sleep 2; done' | |
- name: Run e2e tests | |
run: npm run test:e2e | |
- name: Dump docker logs on failure | |
if: failure() | |
uses: jwalton/gh-docker-logs@v2 | |
with: | |
dest: './logs' | |
- name: Tar logs | |
if: failure() | |
run: tar cvzf ./logs.tgz ./logs | |
- name: Upload logs to GitHub | |
if: failure() | |
uses: actions/upload-artifact@master | |
with: | |
name: logs.tgz | |
path: ./logs.tgz | |
component: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
cache: 'npm' | |
- name: Create .npmrc | |
run: | | |
cp .npmrc.example .npmrc | |
sed -i -e 's/<YOUR_GITHUB_AUTH_TOKEN>/${{ secrets.GITHUB_TOKEN }}/g' .npmrc | |
sed -i -e 's/<YOUR_NPM_AUTH_TOKEN>/${{ secrets.NPM_AUTH_TOKEN }}/g' .npmrc | |
- name: Install Dependencies | |
run: npm install | |
- name: Build Dataverse Design System | |
working-directory: packages/design-system | |
run: npm run build | |
- name: Cypress run | |
uses: cypress-io/github-action@v5 | |
with: | |
component: true | |
- name: Cypress run Design System | |
uses: cypress-io/github-action@v5 | |
with: | |
project: packages/design-system | |
component: true | |
- name: Check coverage | |
run: npm run test:coverage-all | |
- name: Merge coverage | |
run: npm run test:coverage-merge | |
- name: Upload coverage report to Coveralls | |
if: always() | |
uses: coverallsapp/github-action@v2 | |
with: | |
path-to-lcov: './merged-coverage/lcov.info' | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Upload Cypress screenshots | |
uses: actions/upload-artifact@v2 | |
if: failure() | |
with: | |
name: cypress-screenshots | |
path: ./cypress/screenshots | |
interaction-and-accessibility: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
cache: 'npm' | |
- name: Create .npmrc | |
run: | | |
cp .npmrc.example .npmrc | |
sed -i -e 's/<YOUR_GITHUB_AUTH_TOKEN>/${{ secrets.GITHUB_TOKEN }}/g' .npmrc | |
sed -i -e 's/<YOUR_NPM_AUTH_TOKEN>/${{ secrets.NPM_AUTH_TOKEN }}/g' .npmrc | |
- name: Install Dependencies | |
run: npm install | |
- name: Build Dataverse Design System | |
working-directory: packages/design-system | |
run: npm run build | |
- name: Install Playwright | |
run: npx playwright install | |
- name: Build Storybook Design System | |
working-directory: packages/design-system | |
run: npm run build-storybook --quiet | |
- name: Serve Storybook Design System and run tests | |
working-directory: packages/design-system | |
run: | | |
npx concurrently -k -s first -n "SB,TEST" -c "magenta,blue" \ | |
"npx http-server storybook-static --port 6006 --silent" \ | |
"npx wait-on http://127.0.0.1:6006 --l && npx test-storybook --url http://127.0.0.1:6006" | |
- name: Build Storybook | |
run: npm run build-storybook --quiet | |
- name: Serve Storybook and run tests | |
run: | | |
npx concurrently -k -s first -n "SB,TEST" -c "magenta,blue" \ | |
"npx http-server storybook-static --port 6006 --silent" \ | |
"npx wait-on http://127.0.0.1:6006 --l && npx test-storybook --url http://127.0.0.1:6006" |