Skip to content

Commit

Permalink
test windows
Browse files Browse the repository at this point in the history
  • Loading branch information
midleman committed Dec 10, 2024
1 parent 711ed07 commit a7d0727
Show file tree
Hide file tree
Showing 3 changed files with 121 additions and 84 deletions.
192 changes: 117 additions & 75 deletions .github/workflows/positron-full-test.yml
Original file line number Diff line number Diff line change
@@ -1,122 +1,164 @@
name: "Test: Full Suite"

on:
workflow_dispatch:
workflow_call:
inputs:
grep:
required: false
description: "Grep filter to apply to the e2e tests: @critical, @console, etc. Leave blank to run all tests."
description: "Only run tests matching this regex. Supports tags (comma-separated), titles, filenames, etc. For windows, use this format: (?=.*@win)(?=.*@feature)"
default: "@win"
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-windows"
type: string
currents_tags:
required: false
description: "The tags to use for Currents recording."
default: ""
type: string
notify_on:
description: "Slack notification on:"

workflow_dispatch:
inputs:
grep:
required: false
description: "Tests tagged with @win are always run. Specify other tags, test titles, filenames, etc. to filter tests further."
default: "@win"
type: string
repeat_each:
required: false
default: "failure"
type: choice
options:
- failure
- always
description: "Run each test N times, defaults to one."
default: 1
type: number

permissions:
id-token: write
contents: read

jobs:
e2e-electron:
runs-on: ubuntu-latest-8x
timeout-minutes: 45
e2e-windows:
name: ${{ inputs.display_name }}
runs-on:
labels: [windows-latest-8x]
timeout-minutes: 80
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
POSITRON_BUILD_NUMBER: 0 # CI skips building releases
AWS_S3_BUCKET: positron-test-reports

steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
- name: Set screen resolution
shell: pwsh
run: |
Set-DisplayResolution -Width 1920 -Height 1080 -Force
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version-file: .nvmrc

- name: Install Build Dependencies
shell: bash
run: |
sudo apt-get update
sudo apt-get install -y \
vim curl build-essential clang make cmake git \
libsodium-dev libxkbfile-dev pkg-config libsecret-1-dev libxss1 dbus xvfb \
libgtk-3-0 libgbm1 libnss3 libnspr4 libasound2 libkrb5-dev libcairo-dev \
libsdl-pango-dev libjpeg-dev libgif-dev pandoc
- name: Compile tests
- name: Install System Level Python
uses: actions/setup-python@v5
with:
python-version: "3.10.10"

- name: Cache node_modules, build, extensions, and remote
uses: ./.github/actions/cache-multi-paths

- name: Install node dependencies with yarn
env:
npm_config_arch: x64
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
ELECTRON_SKIP_BINARY_DOWNLOAD: 1
POSITRON_GITHUB_PAT: ${{ github.token }}
shell: pwsh
# nvm on windows does not see .nvmrc
#
# the installation of the npm package windows-process-tree is known to fail
# intermittently in the Github Actions build environment, so we retry
# this step a few times if necessary.
#
# see https://github.com/posit-dev/positron/issues/3481
run: |
corepack enable
yarn global add node-gyp
yarn install
yarn --cwd test/automation install
yarn --cwd test/e2e install
.\scripts\run-with-retry.ps1 -maxAttempts 3 -command "yarn --network-timeout 120000"
yarn --cwd test/automation install --frozen-lockfile
yarn --cwd test/e2e install --frozen-lockfile
- name: Compile and Download
run: yarn npm-run-all --max-old-space-size=4095 -lp compile "electron x64" playwright-install download-builtin-extensions

- name: Compile E2E Tests
run: |
yarn --cwd test/automation compile
yarn --cwd test/e2e compile
- name: Get & install latest release
id: get_latest_release
- name: Install python dependencies
run: |
response=$(curl -s -H "Authorization: token ${{ secrets.POSITRON_GITHUB_PAT }}" "https://api.github.com/repos/posit-dev/positron-builds/releases")
latest_tag=$(echo "${response}" | jq -r '.[0].tag_name')
asset_url=$(echo "${response}" | jq -r '.[0].assets[] | select(.name|match("deb")) | .url')
filename=$(echo "${response}" | jq -r '.[0].assets[] | select(.name|match("deb")) | .name')
echo "Latest release: ${latest_tag}"
echo "Downloading ${filename} from ${asset_url}..."
curl -L -H "Accept: application/octet-stream" -H "Authorization: token ${{ secrets.POSITRON_GITHUB_PAT }}" "${asset_url}" -o "${filename}"
sudo dpkg -i "${filename}"
- name: Setup E2E Test Environment
uses: ./.github/actions/setup-test-env
curl https://raw.githubusercontent.com/posit-dev/qa-example-content/main/requirements.txt --output requirements.txt
python -m pip install --upgrade pip
python -m pip install -r requirements.txt
python -m pip install ipykernel trcli
- name: Set up R
uses: r-lib/actions/setup-r@v2
with:
aws-role-to-assume: ${{ secrets.QA_AWS_RO_ROLE }}
aws-region: ${{ secrets.QA_AWS_REGION }}
github-token: ${{ secrets.GITHUB_TOKEN }}
r-version: "4.4.0"

- name: Configure xvfb Service
shell: bash
- name: Install R packages
run: |
sudo cp build/azure-pipelines/linux/xvfb.init /etc/init.d/xvfb
sudo chmod +x /etc/init.d/xvfb
sudo update-rc.d xvfb defaults
sudo service xvfb start
curl https://raw.githubusercontent.com/posit-dev/qa-example-content/main/DESCRIPTION --output DESCRIPTION
Rscript -e "install.packages('pak')"
Rscript -e "pak::local_install_dev_deps(ask = FALSE)"
- name: Send Results to GH Summary
uses: ./.github/actions/gen-report-dir
if: ${{ !cancelled() }}
- name: Setup Graphviz
uses: ts-graphviz/[email protected]

- name: Set up Quarto
uses: quarto-dev/quarto-actions/setup@v2
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tinytex: true

- name: Setup AWS S3 Access
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.QA_AWS_RO_ROLE }}
aws-region: ${{ secrets.QA_AWS_REGION }}

- name: Get and set Playwright tags to $PW_TAGS
run: bash scripts/playwright-tags.sh "e2e-electron" "${{ inputs.grep }}"
run: bash scripts/playwright-tags.sh "e2e-windows" "${{ inputs.grep }}"
shell: bash

- name: Run Tests (Electron)
- name: Send Results to GH Summary
uses: ./.github/actions/gen-report-dir
if: ${{ !cancelled() }}

- name: Run Tests on Windows (Electron)
env:
POSITRON_PY_VER_SEL: 3.10.12
POSITRON_PY_VER_SEL: 3.10.10
POSITRON_R_VER_SEL: 4.4.0
CURRENTS_PROJECT_ID: ZOs5z2
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 }}
COMMIT_INFO_MESSAGE: ${{ github.event.head_commit.message }} # only works on push events
PWTEST_BLOB_DO_NOT_REMOVE: 1
CURRENTS_TAG: "release,${{ inputs.grep }}"
id: electron-e2e-tests
run: |
export DISPLAY=:10
BUILD=/usr/share/positron npx playwright test --project e2e-electron --workers 2 --grep=${{ env.grep }}
CURRENTS_TAG: ${{ inputs.currents_tags }}
if: ${{ !cancelled() }}
run: npx playwright test --project "e2e-windows" --grep "${{ env.PW_TAGS }}" --workers 2 --repeat-each ${{ inputs.repeat_each }}

- name: Upload Playwright Report to S3
if: ${{ !cancelled() }}
if: ${{ success() || failure() }}
uses: ./.github/actions/upload-report-to-s3
with:
role-to-assume: ${{ secrets.AWS_TEST_REPORTS_ROLE }}
report-dir: ${{ env.REPORT_DIR }}

slack-notify:
needs: [e2e-electron]
runs-on: ubuntu-latest
if: always()
steps:
- name: Notify Slack
uses: midleman/slack-workflow-status@master
with:
repo_token: ${{ secrets.POSITRON_GITHUB_PAT }}
slack_webhook_url: ${{ secrets.SLACK_MARIE_WEBHOOK_URL }}
notify_on: ${{ inputs.notify_on }}
4 changes: 2 additions & 2 deletions .github/workflows/test-e2e-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
inputs:
grep:
required: false
description: "Only run tests matching this regex. Supports tags (comma-separated), titles, filenames. Test locally with: npx playwright test --grep=<regex>"
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:
Expand Down Expand Up @@ -41,7 +41,7 @@ on:
- 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 always run; additional tags, titles, or filenames can be specified to refine filtering."
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 always run; additional tags, titles, or filenames can be specified to refine filtering."
default: "@critical"
type: string
repeat_each:
Expand Down
9 changes: 2 additions & 7 deletions .github/workflows/test-e2e-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,14 @@ on:
inputs:
grep:
required: false
description: "Tests tagged with @win are always run. Can specify other tags, test titles, filenames, etc. to filter tests further."
default: ""
description: "Tests tagged with @win are always run. Specify other tags, test titles, filenames, etc. to filter tests further."
default: "@win"
type: string
repeat_each:
required: false
description: "Run each test N times, defaults to one."
default: 1
type: number
currents_tags:
required: false
description: "The tags to use for Currents recording."
default: "@windows/linux"
type: string

permissions:
id-token: write
Expand Down

0 comments on commit a7d0727

Please sign in to comment.