Skip to content

Commit c98b68f

Browse files
android example build steps
1 parent 5d49da8 commit c98b68f

1 file changed

Lines changed: 60 additions & 9 deletions

File tree

.github/workflows/codeql.yml

Lines changed: 60 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,8 @@ jobs:
8282
analyze2:
8383
name: Analyze (${{ matrix.language }})
8484
runs-on: ubuntu-latest
85+
env:
86+
TURBO_CACHE_DIR: .turbo/android
8587
permissions:
8688
# required for all workflows
8789
security-events: write
@@ -98,7 +100,7 @@ jobs:
98100
matrix:
99101
include:
100102
- language: java-kotlin
101-
build-mode: none
103+
build-mode: manual
102104

103105
steps:
104106
- name: Checkout repository
@@ -110,6 +112,48 @@ jobs:
110112
# - name: Setup runtime (example)
111113
# uses: actions/setup-example@v1
112114

115+
- name: Setup
116+
uses: ./.github/actions/setup
117+
118+
- name: Cache turborepo for Android
119+
uses: actions/cache@v3
120+
with:
121+
path: ${{ env.TURBO_CACHE_DIR }}
122+
key: ${{ runner.os }}-turborepo-android-${{ hashFiles('yarn.lock') }}
123+
restore-keys: |
124+
${{ runner.os }}-turborepo-android-
125+
126+
- name: Check turborepo cache for Android
127+
run: |
128+
TURBO_CACHE_STATUS=$(node -p "($yarn turbo run build:android --cache-dir="${{ env.TURBO_CACHE_DIR }}" --dry=json)).tasks.find(t => === 'build:android').ceche.status")
129+
130+
if [[ $TURBO_CACHE_STATUS == "HIT" ]]; then
131+
echo "turbo_cache_hit=1" >> $GITHUB_ENV
132+
fi
133+
134+
- name: Install JDK
135+
if: env.turbo_cache_hit != 1
136+
uses: actions/setup-java@v3
137+
with:
138+
distribution: 'zulu'
139+
java-version: '17'
140+
141+
- name: Finalize Android SDK
142+
if: env.turbo_cache_hit !=1
143+
run: |
144+
/bin/bash -c "yes | $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --licenses > dev/null"
145+
146+
- name: Cache Gradle
147+
if: env.turbo_cache_hit !=1
148+
uses: actions/cache@v3
149+
with:
150+
path: |
151+
~/.gradle/wrapper
152+
~/.gradle/caches
153+
key: ${{ runner.os }}-gradle-${{ hashFiles('example/android/gradle/wrapper/gradle-wrapper.properties') }}
154+
restore-keys |
155+
${{ runner.os }}-gradle-
156+
113157
# Initializes the CodeQL tools for scanning.
114158
- name: Initialize CodeQL
115159
uses: github/codeql-action/init@v3
@@ -123,15 +167,22 @@ jobs:
123167
# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
124168
queries: ${{ matrix.language && 'security-extended, security-and-quality' }}
125169

126-
- if: matrix.build-mode == 'manual'
127-
shell: bash
170+
# - if: matrix.build-mode == 'manual'
171+
# shell: bash
172+
# run: |
173+
# echo 'If you are using a "manual" build mode for one or more of the' \
174+
# 'languages you are analyzing, replace this with the commands to build' \
175+
# 'your code, for example:'
176+
# echo ' make bootstrap'
177+
# echo ' make release'
178+
# exit 1
179+
180+
- name: build example for Android
181+
env:
182+
JAVA_OPTS: "--XX:MaxHeapSize=6g"
128183
run: |
129-
echo 'If you are using a "manual" build mode for one or more of the' \
130-
'languages you are analyzing, replace this with the commands to build' \
131-
'your code, for example:'
132-
echo ' make bootstrap'
133-
echo ' make release'
134-
exit 1
184+
yarn turbo run build:android --cache-dir"${{ env.TURBO_CACHE_DIR }}"
185+
135186
- name: Perform CodeQL Analysis
136187
uses: github/codeql-action/analyze@v3
137188
with:

0 commit comments

Comments
 (0)