-
-
Notifications
You must be signed in to change notification settings - Fork 565
106 lines (95 loc) · 3.65 KB
/
ci.yaml
File metadata and controls
106 lines (95 loc) · 3.65 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
name: CI
on:
push:
pull_request:
jobs:
lint-check:
runs-on: ubuntu-24.04-arm
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: ./.github/actions/setup-nix
- run: nix develop --command pnpm lint
- run: nix develop --command pnpm typecheck
test:
runs-on: ubuntu-24.04-arm
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: ./.github/actions/setup-nix
- name: Create default Claude directories for tests
run: |
mkdir -p "$HOME/.claude/projects"
mkdir -p "$HOME/.config/claude/projects"
- run: nix develop --command pnpm run test
npm-publish-dry-run-and-upload-pkg-pr-now:
runs-on: ubuntu-24.04-arm
outputs:
urls: ${{ steps.publish.outputs.urls }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: ./.github/actions/setup-nix
- id: publish
run: nix develop --command pnpm pkg-pr-new publish --pnpm --bin './apps/*'
ccusage-preview-e2e:
if: github.event_name == 'pull_request'
needs: npm-publish-dry-run-and-upload-pkg-pr-now
runs-on: ${{ matrix.os }}
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
os:
- ubuntu-slim
- macos-latest
- windows-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: lts/*
- name: Prepare preview package E2E
env:
PKG_PR_NEW_URLS: ${{ needs.npm-publish-dry-run-and-upload-pkg-pr-now.outputs.urls }}
run: node .github/scripts/e2e-setup.mjs
- name: Run preview package E2E with Node
env:
CCUSAGE_BUN_AUTO_RUN: 0
shell: pwsh
run: |
npx --yes "$env:CCUSAGE_PREVIEW_URL" --version
npx --yes "$env:CCUSAGE_PREVIEW_URL" daily --offline --json | jq -e .
npx --yes "$env:CCUSAGE_PREVIEW_URL" daily --offline
- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0
- name: Run preview package E2E with Bun
shell: pwsh
run: |
npx --yes "$env:CCUSAGE_PREVIEW_URL" --version
npx --yes "$env:CCUSAGE_PREVIEW_URL" daily --offline --json | jq -e .
npx --yes "$env:CCUSAGE_PREVIEW_URL" daily --offline
spell-check:
runs-on: ubuntu-24.04-arm
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: ./.github/actions/setup-nix
- run: nix develop --command typos --config ./typos.toml
schema-check:
runs-on: ubuntu-24.04-arm
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: ./.github/actions/setup-nix
- name: Generate schema files
run: nix develop --command pnpm run generate:schema
working-directory: apps/ccusage
- name: Check if schema files are up-to-date
run: |
if git diff --exit-code apps/ccusage/config-schema.json docs/public/config-schema.json; then
echo "✅ Schema files are up-to-date"
else
echo "❌ Schema files are not up-to-date. Please run 'pnpm run generate:schema' and commit the changes."
echo ""
echo "Changed files:"
git diff --name-only apps/ccusage/config-schema.json docs/public/config-schema.json
echo ""
echo "Diff:"
git diff apps/ccusage/config-schema.json docs/public/config-schema.json
exit 1
fi