CI_Schedule workflow (antvis/F2)
The CI_Schedule workflow from antvis/F2, explained and optimized by Latchkey.
CI health: C - fair
Run this on Latchkey for self-healing, caching, and up to 58% lower cost.
Grade your own workflow free or run it on Latchkey →What it does
This is the CI_Schedule workflow from the antvis/F2 repository, a real project running GitHub Actions. It is shown here with attribution under its MIT license.
Below, Latchkey shows a faster, safer version produced by its optimization engine.
The workflow
# 定时巡检
name: CI_Schedule
on:
schedule:
# 北京时间 09:00
- cron: '0 1 * * *'
jobs:
ci:
runs-on: macos-14
steps:
- uses: actions/checkout@v2
- name: Use Node.js
uses: actions/setup-node@v2
with:
node-version: 20
- name: install
run: |
yarn install
- name: lint
run: |
npm run lint
env:
CI: true
- name: build
run: |
npm run build
env:
CI: true
- name: test
run: |
npm run test
env:
CI: true
# 发布失败通知内部开发群
- name: CI failure notify
if: ${{ failure() }}
uses: zcong1993/actions-ding@master
with:
dingToken: ${{ secrets.DING_TALK_ACCESS_TOKEN }}
ignoreError: true
body: |
{
"msgtype": "link",
"link": {
"title": "😳 F2 CI 巡检失败",
"text": "🔗 请点击链接查看具体原因",
"messageUrl": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}",
"picUrl": "https://gw.alipayobjects.com/zos/finxbff/compress-tinypng/ea88c724-38fb-42aa-8055-0e08155368b9.png"
}
}
# 保存巡检失败的 diff 图片
- name: save diff snapshot
uses: actions/upload-artifact@v4
if: ${{ failure() }}
with:
name: diff snapshot
path: |
packages/**/__image_snapshots__/__diff_output__/*.png
!**/node_modules/**
The same workflow, on Latchkey
Estimated ~20% faster on cache hits, plus fewer wasted runs and a safer supply chain. Added and changed lines are highlighted.
# 定时巡检 name: CI_Schedule on: schedule: # 北京时间 09:00 - cron: '0 1 * * *' jobs: ci: timeout-minutes: 30 runs-on: macos-14 steps: - uses: actions/checkout@v2 - name: Use Node.js uses: actions/setup-node@v2 with: cache: 'npm' node-version: 20 - name: install run: | yarn install - name: lint run: | npm run lint env: CI: true - name: build run: | npm run build env: CI: true - name: test run: | npm run test env: CI: true # 发布失败通知内部开发群 - name: CI failure notify if: ${{ failure() }} uses: zcong1993/actions-ding@master with: dingToken: ${{ secrets.DING_TALK_ACCESS_TOKEN }} ignoreError: true body: | { "msgtype": "link", "link": { "title": "😳 F2 CI 巡检失败", "text": "🔗 请点击链接查看具体原因", "messageUrl": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}", "picUrl": "https://gw.alipayobjects.com/zos/finxbff/compress-tinypng/ea88c724-38fb-42aa-8055-0e08155368b9.png" } } # 保存巡检失败的 diff 图片 - name: save diff snapshot uses: actions/upload-artifact@v4 if: ${{ failure() }} with: name: diff snapshot path: | packages/**/__image_snapshots__/__diff_output__/*.png !**/node_modules/**
What changed
- Cache dependency installs on the setup step so they are served from cache.
- Add a job timeout so a hung step cannot burn hours of runner time.
1 third-party action is referenced by a movable tag. Pin it to the commit SHA (Latchkey resolves and applies this automatically) so a repointed tag cannot change what runs.
What Latchkey heals here
This workflow has steps that commonly fail on transient issues (network, registries, flaky browsers). On Latchkey managed runners they are detected, retried, and self-healed instead of failing your build:
- Dependency installs
This workflow runs 1 job per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.