From 238487f509400402632cfeb41fe329b435046773 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pau=20Ferrer=20Oca=C3=B1a?= Date: Tue, 29 Jan 2019 16:07:53 +0100 Subject: [PATCH] MOBILE-2846 desktop: Build desktop linux build from Travis --- .travis.yml | 15 +++++++++++---- package.json | 2 +- scripts/aot.sh | 13 +++++++++---- scripts/linux.sh | 34 ++++++++++++++++++++++++++++++++++ 4 files changed, 55 insertions(+), 9 deletions(-) create mode 100755 scripts/linux.sh diff --git a/.travis.yml b/.travis.yml index 25bb9edc0..cedbc149d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,16 +1,23 @@ sudo: required -dist: trusty +dist: xenial group: edge language: node_js -node_js: - - '8.10' +node_js: stable + +before_cache: + - rm -rf $HOME/.cache/electron-builder/wine + +cache: + directories: + - node_modules + - $HOME/.cache/electron + - $HOME/.cache/electron-builder before_script: - npm install -g @angular/cli - npm i npm@latest -g - gulp - - rm -Rf node_modules/electron-builder-squirrel-windows node_modules/electron-windows-notifications #Avoid electron fail script: - npm run build diff --git a/package.json b/package.json index 6116e057b..9150b17d9 100644 --- a/package.json +++ b/package.json @@ -35,7 +35,7 @@ "preionic:build": "gulp", "postionic:build": "gulp copy-component-templates", "desktop.pack": "electron-builder --dir", - "desktop.dist": "electron-builder", + "desktop.dist": "electron-builder -p never", "windows.store": "electron-windows-store --input-directory .\\desktop\\dist\\win-unpacked --output-directory .\\desktop\\store --flatten true -a .\\resources\\desktop -m .\\desktop\\assets\\windows\\AppXManifest.xml --package-version 0.0.0.0 --package-name MoodleDesktop" }, "dependencies": { diff --git a/scripts/aot.sh b/scripts/aot.sh index 5246a8010..f10a70790 100755 --- a/scripts/aot.sh +++ b/scripts/aot.sh @@ -1,7 +1,7 @@ #!/bin/bash # Compile AOT. -if [ $TRAVIS_BRANCH == 'integration' ] || [ $TRAVIS_BRANCH == 'master' ] || [ -z $TRAVIS_BRANCH ] ; then +if [ $TRAVIS_BRANCH == 'integration' ] || [ $TRAVIS_BRANCH == 'master' ] || [ $TRAVIS_BRANCH == 'desktop' ] || [ -z $TRAVIS_BRANCH ] ; then cd scripts ./build_lang.sh cd .. @@ -38,9 +38,8 @@ fi # Copy to PGB git (only on a configured travis build). if [ ! -z $GIT_ORG ] && [ ! -z $GIT_TOKEN ] ; then gitfolder=${PWD##*/} - cd .. - git clone --depth 1 --no-single-branch https://github.com/$GIT_ORG/moodlemobile-phonegapbuild.git pgb - cd pgb + git clone --depth 1 --no-single-branch https://github.com/$GIT_ORG/moodlemobile-phonegapbuild.git ../pgb + pushd ../pgb git checkout $TRAVIS_BRANCH rm -Rf assets build index.html templates cp -Rf ../$gitfolder/www/* ./ @@ -48,4 +47,10 @@ if [ ! -z $GIT_ORG ] && [ ! -z $GIT_TOKEN ] ; then git add . git commit -m "Travis build: $TRAVIS_BUILD_NUMBER" git push https://$GIT_TOKEN@github.com/$GIT_ORG/moodlemobile-phonegapbuild.git + popd fi + +if [ ! -z $GIT_ORG_PRIVATE ] && [ ! -z $GIT_TOKEN ] && [ $TRAVIS_BRANCH == 'desktop' ] && [ $TRAVIS_OS_NAME == 'linux' ]; then + ./scripts/linux.sh +fi + diff --git a/scripts/linux.sh b/scripts/linux.sh new file mode 100755 index 000000000..ef76cd0a5 --- /dev/null +++ b/scripts/linux.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# +# Script for generating the Desktop builds +# + +sudo apt-get install -y libnss3-dev + +npm install -g electron-builder electron + +electron-builder install-app-deps + +jq -s '.[0] + {"name": "moodledesktop"}' package.json > package_new.json +mv package_new.json package.json + +rm -Rf desktop/dist + +npm run desktop.dist -- -l --x64 --ia32 + +if [ ! -z $GIT_ORG_PRIVATE ] && [ ! -z $GIT_TOKEN ] ; then + git clone -q https://$GIT_TOKEN@github.com/moodlemobile/bma-apps-builds.git ../apps + + mv desktop/dist/*.AppImage ../apps + + cd ../apps + + chmod +x *.AppImage + mv *i386.AppImage linux-ia32.AppImage + mv Moodle*.AppImage linux-x64.AppImage + ls + + git add . + git commit -m "Linux desktop versions from Travis build $TRAVIS_BUILD_NUMBER" + git push +fi