Skip to content

Commit 09f647a

Browse files
committed
add workflow
1 parent 03890ae commit 09f647a

File tree

3 files changed

+97
-3
lines changed

3 files changed

+97
-3
lines changed

.github/workflows/build.yaml

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
name: Build Packages
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, reopened, ready_for_review]
6+
pull_request_target:
7+
types: [opened]
8+
workflow_dispatch:
9+
push:
10+
branches: ["main"]
11+
12+
env:
13+
TANGRAM_CI_DIR: ${{ github.workspace }}/../.tangram-ci-${{ github.event.repository.name }}
14+
TG_EXE: ${{ github.workspace }}/../.tangram-ci-${{ github.event.repository.name }}/bin/tangram
15+
16+
jobs:
17+
test:
18+
if: github.event_name == 'pull_request' || github.event_name == 'pull_request_target' || github.event_name == 'workflow_dispatch'
19+
runs-on: ${{ matrix.runner }}
20+
environment: test
21+
strategy:
22+
matrix:
23+
include:
24+
- runner: [self-hosted, macOS, ARM64]
25+
enabled: true
26+
- runner: [self-hosted, Linux, X64]
27+
enabled: false
28+
29+
steps:
30+
- name: Check out packages repository
31+
uses: actions/checkout@v4
32+
33+
- name: Configure Tangram
34+
run: |
35+
mkdir -p "$TANGRAM_CI_DIR/bin"
36+
cat > "$TANGRAM_CI_DIR/config.json" << 'EOF'
37+
{}
38+
EOF
39+
cat > "$TANGRAM_CI_DIR/bin/tangram" << 'EOF'
40+
#!/bin/sh
41+
exec tangram --directory "$TANGRAM_CI_DIR" --config "$TANGRAM_CI_DIR/config.json" "$@"
42+
EOF
43+
chmod +x "$TANGRAM_CI_DIR/bin/tangram"
44+
45+
- name: Test packages
46+
if: matrix.enabled
47+
shell: bash
48+
run: |
49+
"$TG_EXE" server start
50+
while [ "$("$TG_EXE" server status)" != "started" ]; do
51+
sleep 1
52+
done
53+
bun run auto --test --sequential
54+
"$TG_EXE" server stop
55+
56+
release:
57+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
58+
runs-on: ${{ matrix.runner }}
59+
environment: release
60+
strategy:
61+
matrix:
62+
include:
63+
- runner: [self-hosted, macOS, ARM64]
64+
enabled: true
65+
- runner: [self-hosted, Linux, X64]
66+
enabled: false
67+
68+
steps:
69+
- name: Check out packages repository
70+
uses: actions/checkout@v4
71+
72+
- name: Configure Tangram
73+
run: |
74+
mkdir -p "$TANGRAM_CI_DIR/bin"
75+
cat > "$TANGRAM_CI_DIR/config.json" << 'EOF'
76+
{}
77+
EOF
78+
cat > "$TANGRAM_CI_DIR/bin/tangram" << 'EOF'
79+
#!/bin/sh
80+
exec tangram --directory "$TANGRAM_CI_DIR" --config "$TANGRAM_CI_DIR/config.json" "$@"
81+
EOF
82+
chmod +x "$TANGRAM_CI_DIR/bin/tangram"
83+
84+
- name: Release packages
85+
if: matrix.enabled
86+
shell: bash
87+
run: |
88+
"$TG_EXE" server start
89+
while [ "$("$TG_EXE" server status)" != "started" ]; do
90+
sleep 1
91+
done
92+
bun run auto --release --sequential
93+
"$TG_EXE" server stop

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
node_modules
33
tangram.lock
44
target
5+
Claude.md

scripts/package_automation.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -239,11 +239,11 @@ const USAGE = `Usage: bun run scripts/package_automation.ts <flags> [packages]
239239
This script can run one or more actions on one or more packages with enhanced flexibility.
240240
241241
Examples:
242-
# Run all steps on all packages (excludes format)
242+
# Run check, build, and test on all packages
243243
bun run scripts/package_automation.ts
244244
245245
# Run specific actions on specific packages
246-
bun run scripts/package_automation.ts -t ripgrep jq
246+
bun run scripts/package_automation.ts -r ripgrep jq
247247
248248
# Format and test (format must be explicitly requested)
249249
bun run scripts/package_automation.ts -ft ripgrep
@@ -319,7 +319,7 @@ function parseFromArgs(): Configuration {
319319

320320
// Default actions if none specified
321321
if (actions.length === 0) {
322-
actions.push("check", "build", "test", "publish", "release");
322+
actions.push("test");
323323
}
324324

325325
// Process export flags - multiple: true ensures it's always an array or undefined

0 commit comments

Comments
 (0)