-
Notifications
You must be signed in to change notification settings - Fork 3
163 lines (129 loc) · 4.33 KB
/
Copy pathci.yml
File metadata and controls
163 lines (129 loc) · 4.33 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
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
concurrency:
group: ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
jobs:
# Formatting check - only needs to run once since cargo fmt is purely textual
# (no compilation, so no platform-specific code paths like #[cfg(target_os)])
format:
name: Format Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: "1.89"
components: rustfmt
- name: Check formatting
run: cargo fmt --all -- --check
marketplace-validate:
name: Marketplace Packer Validate
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Assert Marketplace scripts
run: |
test -f infra/digitalocean/marketplace/90-cleanup.sh
test -f infra/digitalocean/marketplace/99-img-check.sh
- name: Setup Packer
uses: hashicorp/setup-packer@v3
with:
version: "1.10.0"
- name: Packer init
run: packer init infra/digitalocean/packer/opencode-marketplace.pkr.hcl
- name: Packer fmt
run: packer fmt -check infra/digitalocean/packer/opencode-marketplace.pkr.hcl
- name: Packer validate
run: packer validate -var-file=infra/digitalocean/packer/variables.pkr.hcl infra/digitalocean/packer/opencode-marketplace.pkr.hcl
# Build, lint, and test on multiple platforms
# Clippy/build/test must run on each platform because #[cfg(target_os)] causes
# different code to compile (e.g., systemd.rs on Linux, launchd.rs on macOS)
build:
name: Build (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
steps:
- uses: actions/checkout@v6
- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: "1.89"
components: clippy
- name: Install just
uses: extractions/setup-just@v3
- name: Install pnpm
uses: pnpm/action-setup@v4
- name: Setup Node.js
uses: actions/setup-node@v5
with:
node-version: '20'
cache: 'pnpm'
- name: Rust cache
uses: Swatinem/rust-cache@v2
- name: Install Node dependencies
run: pnpm install --frozen-lockfile --ignore-scripts
- name: Clippy
run: cargo clippy --all-targets --all-features -- -D warnings
- name: Build Rust
run: cargo build --workspace
- name: Test All (slow)
run: just test-all-slow
- name: Build core bindings
run: pnpm -C packages/core build
- name: Verify CLI works
run: cargo run -p opencode-cloud -- --version
- name: Record CLI parity SHA
if: matrix.os == 'ubuntu-latest'
run: git rev-parse HEAD > cli-parity.sha
- name: Upload CLI parity artifacts
if: matrix.os == 'ubuntu-latest'
uses: actions/upload-artifact@v4
with:
name: cli-parity-artifacts
path: |
target/debug/opencode-cloud
packages/cli-node/dist
cli-parity.sha
# CLI Parity - ensures Node CLI can invoke all Rust CLI commands
cli-parity:
name: CLI Parity Tests
runs-on: ubuntu-latest
needs: [build]
steps:
- uses: actions/checkout@v6
- name: Install pnpm
uses: pnpm/action-setup@v4
- name: Setup Node.js
uses: actions/setup-node@v5
with:
node-version: '20'
cache: 'pnpm'
- name: Download CLI parity artifacts
uses: actions/download-artifact@v4
with:
name: cli-parity-artifacts
- name: Verify artifact SHA
run: |
if [ -f cli-parity.sha ]; then
echo "Artifact SHA: $(cat cli-parity.sha)"
echo "Workflow SHA: $GITHUB_SHA"
test "$(cat cli-parity.sha)" = "$GITHUB_SHA"
fi
- name: Ensure Rust binary executable
run: chmod +x target/debug/opencode-cloud
- name: Install Node dependencies (cli only)
run: pnpm install --filter opencode-cloud --frozen-lockfile --ignore-scripts
- name: Run CLI parity tests
run: pnpm -C packages/cli-node test