-
Notifications
You must be signed in to change notification settings - Fork 17
115 lines (111 loc) · 3.49 KB
/
build.yml
File metadata and controls
115 lines (111 loc) · 3.49 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
name: build
on:
push:
branches: [main]
pull_request:
# self contained tests
jobs:
lint:
name: Typecheck
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup Bun
uses: oven-sh/setup-bun@v2
# Building the SDK is necessary to generate the .d.ts files used for type checking.
with:
bun-version: 1.2.23
- name: Cache Bun dependencies
id: bun-cache
uses: actions/cache@v4
with:
path: ~/.bun/install/cache
key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lock') }}
restore-keys: |
${{ runner.os }}-bun-
- name: Typecheck
run: |
if [ "${{ steps.bun-cache.outputs.cache-hit }}" == "true" ]; then
echo "Cache hit! Using cached dependencies..."
bun install --frozen-lockfile --no-summary
else
echo "Cache miss! Installing dependencies..."
bun install --frozen-lockfile
fi
bun run generate-api-types
bun run build:sdk
bun run typecheck
lint_format:
name: Lint and check formatting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup Bun
uses: oven-sh/setup-bun@v2
- name: Cache Bun dependencies
id: bun-cache
uses: actions/cache@v4
with:
path: ~/.bun/install/cache
key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lock') }}
restore-keys: |
${{ runner.os }}-bun-
- name: Install dependencies
run: |
echo "Bun cache hit: ${{ steps.bun-cache.outputs.cache-hit }}"
bun install --frozen-lockfile
- name: Check formatting
run: bunx prettier './packages/**/*.{ts,tsx}' --check
- name: Lint
run: bun run lint
npx_test:
name: npx test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: "true" # Fetch submodules
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
- name: Install Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: 1.2.23
- name: Cache Bun dependencies
id: bun-cache
uses: actions/cache@v4
with:
path: ~/.bun/install/cache
key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lock') }}
restore-keys: |
${{ runner.os }}-bun-
- name: build server
run: |
echo "Bun cache hit: ${{ steps.bun-cache.outputs.cache-hit }}"
bun install --frozen-lockfile
bun run build
env:
BUN_CONFIG_SKIP_POSTINSTALL_SCRIPTS: "1"
- name: Link local package
run: |
cd packages/server && npm link
- name: Start npx server
run: |
cd packages/server && npx malloy-publisher --port 4002 --server_root ./ &
sleep 12
- name: Test API endpoint
run: |
response=$(curl -s http://localhost:4002/api/v0/projects)
echo "API Response: $response"
# Check if response is a JSON array with 1 entry
if echo "$response" | jq -e '. | length == 1' > /dev/null; then
echo "✓ API test passed: Found 1 project"
else
echo "✗ API test failed: Expected 1 project, got different response"
exit 1
fi
cross_platform_test:
name: Cross Platform Tests
uses: ./.github/workflows/cross-platform-tests.yml