Skip to content

Commit da973e0

Browse files
committed
feat(ci): add automated e2e testing workflow
- Separate deploy-staging and e2e-tests into new deploy-staging.yaml workflow - Maintain dependency for e2e on deploy-staging
1 parent 034a0ec commit da973e0

2 files changed

Lines changed: 82 additions & 25 deletions

File tree

.github/workflows/ci.yaml

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -218,29 +218,4 @@ jobs:
218218
- name: Update Coverage Badge
219219
uses: we-cli/coverage-badge-action@main
220220

221-
deploy-staging:
222-
if: github.event_name == 'push' && github.ref == format('refs/heads/{0}', github.event.repository.default_branch)
223-
runs-on: ubuntu-latest
224-
needs:
225-
- lint-js
226-
- build-front
227-
- lint-and-unit-test-django
228-
- integration-test-django
229-
steps:
230-
- name: Configure staging host authenticity
231-
run: |
232-
mkdir -p ~/.ssh/ && chmod 700 ~/.ssh/
233-
touch ~/.ssh/known_hosts && chmod 600 ~/.ssh/known_hosts
234-
echo "$SSH_HOSTKEY" > ~/.ssh/known_hosts
235-
env:
236-
SSH_HOSTKEY: ${{ secrets.STAGING_HOSTKEY }}
237221

238-
- name: Deploy to staging
239-
run: |
240-
eval $(ssh-agent -s)
241-
echo "$SSH_KEY" | ssh-add - >/dev/null
242-
ssh "${SSH_USER}@${SSH_HOST}" "deploy ${GITHUB_SHA}"
243-
env:
244-
SSH_USER: ${{ secrets.STAGING_USER }}
245-
SSH_HOST: ${{ secrets.STAGING_HOST }}
246-
SSH_KEY: ${{ secrets.STAGING_KEY }}
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
name: Deploy Staging and E2E
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
types:
8+
- opened
9+
- synchronize
10+
- reopened
11+
- ready_for_review
12+
13+
concurrency:
14+
group: deploy-${{ github.ref }}
15+
cancel-in-progress: true
16+
17+
env:
18+
CI: true
19+
20+
jobs:
21+
deploy-staging:
22+
if: github.event_name == 'push' && github.ref == format('refs/heads/{0}', github.event.repository.default_branch)
23+
runs-on: ubuntu-latest
24+
needs:
25+
- lint-js
26+
- build-front
27+
- lint-and-unit-test-django
28+
- integration-test-django
29+
steps:
30+
- name: Configure staging host authenticity
31+
run: |
32+
mkdir -p ~/.ssh/ && chmod 700 ~/.ssh/
33+
touch ~/.ssh/known_hosts && chmod 600 ~/.ssh/known_hosts
34+
echo "$SSH_HOSTKEY" > ~/.ssh/known_hosts
35+
env:
36+
SSH_HOSTKEY: ${{ secrets.STAGING_HOSTKEY }}
37+
38+
- name: Deploy to staging
39+
run: |
40+
eval $(ssh-agent -s)
41+
echo "$SSH_KEY" | ssh-add - >/dev/null
42+
ssh "${SSH_USER}@${SSH_HOST}" "deploy ${GITHUB_SHA}"
43+
env:
44+
SSH_USER: ${{ secrets.STAGING_USER }}
45+
SSH_HOST: ${{ secrets.STAGING_HOST }}
46+
SSH_KEY: ${{ secrets.STAGING_KEY }}
47+
48+
e2e-tests:
49+
runs-on: ubuntu-latest
50+
timeout-minutes: 10
51+
needs: deploy-staging
52+
steps:
53+
- uses: actions/checkout@v4
54+
55+
- name: Fetch node_modules
56+
uses: actions/cache@v4
57+
id: fetch-node_modules
58+
with:
59+
key: node_modules-${{ runner.os }}-${{ hashFiles('./dashboard/pnpm-lock.yaml') }}
60+
path: ./dashboard/node_modules
61+
62+
- name: Install pnpm
63+
uses: pnpm/action-setup@v4
64+
with:
65+
version: 9.15.2
66+
67+
- uses: actions/setup-node@v4
68+
with:
69+
node-version-file: './dashboard/.nvmrc'
70+
71+
- name: Install Playwright browsers
72+
run: npx playwright install --with-deps
73+
working-directory: ./dashboard
74+
75+
- name: Wait for staging deployment to be ready
76+
run: sleep 180
77+
78+
- name: Run e2e tests against staging
79+
run: pnpm e2e
80+
working-directory: ./dashboard
81+
env:
82+
PLAYWRIGHT_TEST_BASE_URL: https://staging.dashboard.kernelci.org:9000

0 commit comments

Comments
 (0)