Skip to content

Commit c30701f

Browse files
authored
Merge pull request #1206 from appwrite/feat-sdk-build-validation-workflow
2 parents e1ca749 + 56a4fd6 commit c30701f

File tree

6 files changed

+386
-393
lines changed

6 files changed

+386
-393
lines changed
Lines changed: 199 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,199 @@
1+
name: Appwrite SDK Build Validation
2+
3+
concurrency:
4+
group: ${{ github.workflow }}-${{ github.ref }}
5+
cancel-in-progress: true
6+
7+
on: [pull_request]
8+
9+
jobs:
10+
generate-and-build:
11+
name: ${{ matrix.sdk }} (${{ matrix.platform }})
12+
runs-on: ubuntu-latest
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
include:
17+
# Client SDKs
18+
- sdk: web
19+
platform: client
20+
21+
- sdk: flutter
22+
platform: client
23+
24+
- sdk: apple
25+
platform: client
26+
27+
- sdk: android
28+
platform: client
29+
30+
- sdk: react-native
31+
platform: client
32+
33+
# Server SDKs
34+
- sdk: node
35+
platform: server
36+
37+
- sdk: php
38+
platform: server
39+
40+
- sdk: python
41+
platform: server
42+
43+
- sdk: ruby
44+
platform: server
45+
46+
- sdk: dart
47+
platform: server
48+
49+
- sdk: go
50+
platform: server
51+
52+
- sdk: swift
53+
platform: server
54+
55+
- sdk: dotnet
56+
platform: server
57+
58+
- sdk: kotlin
59+
platform: server
60+
61+
# Console SDKs
62+
- sdk: cli
63+
platform: console
64+
65+
steps:
66+
- name: Checkout repository
67+
uses: actions/checkout@v4
68+
with:
69+
submodules: recursive
70+
71+
- name: Setup PHP
72+
uses: shivammathur/setup-php@v2
73+
with:
74+
php-version: '8.3'
75+
extensions: curl
76+
77+
- name: Install Composer Dependencies
78+
run: composer install
79+
80+
- name: Generate SDK for ${{ matrix.sdk }}
81+
run: php example.php ${{ matrix.sdk }} ${{ matrix.platform }}
82+
83+
# Language-specific setup
84+
- name: Setup Node.js
85+
if: matrix.sdk == 'web' || matrix.sdk == 'node' || matrix.sdk == 'cli' || matrix.sdk == 'react-native'
86+
uses: actions/setup-node@v4
87+
with:
88+
node-version: '20'
89+
90+
- name: Setup Flutter
91+
if: matrix.sdk == 'flutter'
92+
uses: subosito/flutter-action@v2
93+
with:
94+
channel: 'stable'
95+
96+
- name: Setup Swift
97+
if: matrix.sdk == 'apple' || matrix.sdk == 'swift'
98+
run: |
99+
sudo apt-get update
100+
sudo apt-get install -y wget
101+
wget https://download.swift.org/swift-5.9.2-release/ubuntu2204/swift-5.9.2-RELEASE/swift-5.9.2-RELEASE-ubuntu22.04.tar.gz
102+
tar xzf swift-5.9.2-RELEASE-ubuntu22.04.tar.gz
103+
sudo mv swift-5.9.2-RELEASE-ubuntu22.04 /usr/share/swift
104+
echo "/usr/share/swift/usr/bin" >> $GITHUB_PATH
105+
106+
- name: Setup Java
107+
if: matrix.sdk == 'android' || matrix.sdk == 'kotlin'
108+
uses: actions/setup-java@v4
109+
with:
110+
distribution: 'temurin'
111+
java-version: '17'
112+
113+
- name: Setup Python
114+
if: matrix.sdk == 'python'
115+
uses: actions/setup-python@v5
116+
with:
117+
python-version: '3.11'
118+
119+
- name: Setup Ruby
120+
if: matrix.sdk == 'ruby'
121+
uses: ruby/setup-ruby@v1
122+
with:
123+
ruby-version: '3.1'
124+
125+
- name: Setup Dart
126+
if: matrix.sdk == 'dart'
127+
uses: dart-lang/setup-dart@v1
128+
with:
129+
sdk: 'stable'
130+
131+
- name: Setup Go
132+
if: matrix.sdk == 'go'
133+
uses: actions/setup-go@v5
134+
with:
135+
go-version: '1.21'
136+
137+
- name: Setup .NET
138+
if: matrix.sdk == 'dotnet'
139+
uses: actions/setup-dotnet@v4
140+
with:
141+
dotnet-version: '8.0.x'
142+
143+
- name: Build SDK
144+
working-directory: examples/${{ matrix.sdk }}
145+
run: |
146+
case "${{ matrix.sdk }}" in
147+
web|node)
148+
npm install
149+
npm run build
150+
;;
151+
cli)
152+
npm install
153+
npm run linux-x64
154+
;;
155+
react-native)
156+
npm install
157+
npm run build || echo "No build script, checking syntax only"
158+
;;
159+
flutter)
160+
flutter pub get
161+
dart analyze --no-fatal-warnings
162+
;;
163+
apple|swift)
164+
swift build
165+
;;
166+
android)
167+
chmod +x ./gradlew || true
168+
./gradlew build -x lint
169+
;;
170+
kotlin)
171+
chmod +x ./gradlew || true
172+
./gradlew build
173+
;;
174+
php)
175+
composer install
176+
;;
177+
python)
178+
pip install -e .
179+
python -m compileall appwrite/
180+
;;
181+
ruby)
182+
bundle install
183+
;;
184+
dart)
185+
dart pub get
186+
dart analyze --no-fatal-warnings
187+
;;
188+
go)
189+
go mod tidy || true
190+
go build ./...
191+
;;
192+
dotnet)
193+
dotnet build
194+
;;
195+
*)
196+
echo "Unknown SDK: ${{ matrix.sdk }}"
197+
exit 1
198+
;;
199+
esac

0 commit comments

Comments
 (0)