Skip to content

Commit 898cfc9

Browse files
committed
MOBILE-3333 travis: Do not edit config.js on AOT
1 parent 67da1cd commit 898cfc9

File tree

3 files changed

+77
-86
lines changed

3 files changed

+77
-86
lines changed

.travis.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
sudo: required
1+
os: linux
22
dist: bionic
33
group: edge
44

@@ -23,4 +23,3 @@ script:
2323

2424
after_success:
2525
- scripts/ci.sh
26-

scripts/aot.sh

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

scripts/ci.sh

Lines changed: 76 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,81 @@
11
#!/bin/bash
2+
source "scripts/functions.sh"
23

3-
if [ $TRAVIS_EVENT_TYPE == 'cron' ] ; then
4+
if [ "$TRAVIS_EVENT_TYPE" == 'cron' ] ; then
45
# Tests scripts.
5-
echo 'CRON NOT IMPLEMENTED YET'
6+
print_error 'CRON NOT IMPLEMENTED YET'
67
else
7-
./scripts/aot.sh
8+
if [ -z $GIT_ORG_PRIVATE ] || [ -z $GIT_TOKEN ]; then
9+
print_error "Env vars not correctly defined"
10+
exit 1
11+
fi
12+
13+
# List first level of installed libraries so we can check the installed versions.
14+
print_title "NPM packages list"
15+
npm list --depth=0
16+
17+
if [ "$TRAVIS_REPO_SLUG" == 'moodlehq/moodleapp' ]; then
18+
if [ "$TRAVIS_BRANCH" == 'master' ]; then
19+
print_title "Update langpacks"
20+
cd scripts
21+
./update_lang.sh
22+
cd ..
23+
24+
print_title "Update generated lang files"
25+
git remote set-url origin https://$GIT_TOKEN@github.com/$TRAVIS_REPO_SLUG.git
26+
git fetch -q origin
27+
git add -A src/assets/lang
28+
git add */en.json
29+
git add src/config.json
30+
git commit -m 'Update lang files [ci skip]'
31+
32+
print_title "Update Licenses"
33+
npm install -g license-checker
34+
35+
jq --version
36+
license-checker --json --production --relativeLicensePath > licenses.json
37+
jq 'del(.[].path)' licenses.json > licenses_old.json
38+
mv licenses_old.json licenses.json
39+
licenses=`jq -r 'keys[]' licenses.json`
40+
echo "{" > licensesurl.json
41+
first=1
42+
for license in $licenses; do
43+
obj=`jq --arg lic $license '.[$lic]' licenses.json`
44+
licensePath=`echo $obj | jq -r '.licenseFile'`
45+
file=""
46+
if [[ ! -z "$licensePath" ]] || [[ "$licensePath" != "null" ]]; then
47+
file=$(basename $licensePath)
48+
if [ $first -eq 1 ] ; then
49+
first=0
50+
echo "\"$license\" : { \"licenseFile\" : \"$file\"}" >> licensesurl.json
51+
else
52+
echo ",\"$license\" : { \"licenseFile\" : \"$file\"}" >> licensesurl.json
53+
fi
54+
fi
55+
done
56+
echo "}" >> licensesurl.json
57+
58+
jq -s '.[0] * .[1]' licenses.json licensesurl.json > licenses_old.json
59+
mv licenses_old.json licenses.json
60+
rm licensesurl.json
61+
62+
git add licenses.json
63+
git commit -m 'Update licenses [ci skip]'
64+
65+
git push origin HEAD:$TRAVIS_BRANCH
66+
fi
67+
68+
if [ "$TRAVIS_BRANCH" == 'integration' ] || [ "$TRAVIS_BRANCH" == 'master' ] || [ "$TRAVIS_BRANCH" == 'desktop' ] ; then
69+
print_title "Mirror repository"
70+
git remote add mirror https://$GIT_TOKEN@github.com/$GIT_ORG_PRIVATE/moodleapp.git
71+
git fetch -q mirror
72+
git push -f mirror HEAD:$TRAVIS_BRANCH
73+
git push mirror --tags
74+
fi
75+
elif [ "$TRAVIS_REPO_SLUG" == "$GIT_ORG_PRIVATE/moodleapp" ]; then
76+
print_title "Run scripts"
77+
git clone --depth 1 https://$GIT_TOKEN@github.com/$GIT_ORG_PRIVATE/apps-scripts.git ../scripts
78+
cp ../scripts/build.sh scripts/
79+
./scripts/build.sh
80+
fi
881
fi

0 commit comments

Comments
 (0)