-
Notifications
You must be signed in to change notification settings - Fork 37
104 lines (103 loc) · 3.53 KB
/
build-test-e2e.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
name: 'Build/Run End-to-End Tests'
on: push
env:
BUILD_ARTIFACT_NAME: swc-war
BUILD_DIR: target
BUILD_NAME: portal-develop-SNAPSHOT.war
NODE_VERSION: 18.16.0
PW_ALL_BLOBS_DIR: all-blob-reports
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build SWC
uses: ./.github/workflows/build
- name: Upload build to GitHub Actions Artifacts
uses: actions/upload-artifact@v3
with:
name: ${{ env.BUILD_ARTIFACT_NAME }}
path: '${{ env.BUILD_DIR }}/${{ env.BUILD_NAME }}'
retention-days: 1
playwright-tests:
if: ${{ github.ref_name == 'develop' || startsWith(github.ref_name, 'release-') || github.actor == github.repository_owner }}
needs: [build]
runs-on: ${{ github.repository_owner == 'Sage-Bionetworks' && 'ubuntu-22.04-4core-16GBRAM-150GBSSD' || 'macos-latest' }}
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
shard: [1/3, 2/3, 3/3]
env:
CONTAINER_NAME: 'swc-tomcat'
CI: true
steps:
- uses: actions/checkout@v3
- name: Setup docker (missing on MacOS)
if: runner.os == 'macos'
run: |
brew install docker
colima start
- name: Download build from GitHub Actions Artifacts
uses: actions/download-artifact@v3
with:
name: ${{ env.BUILD_ARTIFACT_NAME }}
path: ${{ env.BUILD_DIR }}
- name: Run SWC on Tomcat
run: |
docker run \
--name "${{ env.CONTAINER_NAME }}" \
-d --rm \
-p 8888:8080 \
-v "/$(pwd)/${{ env.BUILD_DIR }}/${{ env.BUILD_NAME }}:/usr/local/tomcat/webapps/ROOT.war" \
-v "/$(pwd)/e2e_workflow/settings.xml":/root/.m2/settings.xml \
tomcat:9.0
- uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Install Playwright Browsers
run: yarn playwright install --with-deps
- name: Run Playwright tests
env:
ADMIN_PAT: ${{ secrets.ADMIN_PAT }}
run: yarn playwright test --shard ${{ matrix.shard }}
- name: Upload blob report to GitHub Actions Artifacts
uses: actions/upload-artifact@v3
if: always()
with:
name: ${{ env.PW_ALL_BLOBS_DIR }}
path: blob-report
retention-days: 1
- name: Stop Tomcat
if: always()
run: docker stop "${{ env.CONTAINER_NAME }}"
- name: Stop Colima
if: runner.os == 'macos'
run: colima stop
merge-reports:
# Merge reports after playwright-tests, even if some shards have failed
if: always()
needs: [playwright-tests]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Download blob reports from GitHub Actions Artifacts
uses: actions/download-artifact@v3
with:
name: ${{ env.PW_ALL_BLOBS_DIR }}
path: ${{ env.PW_ALL_BLOBS_DIR }}
- name: Merge into HTML Report
run: yarn playwright merge-reports --reporter html ./"${{ env.PW_ALL_BLOBS_DIR }}"
- name: Upload HTML report
uses: actions/upload-artifact@v3
with:
name: html-report--attempt-${{ github.run_attempt }}
path: playwright-report
retention-days: 14