This repository has been archived by the owner on Mar 15, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
103 lines (92 loc) · 3.81 KB
/
go.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
name: Go
on:
pull_request:
branches: [ master ]
jobs:
goTest:
name: Test Go
runs-on: ubuntu-latest
strategy:
matrix:
flags: [ "", "-race" ]
steps:
- uses: actions/checkout@v2
- run: git fetch origin master
- name: Check if must run
id: check
run: |
git diff origin/master -- go > changes
if [ -s changes ]; then
echo ::set-output name=shouldRun::yes
echo "The Go code has changed. The test will be executed."
else
echo "The Go code has NOT changed. The test will NOT be executed."
fi
- name: Set up Go 1.14
if: steps.check.outputs.shouldRun == 'yes'
uses: actions/setup-go@v1
with:
go-version: 1.14
id: go
- name: Test ${{ matrix.flags }}
if: steps.check.outputs.shouldRun == 'yes'
run: |
cd go/iden3mobile
go get -v -t -d ./...
go test -v -timeout 30m -count=1 ${{ matrix.flags }} ./...
goAndroidIntegrationTest:
name: Bind Go code to Android and test
needs: goTest
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- run: git fetch origin master
- name: Check if must run
id: check
run: |
git diff origin/master -- go > changes
if [ -s changes ]; then
echo ::set-output name=shouldRun::yes
echo "The Go code has changed. The Android integration test will be executed."
else
git diff origin/master -- android/gointegration > changes
if [ -s changes ]; then
echo ::set-output name=shouldRun::yes
echo "The Android test code has changed. The Android integration test will be executed."
else
echo "The Go and the Android test code code have NOT changed. The Android integration test will NOT be executed."
fi
fi
- name: Bind Go code for Android and compile testing APKs
if: steps.check.outputs.shouldRun == 'yes'
run: |
docker pull ed255/gomobile-android:API29-noemu
echo "${{secrets.GH_AUTH}}" > android/github.properties
echo '${{secrets.INFURA_TOKEN}}' > android/infura.properties
docker run \
--mount type=bind,source=$PWD,target=/root/iden3-mobile \
ed255/gomobile-android:API29-noemu \
/bin/bash -c 'set -ex && \
cd /root/iden3-mobile/go/iden3mobile && \
mkdir -p ../../android/gointegration/src/libs && \
gomobile bind --target android -o ../../android/gointegration/src/libs/iden3mobile.aar && \
cd ../../android && \
rm gointegration/build.gradle && \
mv gointegration/build.GHAgradle gointegration/build.gradle && \
./gradlew :gointegration:assembleDebug --stacktrace && \
./gradlew :gointegration:assembleDebugAndroidTest --stacktrace'
- name: Login to Google Cloud
if: steps.check.outputs.shouldRun == 'yes'
uses: GoogleCloudPlatform/github-actions/setup-gcloud@master
with:
project_id: ${{ secrets.FIREBASE_PROJECT_ID }}
service_account_email: ${{ secrets.GCLOUD_EMAIL }}
service_account_key: ${{ secrets.GCLOUD_AUTH }}
export_default_credentials: true
- name: Run Instrumentation Tests in Firebase Test Lab
if: steps.check.outputs.shouldRun == 'yes'
run: |
gcloud firebase test android run --type instrumentation --use-orchestrator \
--app android/gointegration/build/outputs/apk/debug/gointegration-debug.apk \
--test android/gointegration/build/outputs/apk/androidTest/debug/gointegration-debug-androidTest.apk \
--device model=dipper,version=28,locale=es,orientation=portrait