Skip to content

Commit 4ed3108

Browse files
authored
Merge pull request #2233 from crazyserver/MOBILE-3170
MOBILE-3170 travis: Change repo names [ci skip]
2 parents ad85ded + 3cd05f1 commit 4ed3108

File tree

10 files changed

+48
-600
lines changed

10 files changed

+48
-600
lines changed

.travis.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
sudo: required
2-
dist: xenial
2+
dist: bionic
33
group: edge
44

55
language: node_js
@@ -19,8 +19,8 @@ before_script:
1919
- gulp
2020

2121
script:
22-
- npm run build
22+
- npm run build --bailOnLintError true --typeCheckOnLint true
2323

2424
after_success:
25-
- chmod +x scripts/aot.sh
26-
- scripts/aot.sh
25+
- scripts/ci.sh
26+

scripts/aot.sh

Lines changed: 35 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1,76 +1,47 @@
11
#!/bin/bash
2+
source "scripts/functions.sh"
3+
4+
print_title "NPM packages list"
25

36
# List first level of installed libraries so we can check the installed versions.
47
npm list --depth=0
58

6-
# Compile AOT.
7-
if [ $TRAVIS_BRANCH == 'integration' ] || [ $TRAVIS_BRANCH == 'master' ] || [ $TRAVIS_BRANCH == 'desktop' ] || [ $TRAVIS_BRANCH == 'security' ] || [ -z $TRAVIS_BRANCH ] ; then
9+
if [ "$TRAVIS_BRANCH" == 'master' ] && [ ! -z $GIT_TOKEN ] && [ "$TRAVIS_REPO_SLUG" == 'moodlehq/moodleapp' ]; then
10+
print_title "Update langpacks"
811
cd scripts
9-
./build_lang.sh
12+
./update_lang.sh
1013
cd ..
1114

12-
if [ "$TRAVIS_BRANCH" == 'master' ] && [ ! -z $GIT_TOKEN ] ; then
13-
git remote set-url origin https://$GIT_TOKEN@github.com/$TRAVIS_REPO_SLUG.git
14-
git fetch -q origin
15-
git add src/assets/lang
16-
git add */en.json
17-
git commit -m 'Update lang files [ci skip]'
18-
git push origin HEAD:$TRAVIS_BRANCH
19-
20-
version=`grep versionname src/config.json| cut -d: -f2|cut -d'"' -f2`
21-
date=`date +%Y%m%d`'00'
22-
23-
pushd ../moodle-local_moodlemobileapp
24-
sed -ie "s/release[ ]*=[ ]*'[^']*';/release = '$version';/1" version.php
25-
sed -ie "s/version[ ]*=[ ]*[0-9]*;/version = $date;/1" version.php
26-
rm version.phpe
27-
git remote set-url origin https://$GIT_TOKEN@github.com/moodlehq/moodle-local_moodlemobileapp.git
28-
git fetch -q origin
29-
git add .
30-
git commit -m "Update lang files from $version"
31-
git push
32-
popd
33-
fi
34-
35-
sed -ie $'s~throw new Error("No ResourceLoader.*~url = "templates/" + url;\\\nvar resolve;\\\nvar reject;\\\nvar promise = new Promise(function (res, rej) {\\\nresolve = res;\\\nreject = rej;\\\n});\\\nvar xhr = new XMLHttpRequest();\\\nxhr.open("GET", url, true);\\\nxhr.responseType = "text";\\\nxhr.onload = function () {\\\nvar response = xhr.response || xhr.responseText;\\\nvar status = xhr.status === 1223 ? 204 : xhr.status;\\\nif (status === 0) {\\\nstatus = response ? 200 : 0;\\\n}\\\nif (200 <= status \&\& status <= 300) {\\\nresolve(response);\\\n}\\\nelse {\\\nreject("Failed to load " + url);\\\n}\\\n};\\\nxhr.onerror = function () { reject("Failed to load " + url); };\\\nxhr.send();\\\nreturn promise;\\\n~g' node_modules/@angular/platform-browser-dynamic/esm5/platform-browser-dynamic.js
36-
sed -ie "s/context\.isProd || hasArg('--minifyJs')/hasArg('--minifyJs')/g" node_modules/@ionic/app-scripts/dist/util/config.js
37-
sed -ie "s/context\.isProd || hasArg('--optimizeJs')/hasArg('--optimizeJs')/g" node_modules/@ionic/app-scripts/dist/util/config.js
38-
npm run ionic:build -- --prod
15+
print_title "Update generated lang files"
16+
git remote set-url origin https://$GIT_TOKEN@github.com/$TRAVIS_REPO_SLUG.git
17+
git fetch -q origin
18+
git add -A src/assets/lang
19+
git add */en.json
20+
git add src/config.json
21+
git commit -m 'Update lang files [ci skip]'
22+
git push origin HEAD:$TRAVIS_BRANCH
3923
fi
4024

41-
# Copy to PGB git (only on a configured travis build).
42-
if [ ! -z $GIT_ORG ] && [ ! -z $GIT_TOKEN ] ; then
43-
gitfolder=${PWD##*/}
44-
git clone --depth 1 --no-single-branch https://github.com/$GIT_ORG/moodlemobile-phonegapbuild.git ../pgb
45-
pushd ../pgb
46-
47-
mkdir /tmp/travistemp
48-
cp .travis.yml /tmp/travistemp
49-
mkdir /tmp/travistemp/scripts
50-
cp scripts/* /tmp/travistemp/scripts
51-
52-
git checkout $TRAVIS_BRANCH
53-
54-
rm -Rf assets build index.html templates www destkop lib
55-
56-
if [ $TRAVIS_BRANCH == 'desktop' ] ; then
57-
cp -Rf ../$gitfolder/desktop ./
58-
cp -Rf ../$gitfolder/package.json ./
59-
cp -Rf ../$gitfolder/www ./
60-
rm -Rf www/assets/countries www/assets/mimetypes
61-
else
62-
cp -Rf ../$gitfolder/www/* ./
63-
rm -Rf assets/countries assets/mimetypes
25+
print_title "AOT Compilation"
26+
sed -ie $'s~throw new Error("No ResourceLoader.*~url = "templates/" + url;\\\nvar resolve;\\\nvar reject;\\\nvar promise = new Promise(function (res, rej) {\\\nresolve = res;\\\nreject = rej;\\\n});\\\nvar xhr = new XMLHttpRequest();\\\nxhr.open("GET", url, true);\\\nxhr.responseType = "text";\\\nxhr.onload = function () {\\\nvar response = xhr.response || xhr.responseText;\\\nvar status = xhr.status === 1223 ? 204 : xhr.status;\\\nif (status === 0) {\\\nstatus = response ? 200 : 0;\\\n}\\\nif (200 <= status \&\& status <= 300) {\\\nresolve(response);\\\n}\\\nelse {\\\nreject("Failed to load " + url);\\\n}\\\n};\\\nxhr.onerror = function () { reject("Failed to load " + url); };\\\nxhr.send();\\\nreturn promise;\\\n~g' node_modules/@angular/platform-browser-dynamic/esm5/platform-browser-dynamic.js
27+
sed -ie "s/context\.isProd || hasArg('--minifyJs')/hasArg('--minifyJs')/g" node_modules/@ionic/app-scripts/dist/util/config.js
28+
sed -ie "s/context\.isProd || hasArg('--optimizeJs')/hasArg('--optimizeJs')/g" node_modules/@ionic/app-scripts/dist/util/config.js
29+
npm run ionic:build -- --prod
30+
31+
32+
if [ $TRAVIS_BRANCH == 'integration' ] || [ $TRAVIS_BRANCH == 'master' ] || [ $TRAVIS_BRANCH == 'desktop' ] ; then
33+
if [ ! -z $GIT_ORG_PRIVATE ] && [ ! -z $GIT_TOKEN ] ; then
34+
if [ "$TRAVIS_REPO_SLUG" == 'moodlehq/moodleapp' ]; then
35+
print_title "Mirror repository"
36+
git remote add mirror https://$GIT_TOKEN@github.com/$GIT_ORG_PRIVATE/moodleapp.git
37+
git fetch -q mirror
38+
git push -f mirror HEAD:$TRAVIS_BRANCH
39+
git push mirror --tags
40+
else
41+
print_title "Run scripts"
42+
git clone --depth 1 https://$GIT_TOKEN@github.com/$GIT_ORG_PRIVATE/apps-scripts.git ../scripts
43+
cp ../scripts/build.sh scripts/
44+
./scripts/build.sh
45+
fi
6446
fi
65-
66-
cp /tmp/travistemp/.travis.yml .travis.yml
67-
mkdir scripts
68-
cp /tmp/travistemp/scripts/* scripts
69-
70-
71-
git add .
72-
git commit -m "Travis build: $TRAVIS_BUILD_NUMBER"
73-
git push https://$GIT_TOKEN@github.com/$GIT_ORG/moodlemobile-phonegapbuild.git
74-
popd
7547
fi
76-

scripts/ci.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/bash
2+
3+
if [ $TRAVIS_EVENT_TYPE == 'cron' ] ; then
4+
# Tests scripts.
5+
echo 'CRON NOT IMPLEMENTED YET'
6+
else
7+
./scripts/aot.sh
8+
fi

scripts/get_ws_changes.php

Lines changed: 0 additions & 99 deletions
This file was deleted.

scripts/get_ws_structure.php

Lines changed: 0 additions & 55 deletions
This file was deleted.

scripts/get_ws_ts.php

Lines changed: 0 additions & 62 deletions
This file was deleted.

0 commit comments

Comments
 (0)