Merge pull request #541 from IQSS/533-use-time-tag-with-datetime-and-… #2272
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: | |
pull_request: | |
types: [opened, reopened] | |
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: Create containerized development environment .env file | |
working-directory: dev-env | |
run: cp .env.example .env | |
shell: bash | |
- name: Set S3 secrets for the containerized development environment | |
working-directory: dev-env | |
run: | | |
sed -i -e 's/<S3_ACCESS_KEY>/${{ secrets.S3_ACCESS_KEY }}/g' .env | |
sed -i -e 's/<S3_SECRET_KEY>/${{ secrets.S3_SECRET_KEY }}/g' .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: 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: 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@v3 | |
if: failure() | |
with: | |
name: cypress-screenshots | |
path: ./cypress/screenshots |