Skip to content

Commit 782d94f

Browse files
authored
Merge pull request #3272 from moodlehq/integration
Integration
2 parents 3937904 + a359cce commit 782d94f

File tree

1,490 files changed

+87888
-36441
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,490 files changed

+87888
-36441
lines changed

.eslintrc.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ const appConfig = {
126126
ignoreParameters: true,
127127
},
128128
],
129-
'@typescript-eslint/no-non-null-assertion': 'off',
129+
'@typescript-eslint/no-non-null-assertion': 'warn',
130130
'@typescript-eslint/no-redeclare': 'error',
131131
'@typescript-eslint/no-this-alias': 'error',
132132
'@typescript-eslint/no-unused-vars': 'error',
@@ -139,7 +139,6 @@ const appConfig = {
139139
'always',
140140
],
141141
'@typescript-eslint/type-annotation-spacing': 'error',
142-
'@typescript-eslint/unified-signatures': 'error',
143142
'header/header': [
144143
2,
145144
'line',
@@ -235,6 +234,11 @@ const appConfig = {
235234
prev: '*',
236235
next: 'return',
237236
},
237+
{
238+
blankLine: 'always',
239+
prev: '*',
240+
next: 'function',
241+
},
238242
],
239243
'prefer-arrow/prefer-arrow-functions': [
240244
'error',
@@ -271,6 +275,7 @@ testsConfig['rules']['padded-blocks'] = [
271275
switches: 'never',
272276
},
273277
];
278+
testsConfig['rules']['jest/expect-expect'] = 'off';
274279
testsConfig['plugins'].push('jest');
275280
testsConfig['extends'].push('plugin:jest/recommended');
276281

@@ -291,6 +296,7 @@ module.exports = {
291296
'@angular-eslint/template/no-positive-tabindex': 'error',
292297
'@angular-eslint/template/accessibility-table-scope': 'error',
293298
'@angular-eslint/template/accessibility-valid-aria': 'error',
299+
'@angular-eslint/template/no-duplicate-attributes': 'error',
294300
},
295301
},
296302
{

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
* text=auto
2+
*.ts eol=lf

.github/workflows/migration.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
- name: Use Node.js
1313
uses: actions/setup-node@v1
1414
with:
15-
node-version: '12.x'
15+
node-version: '14.x'
1616
- run: npm ci
1717
- run: result=$(find src -type f -iname '*.html' -exec sh -c 'cat {} | tr "\n" " " | grep -Eo "class=\"[^\"]+\"[^>]+class=\"" ' \; | wc -l); test $result -eq 0
1818
- run: npm install -D @ionic/v4-migration-tslint

.github/workflows/performance.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Performance
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
performance:
7+
runs-on: ubuntu-latest
8+
env:
9+
MOODLE_DOCKER_DB: pgsql
10+
MOODLE_DOCKER_BROWSER: chrome
11+
MOODLE_DOCKER_PHP_VERSION: 7.3
12+
steps:
13+
- uses: actions/checkout@v2
14+
- id: nvmrc
15+
uses: browniebroke/read-nvmrc-action@v1
16+
- uses: actions/setup-node@v1
17+
with:
18+
node-version: '${{ steps.nvmrc.outputs.node_version }}'
19+
- name: Additional checkouts
20+
run: |
21+
git clone --branch master --depth 1 https://github.com/moodle/moodle $GITHUB_WORKSPACE/moodle
22+
git clone --branch integration --depth 1 https://github.com/moodlehq/moodle-local_moodlemobileapp $GITHUB_WORKSPACE/moodle/local/moodlemobileapp
23+
git clone --branch master --depth 1 https://github.com/moodlehq/moodle-docker $GITHUB_WORKSPACE/moodle-docker
24+
- name: Install npm packages
25+
run: |
26+
npm install -g npm@7
27+
npm ci --no-audit
28+
- name: Generate Behat tests plugin
29+
run: |
30+
export MOODLE_DOCKER_WWWROOT=$GITHUB_WORKSPACE/moodle
31+
npx gulp behat
32+
- name: Configure & launch Moodle with Docker
33+
run: |
34+
export MOODLE_DOCKER_WWWROOT=$GITHUB_WORKSPACE/moodle
35+
cp $GITHUB_WORKSPACE/moodle-docker/config.docker-template.php $GITHUB_WORKSPACE/moodle/config.php
36+
sed -i "59i\ 'capabilities' => [" $GITHUB_WORKSPACE/moodle/config.php
37+
sed -i "60i\ 'extra_capabilities' => [" $GITHUB_WORKSPACE/moodle/config.php
38+
sed -i "61i\ 'goog:loggingPrefs' => ['performance' => 'ALL']," $GITHUB_WORKSPACE/moodle/config.php
39+
sed -i "62i\ 'chromeOptions' => ['perfLoggingPrefs' => ['traceCategories' => 'devtools.timeline']]," $GITHUB_WORKSPACE/moodle/config.php
40+
sed -i "63i\ ]," $GITHUB_WORKSPACE/moodle/config.php
41+
sed -i "64i\ ]," $GITHUB_WORKSPACE/moodle/config.php
42+
sed -i "76i\$CFG->behat_ionic_wwwroot = 'http://moodleapp';" $GITHUB_WORKSPACE/moodle/config.php
43+
$GITHUB_WORKSPACE/moodle-docker/bin/moodle-docker-compose pull
44+
$GITHUB_WORKSPACE/moodle-docker/bin/moodle-docker-compose up -d
45+
$GITHUB_WORKSPACE/moodle-docker/bin/moodle-docker-wait-for-db
46+
- name: Compile & launch production app with Docker
47+
run: |
48+
docker build -t moodlehq/moodleapp:performance .
49+
docker run -d --rm --name moodleapp moodlehq/moodleapp:performance
50+
docker network connect moodle-docker_default moodleapp --alias moodleapp
51+
- name: Init Behat
52+
run: |
53+
export MOODLE_DOCKER_WWWROOT=$GITHUB_WORKSPACE/moodle
54+
$GITHUB_WORKSPACE/moodle-docker/bin/moodle-docker-compose exec -T webserver sh -c "php admin/tool/behat/cli/init.php"
55+
- name: Run performance tests
56+
run: |
57+
export MOODLE_DOCKER_WWWROOT=$GITHUB_WORKSPACE/moodle
58+
for i in {0..2}
59+
do
60+
$GITHUB_WORKSPACE/moodle-docker/bin/moodle-docker-compose exec -T webserver sh -c "php admin/tool/behat/cli/run.php --tags="@performance" --auto-rerun"
61+
done
62+
- name: Show performance results
63+
run: node ./scripts/print-performance-measures.js $GITHUB_WORKSPACE/moodle/behatperformancemeasures/

.github/workflows/testing.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,11 @@ jobs:
1212
- name: Use Node.js
1313
uses: actions/setup-node@v1
1414
with:
15-
node-version: '12.x'
15+
node-version: '14'
1616
- name: Install npm packages
17-
run: npm ci
17+
run: |
18+
npm install -g npm@7
19+
npm ci --no-audit
1820
- name: Check langindex
1921
run: |
2022
result=$(cat scripts/langindex.json | grep \"TBD\" | wc -l); test $result -eq 0
@@ -49,11 +51,11 @@ jobs:
4951
echo "Found $found missing langkeys"
5052
exit 1
5153
fi
52-
- name: Run Linter
53-
run: npm run lint
54+
- name: Run Linter (ignore warnings)
55+
run: npm run lint -- --quiet
5456
- name: Run tests
5557
run: npm run test:ci
5658
- name: Production builds
5759
run: npm run build:prod
5860
- name: JavaScript code compatibility
59-
run: result=$(npx check-es-compat www/*.js 2> /dev/null | grep -v -E "Array\.prototype\.includes|Promise\.prototype\.finally|String\.prototype\.(matchAll|trimRight)|globalThis" | grep -Po "(?<=error).*?(?=\s+ecmascript)" | wc -l); test $result -eq 0
61+
run: result=$(npx check-es-compat www/*.js 2> /dev/null | grep -v -E "Array\.prototype\.includes|Promise\.prototype\.finally|String\.prototype\.(matchAll|trimRight)|globalThis" | grep -Po "(?<=error).*?(?=\s+ecmascript)" | wc -l); test $result -eq 1

.nvmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
v14.15.0

.travis.yml

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
os: linux
22
dist: trusty
3-
node_js: 12
3+
node_js: 14
44

55
git:
66
depth: 3
@@ -18,12 +18,12 @@ cache:
1818
- $HOME/.android/build-cache
1919

2020
before_install:
21-
- nvm install 12
21+
- nvm install
22+
- npm install npm@^7 -g
2223
- node --version
2324
- npm --version
2425
- nvm --version
2526
- npm ci
26-
- npm install npm@^6 -g
2727

2828
before_script:
2929
- npx gulp
@@ -46,16 +46,30 @@ jobs:
4646
- extra-google-google_play_services
4747
- extra-google-m2repository
4848
- extra-android-m2repository
49+
before_install:
50+
- nvm install
51+
- npm install npm@^7 -g
52+
- node --version
53+
- npm --version
54+
- nvm --version
55+
- npm ci
56+
- yes | sdkmanager "build-tools;30.0.3"
4957
addons:
5058
apt:
5159
packages:
5260
- libsecret-1-dev
61+
- php5-cli
62+
- php5-common
5363
- stage: build
5464
name: "Build iOS"
5565
language: node_js
5666
if: env(BUILD_IOS) = 1 AND (env(DEPLOY) = 1 OR (env(DEPLOY) = 2 AND tag IS NOT blank))
5767
os: osx
58-
osx_image: xcode12.5
68+
osx_image: xcode13.1
69+
addons:
70+
homebrew:
71+
packages:
72+
- jq
5973
- stage: test
6074
name: "End to end tests (mod_forum and mod_messages)"
6175
services:

.vscode/extensions.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"recommendations": [
3+
"dbaeumer.vscode-eslint"
4+
]
5+
}

.vscode/settings.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,24 @@
11
{
22

3+
/**
4+
* Formatting.
5+
*/
6+
"editor.defaultFormatter": "dbaeumer.vscode-eslint",
7+
"[html]": {
8+
"editor.defaultFormatter": "vscode.html-language-features",
9+
},
10+
"editor.formatOnSave": true,
11+
"eslint.format.enable": true,
12+
"html.format.endWithNewline": true,
13+
"html.format.wrapLineLength": 140,
14+
"files.eol": "\n",
15+
"files.trimFinalNewlines": true,
16+
"files.insertFinalNewline": true,
17+
"files.trimTrailingWhitespace": true,
18+
19+
/**
20+
* Config files.
21+
*/
322
"files.associations": {
423
"moodle.config.json": "jsonc",
524
"moodle.config.*.json": "jsonc",

Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ WORKDIR /app
66
# Prepare node dependencies
77
RUN apt-get update && apt-get install libsecret-1-0 -y
88
COPY package*.json ./
9-
RUN npm ci
9+
RUN npm install -g npm@7
10+
RUN npm ci --no-audit
1011

1112
# Build source
1213
ARG build_command="npm run build:prod"

0 commit comments

Comments
 (0)