-
Notifications
You must be signed in to change notification settings - Fork 39
152 lines (147 loc) · 5.46 KB
/
android.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
name: Android CI
on:
push:
branches: [ master ]
tags:
- '*'
pull_request:
branches: [ master ]
workflow_dispatch:
inputs:
SNAPSHOT:
type: boolean
description: Set SNAPSHOT true to publish
jobs:
lint_markdown_files:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '2.6'
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
- name: Install gem
run: |
gem install awesome_bot
- name: Run tests
run: find . -type f -name '*.md' -exec awesome_bot {} \;
integration_tests:
if: ${{ startsWith(github.ref, 'refs/tags/') != true && github.event.inputs.SNAPSHOT != 'true' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
# You should create a personal access token and store it in your repository
token: ${{ secrets.CI_USER_TOKEN }}
repository: 'optimizely/travisci-tools'
path: 'home/runner/travisci-tools'
ref: 'master'
- name: set SDK Branch if PR
env:
HEAD_REF: ${{ github.head_ref }}
if: ${{ github.event_name == 'pull_request' }}
run: |
echo "SDK_BRANCH=${{ env.HEAD_REF }}" >> $GITHUB_ENV
echo "TRAVIS_BRANCH=${{ env.HEAD_REF }}" >> $GITHUB_ENV
- name: set SDK Branch if not pull request
if: ${{ github.event_name != 'pull_request' }}
run: |
echo "SDK_BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV
echo "TRAVIS_BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV
- name: Trigger build
env:
SDK: android
FULLSTACK_TEST_REPO: ${{ inputs.FULLSTACK_TEST_REPO }}
BUILD_NUMBER: ${{ github.run_id }}
TESTAPP_BRANCH: master
GITHUB_TOKEN: ${{ secrets.CI_USER_TOKEN }}
EVENT_TYPE: ${{ github.event_name }}
GITHUB_CONTEXT: ${{ toJson(github) }}
#REPO_SLUG: ${{ github.repository }}
PULL_REQUEST_SLUG: ${{ github.repository }}
UPSTREAM_REPO: ${{ github.repository }}
PULL_REQUEST_SHA: ${{ github.event.pull_request.head.sha }}
PULL_REQUEST_NUMBER: ${{ github.event.pull_request.number }}
UPSTREAM_SHA: ${{ github.sha }}
TOKEN: ${{ secrets.TRAVIS_COM_TOKEN }}
EVENT_MESSAGE: ${{ github.event.message }}
HOME: 'home/runner'
run: |
echo "$GITHUB_CONTEXT"
home/runner/travisci-tools/trigger-script-with-status-update.sh
build:
uses: optimizely/android-sdk/.github/workflows/build.yml@master
with:
action: build
test:
if: ${{ startsWith(github.ref, 'refs/tags/') != true && github.event.inputs.SNAPSHOT != 'true' }}
runs-on: macos-latest
strategy:
fail-fast: false
matrix:
api-level: [21, 25, 26, 29]
steps:
- name: checkout
uses: actions/checkout@v2
- name: set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 11
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Gradle cache
uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*') }}-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}-${{ hashFiles('**/buildSrc/**/*.kt') }}
- name: AVD cache
uses: actions/cache@v2
id: avd-cache
with:
path: |
~/.android/avd/*
~/.android/adb*
~/.android/debug.keystore
key: avd-${{ matrix.api-level }}
- name: create AVD and generate snapshot for caching
if: steps.avd-cache.outputs.cache-hit != 'true'
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ matrix.api-level }}
force-avd-creation: false
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: false
script: echo "Generated AVD snapshot for caching."
- name: run tests
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ matrix.api-level }}
force-avd-creation: false
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: true
script: ./gradlew testAllModulesTravis
publish:
if: startsWith(github.ref, 'refs/tags/')
uses: optimizely/android-sdk/.github/workflows/build.yml@master
with:
action: ship
travis_tag: ${GITHUB_REF#refs/*/}
secrets:
MAVEN_SIGNING_KEY_BASE64: ${{ secrets.MAVEN_SIGNING_KEY_BASE64 }}
MAVEN_SIGNING_PASSPHRASE: ${{ secrets.MAVEN_SIGNING_PASSPHRASE }}
MAVEN_CENTRAL_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
MAVEN_CENTRAL_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
snapshot:
if: ${{ github.event.inputs.SNAPSHOT == 'true' && github.event_name == 'workflow_dispatch' }}
uses: optimizely/android-sdk/.github/workflows/build.yml@master
with:
action: ship
travis_tag: BB-SNAPSHOT
secrets:
MAVEN_SIGNING_KEY_BASE64: ${{ secrets.MAVEN_SIGNING_KEY_BASE64 }}
MAVEN_SIGNING_PASSPHRASE: ${{ secrets.MAVEN_SIGNING_PASSPHRASE }}
MAVEN_CENTRAL_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
MAVEN_CENTRAL_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}