-
-
Notifications
You must be signed in to change notification settings - Fork 13
191 lines (185 loc) · 5.65 KB
/
test.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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
name: Build, Test, & Deploy
on:
push:
paths-ignore:
- 'docs/**'
pull_request:
jobs:
frontend:
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != 'nkalupahana/baseline')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Use Node.js 18
uses: actions/setup-node@v4
with:
node-version: "18.x"
cache: "npm"
- run: npm ci
- name: Build Tests
run: |
npm install -g @ionic/cli
npm run build
ionic cap sync
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
- name: Integration Tests
run: |
PORT=8100 npx react-scripts -r @cypress/instrument-cra start &
sleep 60
npm run test:e2e
env:
HAPPO_API_KEY: ${{ secrets.HAPPO_API_KEY }}
HAPPO_API_SECRET: ${{ secrets.HAPPO_API_SECRET }}
HAPPO_NONCE: ${{ github.run_id }}
- name: Upload Test Video
if: failure()
uses: actions/upload-artifact@v4
with:
name: test-video
path: cypress/videos
- name: Upload Test Screenshots
if: failure()
uses: actions/upload-artifact@v4
with:
name: test-screenshots
path: cypress/screenshots
- name: Component Tests
run: npm run test:component
env:
HAPPO_API_KEY: ${{ secrets.HAPPO_API_KEY }}
HAPPO_API_SECRET: ${{ secrets.HAPPO_API_SECRET }}
HAPPO_NONCE: ${{ github.run_id }}
- name: Upload to Happo
run: npx happo-e2e finalize
env:
HAPPO_API_KEY: ${{ secrets.HAPPO_API_KEY }}
HAPPO_API_SECRET: ${{ secrets.HAPPO_API_SECRET }}
HAPPO_NONCE: ${{ github.run_id }}
- name: SonarCloud Scan
uses: SonarSource/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONARCLOUD_TOKEN }}
- name: Upload Test Data
uses: actions/upload-artifact@v4
with:
name: coverage
path: coverage
backend:
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != 'nkalupahana/baseline')
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./backend
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Use Node.js 18
uses: actions/setup-node@v4
with:
node-version: "18.x"
cache: "npm"
- run: npm ci
- run: npm run build
internal:
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != 'nkalupahana/baseline')
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./scheduled-services
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Use Node.js 18
uses: actions/setup-node@v4
with:
node-version: "18.x"
cache: "npm"
- run: npm ci
- run: npm run build
android:
needs: frontend
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use Node.js 18
uses: actions/setup-node@v4
with:
node-version: "18.x"
cache: "npm"
- run: npm ci
- name: Build (Ionic)
run: |
npm install -g @ionic/cli
npm run build
ionic cap sync
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
- name: Set up JDK 11
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'corretto'
cache: gradle
- name: Build (Android)
run: |
cd android
chmod +x gradlew
./gradlew bundleDebug
- name: Send to DeployGate
env:
token: ${{ secrets.DEPLOYGATE_TOKEN }}
COMMIT_MSG: ${{ github.event.commits[0].message }}
run: curl -F "token=${token}" -F "file=@android/app/build/outputs/bundle/debug/app-debug.aab" -F "message=Upload from GitHub Actions, ref ${GITHUB_REF}, sha ${GITHUB_SHA}, msg ${COMMIT_MSG}" https://deploygate.com/api/users/nkalupahana/apps
- name: Build Release Artifact
if: github.ref == 'refs/heads/main'
run: |
echo $ANDROID_KEYSTORE | base64 --decode > android/app/release-ci.keystore
cd android
./gradlew bundleRelease
env:
ANDROID_KEYSTORE: ${{ secrets.ANDROID_KEYSTORE }}
ANDROID_KEYSTORE_PASSWORD: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }}
- name: Send to Artifacts
uses: actions/upload-artifact@v4
with:
name: outputs
path: android/app/build/outputs
ios:
needs: frontend
runs-on: macos-14
concurrency:
group: "ios"
cancel-in-progress: true
steps:
- uses: actions/checkout@v4
- name: Use Node.js 18
uses: actions/setup-node@v4
with:
node-version: "18.x"
cache: "npm"
- run: npm ci
- name: Build (Ionic)
run: |
npm install -g @ionic/cli
npm run build
ionic cap sync
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
- name: Deploy to TestFlight
run: |
brew install fastlane
cd ios/App
echo "$APP_STORE_CONNECT_KEY" > authkey.json
fastlane beta
env:
FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD: ${{ secrets.FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD }}
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
MATCH_GIT_BASIC_AUTHORIZATION: ${{ secrets.MATCH_GIT_BASIC_AUTHORIZATION }}
APP_STORE_CONNECT_KEY: ${{ secrets.APP_STORE_CONNECT_KEY }}
COMMIT_MSG: ${{ github.event.commits[0].message }}