-
Notifications
You must be signed in to change notification settings - Fork 16
150 lines (119 loc) · 4.02 KB
/
test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
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@v4
if: failure()
with:
name: cypress-screenshots
path: ./cypress/screenshots