-
Notifications
You must be signed in to change notification settings - Fork 672
83 lines (73 loc) · 2.9 KB
/
Copy pathci-website-unit.yaml
File metadata and controls
83 lines (73 loc) · 2.9 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
# Description: Unit tests + coverage reporting for the website (apps/website)
name: 'CI: Website Unit'
on:
push:
branches: [main, master, website/*]
pull_request:
branches-ignore: [wip/*, draft/*, temp/*]
merge_group:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
changes:
runs-on: ubuntu-latest
outputs:
app-website-changes: ${{ steps.changes.outputs.app-website-changes }}
packages-changes: ${{ steps.changes.outputs.packages-changes }}
steps:
- uses: actions/checkout@v7
- id: changes
uses: ./.github/actions/changes-filter
website-unit:
needs: changes
if: ${{ needs.changes.outputs.app-website-changes == 'true' || needs.changes.outputs.packages-changes == 'true' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- name: Setup frontend
uses: ./.github/actions/setup-frontend
- name: Run website unit tests with coverage
run: pnpm --filter @comfyorg/website test:coverage
- name: Upload website coverage to Codecov
if: ${{ !cancelled() }}
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0
with:
working-directory: ./apps/website
files: ./coverage/lcov.info
disable_search: true
flags: website-unit
# Re-root LCOV paths to prevent collisions with root-app coverage.
network_prefix: apps/website/
token: ${{ secrets.CODECOV_TOKEN }}
# Forks have no token, so upload failures cannot block contributors.
fail_ci_if_error: ${{ github.event.pull_request.head.repo.fork != true }}
# Stable branch-protection context when tests are skipped.
website-unit-gate:
needs: [changes, website-unit]
if: ${{ always() }}
runs-on: ubuntu-latest
steps:
- name: Verify website unit tests passed or were not required
env:
CHANGES_RESULT: ${{ needs.changes.result }}
UNIT_RESULT: ${{ needs.website-unit.result }}
WEBSITE_CHANGED: ${{ needs.changes.outputs.app-website-changes }}
PACKAGES_CHANGED: ${{ needs.changes.outputs.packages-changes }}
run: |
if [ "$UNIT_RESULT" = "success" ]; then
echo "Website unit tests passed."
exit 0
fi
# Pass skipped tests only after successful filtering found no relevant changes.
if [ "$UNIT_RESULT" = "skipped" ] &&
[ "$CHANGES_RESULT" = "success" ] &&
[ "$WEBSITE_CHANGED" != "true" ] &&
[ "$PACKAGES_CHANGED" != "true" ]; then
echo "No website or package changes; website unit tests not required."
exit 0
fi
echo "::error title=Website unit tests::changes=$CHANGES_RESULT unit=$UNIT_RESULT website=$WEBSITE_CHANGED packages=$PACKAGES_CHANGED"
exit 1