Repository navigation
132 lines (121 loc) · 4.17 KB
/
Copy pathci.yml
File metadata and controls
132 lines (121 loc) · 4.17 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
name: ci
# Runs on every pull request, and is called by deploy.yml so nothing reaches Pages
# without passing the same checks. On a pull request the site is built from the
# data committed in src/data; deploy asks for a fresh sync first.
on:
pull_request:
workflow_call:
inputs:
sync:
description: Refresh src/data from GitHub and dev.to before building.
type: boolean
default: false
pages:
description: Also upload the build as the Pages artifact.
type: boolean
default: false
permissions:
contents: read
concurrency:
group: ci-${{ github.event.pull_request.number || github.run_id }}
cancel-in-progress: true
env:
ASTRO_TELEMETRY_DISABLED: 1
jobs:
lint:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: ./.github/actions/setup
- run: pnpm exec biome ci --reporter=github .
workflows:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- run: docker run --rm -v "$PWD:/repo" -w /repo rhysd/actionlint:1.7.12@sha256:b1934ee5f1c509618f2508e6eb47ee0d3520686341fec936f3b79331f9315667 -color
typecheck:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: ./.github/actions/setup
- run: pnpm exec astro check
test:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: ./.github/actions/setup
- run: pnpm exec vitest run
build:
runs-on: ubuntu-latest
timeout-minutes: 15
outputs:
playwright: ${{ steps.versions.outputs.playwright }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: ./.github/actions/setup
# The e2e job runs in the Playwright image matching the installed test runner.
- id: versions
run: echo "playwright=$(node -p 'require("@playwright/test/package.json").version')" >> "$GITHUB_OUTPUT"
- if: inputs.sync
run: pnpm run sync
env:
GITHUB_TOKEN: ${{ github.token }}
# The unit tests read src/data, so after a sync they run again on what will ship.
- if: inputs.sync
run: pnpm exec vitest run
- run: pnpm run build
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: site
path: |
dist
src/data
retention-days: 3
- if: inputs.pages
uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5.0.0
with:
path: dist
e2e:
needs: build
runs-on: ubuntu-latest
timeout-minutes: 20
# Browsers and their system libraries come baked into the image, so nothing is
# fetched from apt at test time. The tag follows the installed @playwright/test,
# so a Dependabot bump moves both together.
container:
image: mcr.microsoft.com/playwright:v${{ needs.build.outputs.playwright }}-noble
options: --user 1001
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: ./.github/actions/setup
# Test the exact files that were built, along with the data they were built from.
- uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
name: site
- run: pnpm exec playwright test
env:
CI: true
- if: failure()
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: playwright-report
path: |
playwright-report
test-results
retention-days: 7