Repository navigation
127 lines (102 loc) · 3.89 KB
/
Copy pathbenchmark.yml
File metadata and controls
127 lines (102 loc) · 3.89 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
name: Automated Benchmark
on:
# Triggered by core or interface after publishing
repository_dispatch:
types: [package-published]
# Weekly scheduled run (Sundays at 00:00 UTC)
schedule:
- cron: '0 0 * * 0'
# Manual trigger
workflow_dispatch:
inputs:
force_update:
description: 'Force update all packages to latest'
type: boolean
default: true
permissions:
contents: write
jobs:
benchmark:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
cache: 'npm'
cache-dependency-path: package-lock.json
- name: Log trigger information
run: |
echo "Trigger: ${{ github.event_name }}"
if [ "${{ github.event_name }}" == "repository_dispatch" ]; then
echo "Source: ${{ github.event.client_payload.source }}"
echo "Version: ${{ github.event.client_payload.version }}"
fi
- name: Update to latest npm packages
run: |
echo "Fetching latest versions from npm..."
# Get latest versions
CORE_VERSION=$(npm view @forcecalendar/core version)
INTERFACE_VERSION=$(npm view @forcecalendar/interface version 2>/dev/null || echo "not-published")
FULLCALENDAR_VERSION=$(npm view @fullcalendar/core version)
echo "Latest versions:"
echo " @forcecalendar/core: $CORE_VERSION"
echo " @forcecalendar/interface: $INTERFACE_VERSION"
echo " @fullcalendar/core: $FULLCALENDAR_VERSION"
# Update package.json with latest versions
npm pkg set dependencies.@forcecalendar/core="^$CORE_VERSION"
npm pkg set dependencies.@fullcalendar/core="^$FULLCALENDAR_VERSION"
# Clean install with latest
rm -rf node_modules package-lock.json
npm install
# Verify installed versions
echo ""
echo "Installed versions:"
npm ls @forcecalendar/core @fullcalendar/core --depth=0
- name: Run benchmarks
run: npm run benchmark
env:
NODE_OPTIONS: '--max-old-space-size=4096'
- name: Add trigger metadata to results
run: |
node -e "
const fs = require('fs');
const results = JSON.parse(fs.readFileSync('results/latest.json', 'utf8'));
// Add trigger info
results.trigger = {
event: '${{ github.event_name }}',
source: '${{ github.event.client_payload.source || 'manual/scheduled' }}',
runId: '${{ github.run_id }}',
runUrl: 'https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}'
};
fs.writeFileSync('results/latest.json', JSON.stringify(results, null, 2));
console.log('Added trigger metadata to results');
"
- name: Update dashboard data
run: npm run update-dashboard
- name: Configure Git
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
- name: Commit and push results
run: |
git add results/latest.json www/data/
# Check if there are changes to commit
if git diff --staged --quiet; then
echo "No changes to commit"
else
CORE_VER=$(node -e "console.log(require('./node_modules/@forcecalendar/core/package.json').version)")
FC_VER=$(node -e "console.log(require('./node_modules/@fullcalendar/core/package.json').version)")
git commit -m "Benchmark results: core@$CORE_VER vs fullcalendar@$FC_VER
Triggered by: ${{ github.event_name }}
Run: ${{ github.run_id }}"
git push origin HEAD
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Vercel will auto-deploy when changes are pushed