Skip to content

Commit dae00ab

Browse files
committed
add workflow
1 parent 5462d52 commit dae00ab

File tree

1 file changed

+93
-0
lines changed

1 file changed

+93
-0
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

0 commit comments

Comments
 (0)