-
Notifications
You must be signed in to change notification settings - Fork 244
133 lines (114 loc) · 5.1 KB
/
development.yml
File metadata and controls
133 lines (114 loc) · 5.1 KB
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
name: PR verification
# -------------------------------------------------------------
# This workflow will build and verify pull requests. It will:
# - Build the branch and fail if the build fails
# - Run code coverage tests on the PR branch
# - Lint the PR branch
# -------------------------------------------------------------
on:
pull_request:
types:
- opened
- synchronize
- reopened
- labeled
- unlabeled
- auto_merge_enabled
permissions:
contents: read
pull-requests: write
concurrency:
group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label }}'
cancel-in-progress: true
defaults:
run:
shell: bash
jobs:
# -------------------------------------------------------------
# Validate build for various environments
# -------------------------------------------------------------
verify_builds:
name: Verify build
# Check that the PR is not in draft mode (or if it is, that it has the run_ci label to force a build)
if: ${{ github.event.pull_request.draft != 'true' || contains(github.event.pull_request.labels.*.name, 'run_ci') }}
uses: ./.github/workflows/build.yml
secrets: inherit
test:
name: Tests and coverage
# Check that the PR is not in draft mode (or if it is, that it has the run_ci label to force a build)
if: ${{ github.event.pull_request.draft != 'true' || contains(github.event.pull_request.labels.*.name, 'run_ci') }}
uses: ./.github/workflows/tests.yml
secrets: inherit
# -------------------------------------------------------------
# Lint pre-compiled assets for consistency
# -------------------------------------------------------------
lint:
name: Lint
if: ${{ contains(github.event.pull_request.labels.*.name, 'skip_lint') == false }}
uses: ./.github/workflows/lint.yml
secrets: inherit
# -------------------------------------------------------------
# Browser performance tests
# -------------------------------------------------------------
performance:
name: Performance
if: ${{ github.event.pull_request.draft != 'true' || contains(github.event.pull_request.labels.*.name, 'run_ci') }}
uses: ./.github/workflows/browser-tests.yml
secrets: inherit
comment-previews:
name: Create preview URLs and comment
# The job will only run if the pull request is from the same repository.
# Benchmarks can't run on PRs from forked repos due to comment posting restrictions without a GitHub token.
if: github.event.pull_request.head.repo.full_name == github.repository
runs-on: ubuntu-latest
outputs:
doc_url: ${{ steps.extract_doc_url.outputs.DOC_URL }}
steps:
- name: Checkout main
uses: actions/checkout@v4
with:
ref: main
- name: Checkout PR branch
uses: actions/checkout@v4
- name: Setup Job and Install Dependencies
uses: ./.github/actions/setup-job
with:
skip-build: true
- name: Extract branch name
run: echo "BRANCH=$(npx slugify-cli ${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}})" >> $GITHUB_OUTPUT
id: extract_branch
- name: Extract doc preview url
run: echo "DOC_URL=https://${{ steps.extract_branch.outputs.BRANCH }}--spectrum-wc.netlify.app/" >> $GITHUB_OUTPUT
id: extract_doc_url
- name: Post Previews Comment
uses: actions/github-script@v7
with:
script: |
const { buildPreviewURLComment } = await import('${{ github.workspace }}/tasks/build-preview-urls-comment.js');
const body = buildPreviewURLComment(process.env.GITHUB_HEAD_REF);
const { getDocPreviewURL } = await import('${{ github.workspace }}/tasks/build-preview-urls-comment.js');
const { commentOrUpdate } = await import('${{ github.workspace }}/tasks/comment-or-update.js');
commentOrUpdate(github, context, '## Branch preview', body);
smoke-tests:
name: Smoke tests
runs-on: macos-latest
needs: comment-previews
steps:
- name: Checkout PR branch
uses: actions/checkout@v4
- name: Setup Job and Install Dependencies
uses: ./.github/actions/setup-job
with:
skip-build: true
with-playwright: true
- name: Run Playwright tests
run: yarn playwright test projects/documentation/e2e/published.spec.ts --reporter html
env:
DOC_PREVIEW_URL: ${{ needs.comment-previews.outputs.doc_url }}
NODE_ENV: CI
- name: Upload Playwright Report
uses: actions/upload-artifact@v4
if: always()
with:
name: docs-report
path: playwright-report/