-
Notifications
You must be signed in to change notification settings - Fork 42
181 lines (165 loc) · 6.1 KB
/
okta-react-native.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
name: Okta React Native
on:
push:
branches: [ master ]
pull_request:
jobs:
JSUnitTests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Configure React Native dependencies (node_modules)
uses: ./.github/workflows/composite/configure-node
with:
node-path: ./node_modules
lock-hash: ${{ hashFiles('yarn.lock') }}
- run: sudo apt-get install -y libappindicator1
- name: Lint
run: yarn lint
- name: Test
run: yarn test
- name: Execute snyk.sh
run: bash ./scripts/snyk.sh
iOSUnitTests:
runs-on: macos-12
steps:
- uses: actions/checkout@v3
- name: Configure React Native dependencies (node_modules)
uses: ./.github/workflows/composite/configure-node
with:
node-path: ./node_modules
lock-hash: ${{ hashFiles('yarn.lock') }}
- name: Cache CocoaPods
id: pods-cache
uses: actions/cache@v3
with:
path: ./ios/Pods
key: pods-${{ hashFiles('./ios/Podfile.lock') }}
- name: Preparation before iOS Build
run: |
pod install --project-directory=ios --repo-update
- name: iOS
run: |
set -o pipefail
xcodebuild \
-workspace ios/ReactNativeOktaSdkBridge.xcworkspace \
-scheme "ReactNativeOktaSdkBridge" \
-destination "platform=iOS Simulator,OS=latest,name=iPhone 14" \
clean test | xcpretty
iOSUITests:
runs-on: macos-12
steps:
- uses: actions/checkout@v3
- name: Cache ./node_modules
uses: ./.github/workflows/composite/configure-node
with:
node-path: ./node_modules
lock-hash: ${{ hashFiles('yarn.lock') }}
- name: Build okta-react-native package
run: yarn build
- name: Cache e2e/node_modules
uses: ./.github/workflows/composite/configure-node
with:
node-path: ./e2e/node_modules
lock-hash: ${{ hashFiles('./e2e/yarn.lock') }}
install-path: ./e2e
- name: Cache CocoaPods
id: pods-cache
uses: actions/cache@v3
with:
path: ./e2e/ios/Pods
key: pods-${{ hashFiles('./e2e/ios/Podfile.lock') }}
- name: Preparation before iOS Build
run: |
npm install -g react-native-cli
cd e2e
yarn bundle:ios
cd ios
pod install --repo-update
cd ../..
echo -e "CLIENT_ID=${{ secrets.CLIENT_ID }}\nISSUER=${{ secrets.ISSUER }}\nREDIRECT_URI=${{ secrets.REDIRECT_URI }}\nLOGOUT_REDIRECT_URI=${{secrets.LOGOUT_REDIRECT_URI}}" > e2e/.env
- name: iOS
env:
OKTA_USERNAME: ${{ secrets.OKTA_USERNAME }}
OKTA_PASSWORD: ${{ secrets.OKTA_PASSWORD }}
run: |
set -o pipefail
xcodebuild \
-workspace e2e/ios/E2EOktaReactNative.xcworkspace \
-scheme E2EOktaReactNative \
-destination 'platform=iOS Simulator,OS=latest,name=iPhone 14' \
-configuration CI \
-sdk iphonesimulator \
clean test | xcpretty
androidUITests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Configure JDK
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: 18
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
- name: Configure node_modules
uses: ./.github/workflows/composite/configure-node
with:
node-path: ./node_modules
lock-hash: ${{ hashFiles('yarn.lock') }}
- name: Build okta-react-native package
run: yarn build
- name: Configure e2e/node_modules
uses: ./.github/workflows/composite/configure-node
with:
node-path: ./e2e/node_modules
lock-hash: ${{ hashFiles('./e2e/yarn.lock') }}
install-path: ./e2e
- name: Preparation before Android Build
run: |
npm install -g react-native-cli
cd e2e
echo -e "CLIENT_ID=${{ secrets.CLIENT_ID }}\nISSUER=${{ secrets.ISSUER }}\nREDIRECT_URI=${{ secrets.REDIRECT_URI }}\nLOGOUT_REDIRECT_URI=${{secrets.LOGOUT_REDIRECT_URI}}" > .env
echo -e "signInRedirectUri=${{ secrets.REDIRECT_URI }}\n" > android/okta.properties
mkdir -p android/app/src/androidTest/resources/
echo -e "username=${{ secrets.OKTA_USERNAME }}\npassword=${{ secrets.OKTA_PASSWORD }}\n" > android/app/src/androidTest/resources/e2eCredentials.properties
yarn bundle:android
cd ..
- name: Build Android E2E app
run: |
cd e2e/android
./gradlew assembleDebug assembleAndroidTest
cd ../..
- name: Setup Gcloud credentials
if: ${{ github.event.repository.fork == false }}
env:
GOOGLE_SERVICE_JSON_BASE64: ${{ secrets.GOOGLE_SERVICE_JSON_BASE64 }}
run: |
echo "::add-mask::$(echo $GOOGLE_SERVICE_JSON_BASE64 | base64 --decode | jq -r tostring)"
echo "GOOGLE_SERVICE_JSON=$(echo $GOOGLE_SERVICE_JSON_BASE64 | base64 --decode | jq -r tostring)" >> $GITHUB_ENV
- name: Authenticate Gcloud command line
if: ${{ github.event.repository.fork == false }}
uses: google-github-actions/auth@v1
with:
credentials_json: ${{ env.GOOGLE_SERVICE_JSON }}
project_id: ${{ secrets.GOOGLE_PROJECT_ID }}
- name: Set up Cloud SDK
if: ${{ github.event.repository.fork == false }}
uses: google-github-actions/setup-gcloud@v1
- name: Use gcloud CLI
if: ${{ github.event.repository.fork == false }}
run: gcloud auth list &> /dev/null
- name: Run End to End Tests
if: ${{ github.event.repository.fork == false }}
run: |
cd e2e/android
./runTestsInFirebaseTestLab.sh
cd ../..
- name: Upload Test Failures
if: failure()
uses: actions/upload-artifact@v3
with:
name: test-failures
path: |
**/build/reports/tests/
**/out/failures/