-
Notifications
You must be signed in to change notification settings - Fork 92
164 lines (145 loc) · 5.98 KB
/
test-e2e-linux.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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
name: "Test: E2E (Linux)"
on:
workflow_call:
inputs:
grep:
required: false
description: "Only run tests matching this regex. Supports tags (comma-separated), titles, filenames. Confirm pattern matching locally with: npx playwright test --grep=<regex>"
default: "@critical"
type: string
project:
required: false
description: "The name of the Playwright project to run tests for."
default: "e2e-electron"
type: string
repeat_each:
required: false
description: "Run each test N times, defaults to one."
default: 1
type: number
display_name:
required: false
description: "The name of the job as it will appear in the GitHub Actions UI."
default: "e2e-linux"
type: string
currents_tags:
required: false
description: "The tags to use for Currents recording."
default: "@linux"
type: string
report_testrail:
required: false
description: "Whether or not to report results to TestRail."
default: false
type: boolean
workflow_dispatch:
inputs:
project:
required: false
description: "The name of the Playwright project to run tests for."
default: "e2e-electron"
type: choice
options:
- e2e-electron
- e2e-browser
grep:
required: false
description: "Run tests matching a regular expression. Supports tags, test titles, and filenames. Leave blank to run all tests. For project `e2e-browser`, tests tagged with @web are pre-filtered; additional tags, titles, or filenames can be specified to refine filtering."
default: "@critical"
type: string
repeat_each:
required: false
description: "Run each test N times, defaults to one."
default: 1
type: number
permissions:
id-token: write
contents: read
jobs:
e2e-linux:
name: ${{ inputs.display_name || 'e2e-linux' }}
timeout-minutes: 45
runs-on: ubuntu-latest-8x
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
POSITRON_BUILD_NUMBER: 0 # CI skips building releases
_R_CHECK_FUTURE_FILE_TIMESTAMPS_: false # this check can be flaky in the R pkg tests
_R_CHECK_CRAN_INCOMING_: false
_R_CHECK_SYSTEM_CLOCK_: false
AWS_S3_BUCKET: positron-test-reports
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
- name: Transform to Playwright tags $PW_TAGS
run: bash scripts/pr-tags-transform.sh ${{ inputs.project}} "${{ inputs.grep }}"
shell: bash
- name: Cache node_modules, build, extensions, and remote
uses: ./.github/actions/cache-multi-paths
- name: Attempt 1 - Setup Build and Compile
id: attempt1
uses: ./.github/actions/setup-build-env
continue-on-error: true
- name: Attempt 2 - Setup Build and Compile
if: ${{ steps.attempt1.outcome == 'failure' }}
id: attempt2
uses: ./.github/actions/setup-build-env
continue-on-error: true
- name: Attempt 3 - Setup Build and Compile
if: ${{ steps.attempt2.outcome == 'failure' }}
uses: ./.github/actions/setup-build-env
- name: Fail if Retries Exhausted
if: ${{ steps.attempt3.outcome == 'failure' }}
run: exit 1
- name: Install Positron License
uses: ./.github/actions/install-license
with:
github-token: ${{ secrets.POSITRON_GITHUB_PAT }}
license-key: ${{ secrets.POSITRON_DEV_LICENSE }}
- name: Setup E2E Test Environment
uses: ./.github/actions/setup-test-env
with:
aws-role-to-assume: ${{ secrets.QA_AWS_RO_ROLE }}
aws-region: ${{ secrets.QA_AWS_REGION }}
github-token: ${{ secrets.GITHUB_TOKEN }}
# Preloading ensures the Node.js binary is fully built and ready before
# any parallel processes start, preventing runtime conflicts
- name: Preload Node.js Binary
if: ${{ inputs.project == 'e2e-browser' }}
run: npm run gulp node
- name: Send Results to GH Summary
uses: ./.github/actions/gen-report-dir
if: ${{ !cancelled() }}
- name: Run Playwright Tests (Electron)
env:
POSITRON_PY_VER_SEL: 3.10.12
POSITRON_R_VER_SEL: 4.4.0
CURRENTS_RECORD_KEY: ${{ secrets.CURRENTS_RECORD_KEY }}
CURRENTS_CI_BUILD_ID: ${{ github.run_id }}-${{ github.run_attempt }}
COMMIT_INFO_MESSAGE: ${{ github.event.head_commit.message }}
PWTEST_BLOB_DO_NOT_REMOVE: 1
CURRENTS_TAG: ${{ inputs.currents_tags || 'electron/linux' }}
run: |
DISPLAY=:10 npx playwright test --project ${{ inputs.project }} --workers 2 --grep "${{ env.PW_TAGS }}" --repeat-each ${{ inputs.repeat_each }}
- name: Upload Playwright Report to S3
if: ${{ success() || failure() }}
uses: ./.github/actions/upload-report-to-s3
with:
role-to-assume: ${{ secrets.AWS_TEST_REPORTS_ROLE }}
report-dir: ${{ env.REPORT_DIR }}
- name: Install trcli
if: ${{ inputs.report_testrail }}
shell: bash
run: sudo apt-get update && sudo apt-get install -y python3-pip && pip3 install trcli
- name: Upload Test Results to TestRail
if: ${{ inputs.report_testrail }}
shell: bash
run: |
TESTRAIL_TITLE="$(date +'%Y-%m-%d') ${{ env.TESTRAIL_TITLE }} - $GITHUB_REF_NAME"
echo "TESTRAIL_TITLE=$TESTRAIL_TITLE" >> $GITHUB_ENV
trcli --host "https://posit.testrail.io/" --project "${{ env.TESTRAIL_PROJECT }}" --username testrailautomation@posit.co --key "${{ env.TESTRAIL_API_KEY }}" parse_junit --file "./test-results/junit.xml" --case-matcher name --title "$TESTRAIL_TITLE" --close-run
env:
TESTRAIL_TITLE: ${{ inputs.project }}
TESTRAIL_PROJECT: "Positron"
TESTRAIL_API_KEY: ${{ secrets.TESTRAIL_API_KEY }}