From 8c2413676183299ae804b0415ba34e82e70b848d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pau=20Ferrer=20Oca=C3=B1a?= Date: Thu, 25 Feb 2021 15:44:00 +0100 Subject: [PATCH] MOBILE-3708 travis: Add Android build --- .travis.yml | 51 ++++++++++++++++++++++++++++++++++---- scripts/build.sh | 24 ++++++++++++++++++ scripts/moodle_to_json.php | 2 +- 3 files changed, 71 insertions(+), 6 deletions(-) create mode 100755 scripts/build.sh diff --git a/.travis.yml b/.travis.yml index 64da6f723..2c4332569 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,48 @@ -language: node_js +os: linux +dist: trusty +language: android node_js: 12 -cache: npm + +if: env(DEPLOY) = 1 + +git: + depth: 3 + +android: + components: + - tools + - platform-tools + - build-tools-29.0.3 + - android-28 + - extra-google-google_play_services + - extra-google-m2repository + - extra-android-m2repository + +before_cache: + - rm -rf $HOME/.cache/electron-builder/wine + - rm -f $HOME/.gradle/caches/modules-2/modules-2.lock + - rm -fr $HOME/.gradle/caches/*/plugin-resolution/ + +cache: + npm: true + directories: + - $HOME/.npm + - $HOME/.cache/electron + - $HOME/.cache/electron-builder + - $HOME/.gradle/caches/ + - $HOME/.gradle/wrapper/ + - $HOME/.android/build-cache + +before_install: + - nvm install 12 + - node --version + - npm --version + - nvm --version + - npm ci + - npm install npm@^6 gulp -g + +before_script: + - gulp + script: - - npm run lint - - npm run test:ci - - npm run build:prod + - scripts/build.sh diff --git a/scripts/build.sh b/scripts/build.sh new file mode 100755 index 000000000..1eaa1f96a --- /dev/null +++ b/scripts/build.sh @@ -0,0 +1,24 @@ +#!/bin/bash +source "scripts/functions.sh" + +if [ -z $GIT_TOKEN ]; then + print_error "Env vars not correctly defined" + exit 1 +fi + +print_title "Run scripts" +# TODO Change branch name. +git clone --depth 1 --single-branch --branch ionic5 https://$GIT_TOKEN@github.com/moodlemobile/apps-scripts.git ../scripts +cp ../scripts/*.sh scripts/ + +if [ ! -f scripts/platform.sh ]; then + print_error "Platform file not found" + exit 1 +fi + +print_title 'Platform Build' +./scripts/platform.sh + +if [ $? -ne 0 ]; then + exit 1 +fi diff --git a/scripts/moodle_to_json.php b/scripts/moodle_to_json.php index f8fafba28..610630f27 100644 --- a/scripts/moodle_to_json.php +++ b/scripts/moodle_to_json.php @@ -25,7 +25,7 @@ if (isset($_SERVER['REMOTE_ADDR'])) { define('MOODLE_INTERNAL', 1); define('LANGPACKSFOLDER', '../../moodle-langpacks'); define('ASSETSPATH', '../src/assets/lang/'); -define('CONFIG', '../config/config.json'); +define('CONFIG', '../moodle.config.json'); define('OVERRIDE_LANG_SUFIX', false); global $strings;