This repository has been archived by the owner on Dec 12, 2024. It is now read-only.
generated from TBD54566975/tbd-project-template
-
Notifications
You must be signed in to change notification settings - Fork 105
154 lines (120 loc) · 3.73 KB
/
main.yml
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
name: Test and Deploy to Netlify
on:
pull_request:
branches:
- main
push:
branches:
- main
workflow_dispatch:
inputs:
reason:
description: 'Manual trigger'
required: true
default: 'Just because.'
jobs:
test-js:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: '18'
- name: Install pnpm
run: npm install -g pnpm
- name: Install pnpm dependencies
run: pnpm install
- name: Start dwn-server container
run: docker compose up -d dwn-server
- name: Wait for dwn-server to be ready
run: until curl -sf http://localhost:3000/health; do echo -n .; sleep .1; done
- name: Run JS Tests
run: |
pnpm test:js
env:
VITE_APP_TEST_DWN_URL: http://localhost:3000
test-kotlin:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: '18'
- name: Setup Java 17
uses: actions/setup-java@v2
with:
distribution: 'temurin'
java-version: '17'
cache: 'maven'
- name: Install pnpm
run: npm install -g pnpm
- name: Install pnpm dependencies
run: pnpm install
- name: Run Kotlin Tests
run: |
pnpm test:kotlin
test-swift:
runs-on: macOS-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: '18'
- name: Cache Swift dependencies
uses: actions/cache@v2
with:
path: ~/.swiftpm
key: ${{ runner.os }}-swift-${{ hashFiles('**/Package.resolved') }}
restore-keys: |
${{ runner.os }}-swift-
- name: Setup Swift
uses: swift-actions/setup-swift@v1
with:
swift-version: "5.9.2"
- name: Get Swift version
run: swift --version # Log the Swift version in use
- name: Install pnpm
run: npm install -g pnpm
- name: Install pnpm dependencies
run: pnpm install
- name: Run Swift Tests
run: |
pnpm test:swift
test-apps:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: '18'
- name: Install pnpm
run: npm install -g pnpm
- name: Install dependencies
run: pnpm install
- name: Start dwn-server container
run: docker compose up -d dwn-server
- name: Wait for dwn-server to be ready
run: until curl -sf http://localhost:3000/health; do echo -n .; sleep .1; done
- name: Run apps tests
run: pnpm --filter feedback-server test run
deploy:
needs: [test-js, test-kotlin, test-swift, test-apps]
# Deploy the preview branch to Netlify only if it's a PR
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- name: Trigger Netlify Build via Build Hook with Dynamic Params
run: |
BRANCH_NAME=$(echo "${GITHUB_REF#refs/heads/}")
ENCODED_BRANCH_NAME=$(echo "$BRANCH_NAME" | sed 's|/|%2F|g')
TITLE="${BRANCH_NAME} Branch Deploy"
ENCODED_TITLE=$(echo "$TITLE" | sed 's| |%20|g')
curl -v -X POST -d "trigger_branch=$ENCODED_BRANCH_NAME&trigger_title=$ENCODED_TITLE&clear_cache=true" "https://api.netlify.com/build_hooks/${{ secrets.TEST_BUILDHOOK }}"