Skip to content

Commit 809d74f

Browse files
committed
Merge pull request #128 from snowplow-incubator/release/1.0.0
Release/1.0.0
2 parents 6fc483f + 3b71194 commit 809d74f

File tree

83 files changed

+14148
-2640
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+14148
-2640
lines changed

.eslintignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@
22
node_modules
33
# don't lint build output
44
dist
5+
# don't lint DemoApp here
6+
DemoApp

.eslintrc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ module.exports = {
22
root: true,
33
parser: '@typescript-eslint/parser',
44
parserOptions: {
5-
project: './tsconfig.json',
5+
project: ['./tsconfig.eslint.json'],
66
ecmaVersion: 6,
77
ecmaFeatures: {
88
impliedStrict: true,

.github/workflows/build.yml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,12 @@ jobs:
2525
- name: Compile TypeScript
2626
run: npm run compile
2727

28-
- name: Install node modules for DemoApp
29-
working-directory: DemoApp
30-
run: yarn install --frozen-lockfile
31-
3228
- name: Lint
3329
run: npm run lint
3430

31+
- name: Tests
32+
run: npm run test
33+
3534
build_android:
3635
needs: ["test"]
3736
runs-on: ubuntu-20.04
@@ -56,7 +55,11 @@ jobs:
5655
- name: Install node_modules in DemoApp
5756
working-directory: DemoApp
5857
run: |
59-
yarn install --frozen-lockfile
58+
yarn install --frozen-lockfile --network-timeout 100000
59+
60+
- name: Lint DemoApp
61+
working-directory: DemoApp
62+
run: yarn lint
6063

6164
- name: Build DemoApp
6265
working-directory: DemoApp/android
@@ -84,7 +87,7 @@ jobs:
8487
- name: Install node_modules in DemoApp
8588
working-directory: DemoApp
8689
run: |
87-
yarn install --frozen-lockfile
90+
yarn install --frozen-lockfile --network-timeout 100000
8891
8992
- name: Install Pods
9093
working-directory: DemoApp/ios

.github/workflows/deploy.yml

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,12 @@ jobs:
2424
- name: Compile TypeScript
2525
run: npm run compile
2626

27-
- name: Install node modules for DemoApp
28-
working-directory: DemoApp
29-
run: yarn install --frozen-lockfile
30-
3127
- name: Lint
3228
run: npm run lint
3329

30+
- name: Tests
31+
run: npm run test
32+
3433
version_check:
3534
runs-on: ubuntu-20.04
3635
outputs:
@@ -47,15 +46,29 @@ jobs:
4746

4847
- name: Get tag and tracker versions
4948
id: version
49+
env:
50+
IOS_VER_FILEPATH: 'ios/Util/RNTrackerVersion.m'
51+
ANDR_VER_FILEPATH: 'android/src/main/java/com/snowplowanalytics/react/util/TrackerVersion.java'
5052
run: |
5153
echo ::set-output name=TAG_VERSION::${GITHUB_REF#refs/*/}
5254
echo "##[set-output name=RN_TRACKER_VERSION;]$(node -p "require('./package.json').version")"
55+
echo "##[set-output name=RN_IOS_TRACKER_VERSION;]$(cat "${IOS_VER_FILEPATH}" | sed -n -e 's/^.*kRNTrackerVersion = @"rn-\(.*\)";/\1/p')"
56+
echo "##[set-output name=RN_ANDROID_TRACKER_VERSION;]$(cat "${ANDR_VER_FILEPATH}" | sed -n -e 's/^.*RN_TRACKER_VERSION = "rn-\(.*\)";/\1/p')"
5357
5458
- name: Fail if version mismatch
55-
if: ${{ steps.version.outputs.TAG_VERSION != steps.version.outputs.RN_TRACKER_VERSION }}
5659
run: |
57-
echo "Tag version (${{ steps.version.outputs.TAG_VERSION }}) doesn't match version in project (${{ steps.version.outputs.RN_TRACKER_VERSION }})"
58-
exit 1
60+
if [ "${{ steps.version.outputs.TAG_VERSION }}" != "${{ steps.version.outputs.RN_TRACKER_VERSION }}" ] ; then
61+
echo "Tag version (${{ steps.version.outputs.TAG_VERSION }}) doesn't match version in project (${{ steps.version.outputs.RN_TRACKER_VERSION }})"
62+
exit 1
63+
fi
64+
if [ "${{ steps.version.outputs.TAG_VERSION }}" != "${{ steps.version.outputs.RN_IOS_TRACKER_VERSION }}" ] ; then
65+
echo "Tag version (${{ steps.version.outputs.TAG_VERSION }}) doesn't match version in project(ios) (${{ steps.version.outputs.RN_IOS_TRACKER_VERSION }})"
66+
exit 1
67+
fi
68+
if [ "${{ steps.version.outputs.TAG_VERSION }}" != "${{ steps.version.outputs.RN_TRACKER_VERSION }}" ] ; then
69+
echo "Tag version (${{ steps.version.outputs.TAG_VERSION }}) doesn't match version in project(android) (${{ steps.version.outputs.RN_ANDR_TRACKER_VERSION }})"
70+
exit 1
71+
fi
5972
6073
build_android:
6174
needs: ["test", "version_check"]
@@ -81,7 +94,11 @@ jobs:
8194
- name: Install node_modules
8295
working-directory: DemoApp
8396
run: |
84-
yarn install --frozen-lockfile
97+
yarn install --frozen-lockfile --network-timeout 100000
98+
99+
- name: Lint DemoApp
100+
working-directory: DemoApp
101+
run: yarn lint
85102

86103
- name: Build DemoApp
87104
working-directory: DemoApp/android
@@ -109,7 +126,7 @@ jobs:
109126
- name: Install node_modules
110127
working-directory: DemoApp
111128
run: |
112-
yarn install --frozen-lockfile
129+
yarn install --frozen-lockfile --network-timeout 100000
113130
114131
- name: Install Pods
115132
working-directory: DemoApp/ios
@@ -167,7 +184,7 @@ jobs:
167184
uses: actions/checkout@v2
168185

169186
- name: Release
170-
uses: softprops/action-gh-release@v1
187+
uses: softprops/action-gh-release@v0.1.7
171188
env:
172189
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
173190
with:

.github/workflows/e2e-android.yml

Lines changed: 150 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
name: e2e-android
2+
3+
on:
4+
pull_request:
5+
6+
jobs:
7+
e2e:
8+
runs-on: macos-10.15
9+
timeout-minutes: 30
10+
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@v2
14+
15+
# -- Setup --
16+
- name: Setup Node
17+
uses: actions/setup-node@v2
18+
with:
19+
node-version: 14
20+
21+
- name: Setup Java
22+
uses: actions/setup-java@v2
23+
with:
24+
distribution: 'adopt'
25+
java-version: '8'
26+
27+
# -- Micro --
28+
- name: Cache Micro
29+
id: cache-micro
30+
uses: actions/cache@v2
31+
with:
32+
path: micro.jar
33+
key: ${{ runner.os }}-micro
34+
35+
- name: Get micro
36+
if: steps.cache-micro.outputs.cache-hit != 'true'
37+
run: curl -o micro.jar -L https://github.com/snowplow-incubator/snowplow-micro/releases/download/micro-1.1.2/snowplow-micro-1.1.2.jar
38+
39+
- name: Run Micro in background
40+
run: java -jar micro.jar --collector-config DemoApp/tests/micro/micro.conf --iglu DemoApp/tests/micro/iglu.json &
41+
42+
- name: Wait on Micro endpoint
43+
timeout-minutes: 2
44+
run: while ! nc -z '0.0.0.0' 9090; do sleep 1; done
45+
46+
- name: Prepare DemoApp for Micro
47+
working-directory: DemoApp
48+
run: perl -i -pe "s/^.*endpoint:\K.*/ \'http:\/\/10.0.2.2:9090\'\,/" App.js
49+
50+
# -- Tracker --
51+
- name: Use npm cache
52+
uses: actions/cache@v2
53+
with:
54+
path: ~/.npm
55+
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
56+
restore-keys: |
57+
${{ runner.os }}-node-
58+
59+
- name: Install node modules
60+
run: npm ci
61+
62+
- name: Build Tracker
63+
run: npm run build
64+
65+
# -- App --
66+
- name: Get yarn cache directory path
67+
id: yarn-cache-dir-path
68+
run: echo "::set-output name=dir::$(yarn cache dir)"
69+
70+
- name: Use yarn cache
71+
uses: actions/cache@v2
72+
with:
73+
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
74+
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
75+
restore-keys: |
76+
${{ runner.os }}-yarn-
77+
78+
- name: Install node modules for DemoApp
79+
working-directory: DemoApp
80+
run: yarn install --frozen-lockfile --network-timeout 100000
81+
82+
# -- Emulator --
83+
- name: Get AOSP system image and create Android virtual device
84+
run: |
85+
echo 'y' | ${ANDROID_SDK_ROOT}/tools/bin/sdkmanager "system-images;android-28;default;x86_64"
86+
echo 'no' | $ANDROID_SDK_ROOT/tools/bin/avdmanager create avd --force --name Pixel_API_28_AOSP -d pixel --package "system-images;android-28;default;x86_64"
87+
88+
- name: Start Android emulator
89+
timeout-minutes: 10
90+
run: |
91+
echo "Starting emulator.."
92+
nohup $ANDROID_HOME/emulator/emulator -avd Pixel_API_28_AOSP -no-audio -no-snapshot -no-window &
93+
$ANDROID_HOME/platform-tools/adb wait-for-device shell 'while [[ -z $(getprop sys.boot_completed | tr -d '\r') ]]; do sleep 1; done; input keyevent 82'
94+
$ANDROID_HOME/platform-tools/adb devices
95+
echo "Emulator started!"
96+
97+
# -- Build --
98+
- name: Use gradle cache
99+
uses: actions/cache@v2
100+
with:
101+
path: |
102+
~/.gradle/caches
103+
~/.gradle/wrapper
104+
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
105+
restore-keys: |
106+
${{ runner.os }}-gradle-
107+
108+
- name: Detox build android
109+
working-directory: DemoApp
110+
run: yarn detox-build-android
111+
112+
- name: Start Metro
113+
working-directory: DemoApp
114+
run: yarn start &
115+
116+
- name: Wait on metro endpoint
117+
timeout-minutes: 2
118+
run: while ! nc -z '0.0.0.0' 8081; do sleep 1; done
119+
120+
# -- Test --
121+
- name: Detox Jest android
122+
id: dj
123+
uses: nick-invision/retry@v2
124+
with:
125+
timeout_minutes: 15
126+
max_attempts: 2
127+
command: |
128+
cd DemoApp
129+
yarn detox-test-android
130+
yarn test
131+
132+
- name: Log events if Detox-Jest failed
133+
id: eventlog
134+
if: ${{ failure() && steps.dj.outcome == 'failure' }}
135+
run: |
136+
echo "{ \"all\": $(curl -s -o - 'http://0.0.0.0:9090/micro/all'), \
137+
\"bad\": $(curl -s -o - 'http://0.0.0.0:9090/micro/bad'), \
138+
\"good\": $(curl -s -o - 'http://0.0.0.0:9090/micro/good') }"\
139+
| jq '.' > android-events-micro.json
140+
141+
- name: Upload events artifact if Detox-Jest failed
142+
if: ${{ failure() && steps.dj.outcome == 'failure' && steps.eventlog.outcome == 'success' }}
143+
uses: actions/upload-artifact@v2
144+
with:
145+
name: android-events-artifact
146+
path: android-events-micro.json
147+
148+
# -- Cleanup --
149+
- name: Stop gradle daemon
150+
run: gradle --stop

0 commit comments

Comments
 (0)