Skip to content
This repository was archived by the owner on Mar 5, 2023. It is now read-only.

Commit 9fa0a94

Browse files
nullkillerAndrii Danylchenko
authored and
Andrii Danylchenko
committed
fix CI build
1 parent a9f799a commit 9fa0a94

File tree

4 files changed

+101
-13
lines changed

4 files changed

+101
-13
lines changed

.github/CI/vcmiconf.json.in

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"ndkRoot" : "$NDK_ROOT",
99
"sdkRoot" : "$SDK_ROOT",
1010
"javaRoot": "$JAVA_HOME",
11-
"abis" : "arm64-v8a x86 x86_64 armeabi-v7a",
11+
"abis" : "arm64-v8a armeabi-v7a",
1212
"boostFolderName" : "boost_1_68_0",
1313
"androidApi" : 21,
1414
"cmakeBuildMode" : "Release"

.github/workflows/github.yml

+11-9
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ jobs:
2121
- uses: actions/checkout@v2
2222
with:
2323
submodules: recursive
24+
fetch-depth: 0
2425

2526
- name: Update VCMI Sources
2627
run: |
@@ -47,14 +48,15 @@ jobs:
4748
chmod +x ./project/gradlew
4849
python ./.github/CI/create_conf.py
4950
python ./update_internal_assets.py
51+
python ./build.py fixpaths
5052
cd ./project
51-
./gradlew vcmi-app:assembleVcmiOnlyRelease --info
53+
./gradlew vcmi-app:assembleAllTargetsRelease --info
5254
5355
- name: Artifacts
5456
uses: actions/upload-artifact@v2
5557
with:
5658
name: vcmi.apk
57-
path: ${{github.workspace}}/project/vcmi-app/build/outputs/apk/VcmiOnly/release/vcmi-app-debug.apk
59+
path: ${{github.workspace}}/project/vcmi-app/build/outputs/apk/AllTargets/release/vcmi-app-release.apk
5860

5961
# - name: Upload build
6062
# run: |
@@ -64,10 +66,10 @@ jobs:
6466
# DEPLOY_RSA: ${{ secrets.DEPLOY_RSA }}
6567
# PACKAGE_EXTENSION: apk
6668
#
67-
# - uses: act10ns/slack@v1
68-
# with:
69-
# status: ${{ job.status }}
70-
# channel: '#notifications'
71-
# env:
72-
# SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
73-
# if: always()
69+
- uses: act10ns/slack@v1
70+
with:
71+
status: ${{ job.status }}
72+
channel: '#notifications'
73+
env:
74+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
75+
if: always()

project/vcmi-app/build.gradle

+88-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ android {
66
compileSdk 31
77

88
defaultConfig {
9-
applicationId "eu.vcmi.vcmi"
9+
applicationId "is.xyz.vcmi"
1010
minSdk 21
1111
targetSdk 31
1212
versionCode 1
@@ -26,10 +26,17 @@ android {
2626
abiFilters.addAll(VCMI_ABIS)
2727
}
2828
}
29+
30+
signingConfigs {
31+
releaseSigning
32+
LoadSigningConfig(PROJECT_PATH_BASE)
33+
}
2934

3035
buildTypes {
3136
release {
3237
minifyEnabled false
38+
zipAlignEnabled true
39+
signingConfig signingConfigs.releaseSigning
3340
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
3441
}
3542
}
@@ -101,6 +108,86 @@ android {
101108
}
102109
}
103110

111+
def RenameOutput(final baseName, final variant) {
112+
final def apkPath = variant.outputs[0].outputFile.parent
113+
final def travisId = System.getenv("TRAVIS_JOB_ID")
114+
ResolveGitInfo()
115+
def name = baseName + "-" + ext.gitInfoLauncher + "-" + ext.gitInfoVcmi
116+
117+
if (travisId != null && !travisId.isEmpty()) {
118+
name = travisId + "-" + name
119+
}
120+
121+
if (!variant.buildType.name != "release") {
122+
name += "-" + variant.buildType.name
123+
}
124+
125+
variant.outputs*.outputFile = new File(apkPath, name + ".apk")
126+
}
127+
128+
def CommandOutput(final cmd, final arguments, final cwd) {
129+
try {
130+
new ByteArrayOutputStream().withStream { final os ->
131+
exec {
132+
executable cmd
133+
args arguments
134+
workingDir cwd
135+
standardOutput os
136+
}
137+
return os.toString().trim()
138+
}
139+
}
140+
catch (final Exception ex) {
141+
print("Broken: " + cmd + " " + arguments + " in " + cwd + " :: " + ex.toString())
142+
return ""
143+
}
144+
}
145+
146+
def ResolveGitInfo() {
147+
if (ext.gitInfoLauncher != "none" && ext.gitInfoVcmi != "none") {
148+
return
149+
}
150+
ext.gitInfoLauncher = CommandOutput("git", ["describe", "--match=", "--always", "--abbrev=7"], PROJECT_PATH_BASE)
151+
ext.gitInfoVcmi =
152+
CommandOutput("git", ["rev-parse", "--abbrev-ref", "HEAD"], PROJECT_PATH_BASE + "/ext/vcmi").replaceAll("[^a-zA-Z0-9\\-_]", "_") +
153+
"-" +
154+
CommandOutput("git", ["describe", "--match=", "--always", "--abbrev=7"], PROJECT_PATH_BASE + "/ext/vcmi")
155+
}
156+
157+
def SigningPropertiesPath(final basePath) {
158+
return file(basePath + "/.github/CI/signing.properties")
159+
}
160+
161+
def SigningKeystorePath(final basePath, final keystoreFileName) {
162+
return file(basePath + "/.github/CI/" + keystoreFileName)
163+
}
164+
165+
def LoadSigningConfig(final basePath) {
166+
final def props = new Properties()
167+
final def propFile = SigningPropertiesPath(basePath)
168+
if (propFile.canRead()) {
169+
props.load(new FileInputStream(propFile))
170+
171+
if (props != null
172+
&& props.containsKey('STORE_FILE')
173+
&& props.containsKey('STORE_PASSWORD')
174+
&& props.containsKey('KEY_ALIAS')
175+
&& props.containsKey('KEY_PASSWORD')) {
176+
177+
android.signingConfigs.releaseSigning.storeFile = SigningKeystorePath(basePath, props['STORE_FILE'])
178+
android.signingConfigs.releaseSigning.storePassword = props['STORE_PASSWORD']
179+
android.signingConfigs.releaseSigning.keyAlias = props['KEY_ALIAS']
180+
android.signingConfigs.releaseSigning.keyPassword = props['KEY_PASSWORD']
181+
} else {
182+
println("Some props from signing file are missing")
183+
android.buildTypes.release.signingConfig = null
184+
}
185+
} else {
186+
println("file with signing properties is missing")
187+
android.buildTypes.release.signingConfig = null
188+
}
189+
}
190+
104191
dependencies {
105192
implementation 'androidx.appcompat:appcompat:1.2.0'
106193
implementation 'com.google.android.material:material:1.3.0'

vcmiconf.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ def updateProjectProps():
88

99
def createLocalProps():
1010
vcmiutil.rewriteFile("./project/local.properties",
11-
"sdk.dir=" + config["sdkRoot"].replace(":", "\\:")
12-
+ "\nndk.dir=" + config["ndkRoot"].replace(":", "\\:"))
11+
"sdk.dir=" + config["sdkRoot"].replace(":", "\\:"))
1312

1413
config = []
1514
with open("./vcmiconf.json", "r") as confFile:

0 commit comments

Comments
 (0)