Repository navigation
97 lines (94 loc) · 3.74 KB
/
Copy pathci.yml
File metadata and controls
97 lines (94 loc) · 3.74 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
name: CI
on:
push:
branches: [main]
pull_request:
schedule:
# Weekly upstream-drift check: install latest pi, smoke-run pify against it.
- cron: "0 6 * * 1"
jobs:
test:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
node: [22, 24]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
cache: npm
- run: npm ci
- run: npm run typecheck
- run: npm run build
- run: npm test
- name: Smoke test CLI
run: |
node dist/cli.js --version
node dist/cli.js list
node dist/cli.js install --dry-run goal || true
node dist/cli.js doctor || true
- name: Install-test the packed tarball
shell: bash
run: |
npm pack
npm install -g ./pify-cli-*.tgz
pify --version
pify list
pify completions bash > /dev/null
pify completions powershell > /dev/null
upstream-drift:
if: github.event_name == 'schedule'
runs-on: ubuntu-latest
permissions:
contents: read
issues: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
- run: npm ci
- run: npm run build
- name: Install latest pi and smoke pify against it
id: smoke
continue-on-error: true
run: |
node dist/cli.js setup
node dist/cli.js doctor
node dist/cli.js update --dry-run
- name: Compare the tested pi against the latest, open an issue on drift or a failed smoke
env:
GH_TOKEN: ${{ github.token }}
run: |
set -euo pipefail
TESTED=$(grep -oE 'TESTED_PI_VERSION = "[^"]+"' src/pi.ts | grep -oE '[0-9][^"]*')
LATEST=$(npm view @earendil-works/pi-coding-agent version)
SMOKE='${{ steps.smoke.outcome }}'
echo "tested=$TESTED latest=$LATEST smoke=$SMOKE"
DRIFT=0
[ "$TESTED" != "$LATEST" ] && DRIFT=1
if [ "$DRIFT" = "0" ] && [ "$SMOKE" = "success" ]; then
echo "No drift and the smoke passed — nothing to report."
exit 0
fi
RUN_URL="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
if [ "$DRIFT" = "1" ]; then
NOTE="A newer pi is published than the one this CLI pins. Run _review/verify-pi.sh against $LATEST, then bump TESTED_PI_VERSION once the suite is green and tag the release."
else
NOTE="The pinned pi ($TESTED) smoke-failed (setup / doctor / update --dry-run). Investigate before the next release."
fi
TITLE="pi upstream drift: tested $TESTED, latest $LATEST"
BODY=$(printf 'Weekly upstream-drift check.\n\n- tested (TESTED_PI_VERSION): `%s`\n- latest on npm (@earendil-works/pi-coding-agent): `%s`\n- smoke (setup / doctor / update --dry-run): **%s**\n\n%s\n\nWorkflow run: %s' "$TESTED" "$LATEST" "$SMOKE" "$NOTE" "$RUN_URL")
# Idempotent: update the one open drift issue in place rather than opening a new one each week (caveman's drift-report pattern).
EXISTING=$(gh issue list --state open --search 'pi upstream drift in:title' --json number --jq '.[0].number // empty')
if [ -n "$EXISTING" ]; then
gh issue edit "$EXISTING" --title "$TITLE" --body "$BODY"
echo "updated #$EXISTING"
else
gh issue create --title "$TITLE" --body "$BODY" --label upstream-drift 2>/dev/null \
|| gh issue create --title "$TITLE" --body "$BODY"
echo "opened a new drift issue"
fi