Skip to content

chore: bump cross-spawn from 7.0.3 to 7.0.5 in the npm_and_yarn group #10332

chore: bump cross-spawn from 7.0.3 to 7.0.5 in the npm_and_yarn group

chore: bump cross-spawn from 7.0.3 to 7.0.5 in the npm_and_yarn group #10332

Workflow file for this run

# This workflow will build and run the test suite
# on all opened and updated (and labeled) PRs where
# at least one file does not match paths-ignore.
name: Build & test
on:
# Build when a PR is opened, updated, labeled, or flagged as ready
pull_request:
types:
- opened
- synchronize
- labeled
- unlabeled
- ready_for_review
- auto_merge_enabled
# Build when PRs are merged into master/main
push:
branches:
- master
- main
# Manual run, no inputs necessary
workflow_dispatch:
env:
# Bring color into the GitHub terminal
FORCE_COLOR: true
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PLAYWRIGHT_REPORT_DIR: test-report
# https://github.blog/changelog/2020-10-01-github-actions-deprecating-set-env-and-add-path-commands/
ACTIONS_ALLOW_UNSECURE_COMMANDS: "true"
# GITHUB_CONTEXT: ${{ toJson(github) }}
jobs:
# Turn this on to debug an action
# debug:
# name: Debug
# runs-on: ubuntu-latest
# steps:
# - name: Debugging context variables
# run: echo "$GITHUB_CONTEXT"
lint:
name: Lint files
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
# Configures the node version used on GitHub-hosted runners
- name: Configure node version
uses: actions/setup-node@v4
with:
node-version: '20'
cache: npm
- name: Install dependencies
run: npm ci --prefer-offline
- name: Lint
id: lint
run: npm run lint
test:
name: Unit Tests (Web Test Runner)
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
# Configures the node version used on GitHub-hosted runners
- name: Configure node version
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: npm
- name: Install dependencies
run: npm ci --prefer-offline
- name: install playwright
run: npx playwright install
- name: Run tests
run: npm test
- name: JUnit Report Action
uses: mikepenz/[email protected]
with:
report_paths: test-results/test-results.xml
fail_on_failure: true # fail the actions run if the tests failed
ssr:
name: SSR Tests (Playwright)
runs-on: ubuntu-latest
container:
image: mcr.microsoft.com/playwright:v1.46.1-jammy
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: npm
- run: npm ci --prefer-offline
- run: npm run build
- name: Run tests
run: npx playwright test -g ssr --update-snapshots
env:
HOME: /root
- uses: actions/upload-artifact@v4
if: always()
with:
name: ${{ env.PLAYWRIGHT_REPORT_DIR }}
path: ${{ env.PLAYWRIGHT_REPORT_DIR }}/
retention-days: 30
publish_report:
name: Publish Playwright Report
# using always() is not ideal here, because it would also run if the workflow was cancelled
if: "success() || needs.ssr.result == 'failure'"
needs:
- ssr
runs-on: ubuntu-latest
continue-on-error: true
env:
HTML_REPORT_URL_PATH: reports/${{ github.ref_name }}/${{ github.run_id }}/${{ github.run_attempt }}
steps:
- uses: actions/checkout@v4
- name: Download zipped HTML report
uses: actions/download-artifact@v4
with:
name: ${{ env.PLAYWRIGHT_REPORT_DIR }}
path: ${{ env.PLAYWRIGHT_REPORT_DIR }}/
- name: Upload to Github Pages
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: ${{ env.PLAYWRIGHT_REPORT_DIR }}
target-folder: ${{ env.HTML_REPORT_URL_PATH }}
- name: Add comment to PR
uses: marocchino/sticky-pull-request-comment@v2
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
number: ${{ github.event.inputs.issueNumber }}
append: true
header: "${{ github.sha }}"
hide: true
hide_details: true
message: |
**SSR Test Run for ${{ github.sha }}**: [Report](https://patternfly.github.io/patternfly-elements/${{ env.HTML_REPORT_URL_PATH }})
# Validate the build to main was successful; open an issue if not
build:
name: Compile project
runs-on: ubuntu-latest
strategy:
matrix:
node:
- '20'
- '21'
if: |
github.event_name == 'workflow_dispatch'
|| github.event_name == 'push'
|| ( github.event_name == 'pull_request'
&& github.event.action == 'labeled'
&& github.event.label.name == 'ready to merge'
)
|| ( github.event_name == 'pull_request'
&& github.event.action != 'labeled'
&& github.event.pull_request.draft == false
&& !contains(github.event.pull_request.labels.*.name, 'blocked')
&& !contains(github.event.pull_request.labels.*.name, 'skip ci')
&& !contains(github.event.pull_request.labels.*.name, 'work in progress')
&& !contains(github.event.pull_request.labels.*.name, 'on hold')
)
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
# Configures the node version used on GitHub-hosted runners
- name: Configure node version
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
cache: npm
- name: Install dependencies
run: npm ci --prefer-offline
- name: Build
id: build
run: npm run build
- name: Release Dry Run
id: release-dry
run: npm run prepublishOnly -ws --if-present
validate:
name: Validate successful build on main
needs:
- lint
- test
- build
if: ${{ always() }}
runs-on: ubuntu-latest
steps:
- name: Capture pull request number from branch name
if: github.event_name == 'workflow_dispatch'
run: |
echo 'prnumber<<EOF' >> $GITHUB_ENV
curl -s -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/${{github.repository}}/pulls?head=${{github.repository_owner}}:${{github.ref}} | jq -r '.[] | .number' >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV
- name: Add a label if tests have passed (PR)
if: |
github.event_name == 'pull_request'
&& needs.test.outcome != 'failure'
uses: actions-ecosystem/action-add-labels@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
labels: AT passed
- name: Add a label if tests have passed (dispatch)
if: |
github.event_name == 'workflow_dispatch'
&& needs.test.outcome != 'failure'
uses: actions-ecosystem/action-add-labels@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
labels: AT passed
number: ${{ env.prnumber }}
- name: Remove the label if tests failed
if: |
github.event_name == 'pull_request'
&& needs.test.outcome == 'failure'
uses: actions-ecosystem/action-remove-labels@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
labels: AT passed
- name: Open issue if build breaks
if: |
github.event_name == 'push'
&& needs.build.outcome == 'failure'
uses: imjohnbo/issue-bot@v3
with:
labels: "fix, priority: high"
pinned: true
project: 2 # The project-number from organization project
column: Prioritized
close-previous: true
title: "❌ Build is failing on main"
body: "It looks like the build is currently failing on the main branch. See failed [action results](https://github.com/patternfly/patternfly-elements/actions/runs/${{ github.run_id }}) for more details."
- name: Open issue if tests fail
if: |
github.event_name == 'push'
&& needs.test.outcome == 'failure'
uses: imjohnbo/issue-bot@v3
with:
labels: "fix, priority: medium"
pinned: true
project: 2 # The project-number from organization project
column: Prioritized
close-previous: true
title: "🧪 Tests are failing on main"
body: "It looks like the build is currently failing on the main branch. See failed [action results](https://github.com/patternfly/patternfly-elements/actions/runs/${{ github.run_id }}) for more details."
build-windows:
name: Verify that build runs on Windows
runs-on: windows-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
# Configures the node version used on GitHub-hosted runners
- name: Configure node version
uses: actions/setup-node@v3
with:
node-version: 20
cache: npm
- name: Install dependencies
run: npm ci --prefer-offline
- name: Build
id: build
run: npm run build