-
Notifications
You must be signed in to change notification settings - Fork 0
100 lines (92 loc) · 3.28 KB
/
verilib-atomize.yml
File metadata and controls
100 lines (92 loc) · 3.28 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
# Reusable workflow for verilib atomization of pure Rust projects
#
# Usage in any Rust project:
#
# jobs:
# atomize:
# uses: beneficial-ai-foundation/verilib-cli/.github/workflows/verilib-atomize.yml@v1
# with:
# project-path: .
# secrets:
# VERILIB_API_KEY: ${{ secrets.VERILIB_API_KEY }}
name: verilib Atomize
on:
workflow_call:
inputs:
project-path:
description: 'Path to the Rust project'
required: false
type: string
default: '.'
deploy-enabled:
description: 'Enable deployment to verilib backend after atomization (requires VERILIB_API_KEY secret and repo-id)'
required: false
type: boolean
default: false
repo-id:
description: 'Verilib repository ID (used for deploy; optional if .verilib/config.json is in repo)'
required: false
type: string
default: ''
secrets:
VERILIB_API_KEY:
description: 'API key for verilib backend (required when deploy-enabled is true)'
required: false
outputs:
atoms-path:
description: 'Path to generated atoms.json'
value: ${{ jobs.atomize.outputs.atoms-path }}
jobs:
atomize:
name: Atomize
runs-on: ubuntu-latest
outputs:
atoms-path: ${{ steps.verilib.outputs.atoms-path }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Run verilib atomize
id: verilib
uses: ./action/rust
with:
project-path: ${{ inputs.project-path }}
- name: Create summary
run: |
echo "## Atomization Results" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
ATOMS_PATH="${{ steps.verilib.outputs.atoms-path }}"
if [ -n "$ATOMS_PATH" ] && [ -f "$ATOMS_PATH" ]; then
ATOM_COUNT=$(jq 'length' "$ATOMS_PATH")
echo "**Atoms generated: ${ATOM_COUNT}**" >> $GITHUB_STEP_SUMMARY
else
echo "No atoms.json generated." >> $GITHUB_STEP_SUMMARY
fi
- name: Upload verilib artifacts
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master')
uses: actions/upload-artifact@v4
with:
name: verilib-atoms
path: ${{ inputs.project-path }}/.verilib/atoms.json
retention-days: 30
# NOTE: This deploy job currently uses `verilib-cli reclone`, which tells the
# backend to re-clone and re-process the repo from scratch. This is a stopgap:
# it does NOT upload the .verilib/ artifacts generated by the atomize job above.
# A proper solution will use `verilib-cli deploy` (once wired into the CLI) to
# upload the generated artifacts directly, avoiding redundant server-side work.
# See: https://github.com/Beneficial-AI-Foundation/verilib-cli/issues/36
deploy:
name: Deploy to verilib
needs: atomize
if: |
inputs.deploy-enabled &&
github.event_name == 'push' &&
(github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master')
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Deploy to verilib backend
uses: ./action/deploy
with:
api-key: ${{ secrets.VERILIB_API_KEY }}
repo-id: ${{ inputs.repo-id }}