-
Notifications
You must be signed in to change notification settings - Fork 7
171 lines (151 loc) · 4.87 KB
/
cli-build.yml
File metadata and controls
171 lines (151 loc) · 4.87 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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
name: CLI Build Pipeline
on:
push:
branches: [main]
paths:
- 'cli/**'
- '@mol-view-stories/lib/**'
- '.github/workflows/cli-build.yml'
pull_request:
branches: [main]
paths:
- 'cli/**'
- '@mol-view-stories/lib/**'
- '.github/workflows/cli-build.yml'
jobs:
build:
name: Build CLI on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
fail-fast: false
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Deno
uses: denoland/setup-deno@v1
with:
deno-version: v2.x
- name: Cache Deno dependencies
uses: actions/cache@v3
with:
path: |
~/.deno
~/.cache/deno
key: ${{ runner.os }}-deno-${{ hashFiles('cli/deno.json', 'cli/deno.lock') }}
restore-keys: |
${{ runner.os }}-deno-
- name: Run tests
working-directory: cli
run: deno task test
- name: Build CLI (Unix)
if: runner.os != 'Windows'
working-directory: cli
run: deno task build
- name: Build CLI (Windows)
if: runner.os == 'Windows'
working-directory: cli
run: deno task build
shell: pwsh
- name: Verify build output (Unix)
if: runner.os != 'Windows'
working-directory: cli
run: |
if [ -f "mvs" ]; then
echo "✓ CLI binary built successfully"
ls -lh mvs
file mvs
else
echo "✗ CLI binary not found"
exit 1
fi
- name: Verify build output (Windows)
if: runner.os == 'Windows'
working-directory: cli
shell: pwsh
run: |
if (Test-Path "mvs.exe") {
Write-Host "✓ CLI binary built successfully"
Get-Item mvs.exe | Format-List
} else {
Write-Host "✗ CLI binary not found"
exit 1
}
- name: Test CLI - Version (Unix)
if: runner.os != 'Windows'
working-directory: cli
run: |
./mvs --version
echo "✓ Version command works"
- name: Test CLI - Version (Windows)
if: runner.os == 'Windows'
working-directory: cli
shell: pwsh
run: |
.\mvs.exe --version
Write-Host "✓ Version command works"
- name: Test CLI - Help (Unix)
if: runner.os != 'Windows'
working-directory: cli
run: |
./mvs --help
echo "✓ Help command works"
- name: Test CLI - Help (Windows)
if: runner.os == 'Windows'
working-directory: cli
shell: pwsh
run: |
.\mvs.exe --help
Write-Host "✓ Help command works"
- name: Test CLI - Create command (Unix)
if: runner.os != 'Windows'
working-directory: cli
run: |
./mvs create test-story
if [ -d "test-story" ] && [ -f "test-story/story.yaml" ]; then
echo "✓ Create command works"
rm -rf test-story
else
echo "✗ Create command failed"
exit 1
fi
- name: Test CLI - Create command (Windows)
if: runner.os == 'Windows'
working-directory: cli
shell: pwsh
run: |
.\mvs.exe create test-story
if ((Test-Path "test-story") -and (Test-Path "test-story/story.yaml")) {
Write-Host "✓ Create command works"
Remove-Item -Recurse -Force test-story
} else {
Write-Host "✗ Create command failed"
exit 1
}
# - name: Upload build artifact
# uses: actions/upload-artifact@v3
# with:
# name: mvs-cli-${{ matrix.os }}
# path: |
# cli/mvs
# cli/mvs.exe
# if-no-files-found: ignore
# retention-days: 7
summary:
name: Build Summary
runs-on: ubuntu-latest
needs: build
if: always()
steps:
- name: Generate summary
run: |
echo "## CLI Build Summary" >> $GITHUB_STEP_SUMMARY
echo "- **Branch**: ${{ github.ref_name }}" >> $GITHUB_STEP_SUMMARY
echo "- **Commit**: ${{ github.sha }}" >> $GITHUB_STEP_SUMMARY
echo "- **Trigger**: ${{ github.event_name }}" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "### Build Status" >> $GITHUB_STEP_SUMMARY
echo "- **Linux**: ${{ needs.build.result == 'success' && '✅' || '❌' }} ${{ needs.build.result }}" >> $GITHUB_STEP_SUMMARY
echo "- **macOS**: ${{ needs.build.result == 'success' && '✅' || '❌' }} ${{ needs.build.result }}" >> $GITHUB_STEP_SUMMARY
echo "- **Windows**: ${{ needs.build.result == 'success' && '✅' || '❌' }} ${{ needs.build.result }}" >> $GITHUB_STEP_SUMMARY