Skip to content

Commit

Permalink
Merge pull request #3272 from moodlehq/integration
Browse files Browse the repository at this point in the history
Integration
  • Loading branch information
jleyva authored Apr 22, 2022
2 parents 3937904 + a359cce commit 782d94f
Show file tree
Hide file tree
Showing 1,490 changed files with 87,888 additions and 36,441 deletions.
10 changes: 8 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ const appConfig = {
ignoreParameters: true,
},
],
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/no-non-null-assertion': 'warn',
'@typescript-eslint/no-redeclare': 'error',
'@typescript-eslint/no-this-alias': 'error',
'@typescript-eslint/no-unused-vars': 'error',
Expand All @@ -139,7 +139,6 @@ const appConfig = {
'always',
],
'@typescript-eslint/type-annotation-spacing': 'error',
'@typescript-eslint/unified-signatures': 'error',
'header/header': [
2,
'line',
Expand Down Expand Up @@ -235,6 +234,11 @@ const appConfig = {
prev: '*',
next: 'return',
},
{
blankLine: 'always',
prev: '*',
next: 'function',
},
],
'prefer-arrow/prefer-arrow-functions': [
'error',
Expand Down Expand Up @@ -271,6 +275,7 @@ testsConfig['rules']['padded-blocks'] = [
switches: 'never',
},
];
testsConfig['rules']['jest/expect-expect'] = 'off';
testsConfig['plugins'].push('jest');
testsConfig['extends'].push('plugin:jest/recommended');

Expand All @@ -291,6 +296,7 @@ module.exports = {
'@angular-eslint/template/no-positive-tabindex': 'error',
'@angular-eslint/template/accessibility-table-scope': 'error',
'@angular-eslint/template/accessibility-valid-aria': 'error',
'@angular-eslint/template/no-duplicate-attributes': 'error',
},
},
{
Expand Down
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
* text=auto
*.ts eol=lf
2 changes: 1 addition & 1 deletion .github/workflows/migration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
- name: Use Node.js
uses: actions/setup-node@v1
with:
node-version: '12.x'
node-version: '14.x'
- run: npm ci
- run: result=$(find src -type f -iname '*.html' -exec sh -c 'cat {} | tr "\n" " " | grep -Eo "class=\"[^\"]+\"[^>]+class=\"" ' \; | wc -l); test $result -eq 0
- run: npm install -D @ionic/v4-migration-tslint
Expand Down
63 changes: 63 additions & 0 deletions .github/workflows/performance.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Performance

on: [push, pull_request]

jobs:
performance:
runs-on: ubuntu-latest
env:
MOODLE_DOCKER_DB: pgsql
MOODLE_DOCKER_BROWSER: chrome
MOODLE_DOCKER_PHP_VERSION: 7.3
steps:
- uses: actions/checkout@v2
- id: nvmrc
uses: browniebroke/read-nvmrc-action@v1
- uses: actions/setup-node@v1
with:
node-version: '${{ steps.nvmrc.outputs.node_version }}'
- name: Additional checkouts
run: |
git clone --branch master --depth 1 https://github.com/moodle/moodle $GITHUB_WORKSPACE/moodle
git clone --branch integration --depth 1 https://github.com/moodlehq/moodle-local_moodlemobileapp $GITHUB_WORKSPACE/moodle/local/moodlemobileapp
git clone --branch master --depth 1 https://github.com/moodlehq/moodle-docker $GITHUB_WORKSPACE/moodle-docker
- name: Install npm packages
run: |
npm install -g npm@7
npm ci --no-audit
- name: Generate Behat tests plugin
run: |
export MOODLE_DOCKER_WWWROOT=$GITHUB_WORKSPACE/moodle
npx gulp behat
- name: Configure & launch Moodle with Docker
run: |
export MOODLE_DOCKER_WWWROOT=$GITHUB_WORKSPACE/moodle
cp $GITHUB_WORKSPACE/moodle-docker/config.docker-template.php $GITHUB_WORKSPACE/moodle/config.php
sed -i "59i\ 'capabilities' => [" $GITHUB_WORKSPACE/moodle/config.php
sed -i "60i\ 'extra_capabilities' => [" $GITHUB_WORKSPACE/moodle/config.php
sed -i "61i\ 'goog:loggingPrefs' => ['performance' => 'ALL']," $GITHUB_WORKSPACE/moodle/config.php
sed -i "62i\ 'chromeOptions' => ['perfLoggingPrefs' => ['traceCategories' => 'devtools.timeline']]," $GITHUB_WORKSPACE/moodle/config.php
sed -i "63i\ ]," $GITHUB_WORKSPACE/moodle/config.php
sed -i "64i\ ]," $GITHUB_WORKSPACE/moodle/config.php
sed -i "76i\$CFG->behat_ionic_wwwroot = 'http://moodleapp';" $GITHUB_WORKSPACE/moodle/config.php
$GITHUB_WORKSPACE/moodle-docker/bin/moodle-docker-compose pull
$GITHUB_WORKSPACE/moodle-docker/bin/moodle-docker-compose up -d
$GITHUB_WORKSPACE/moodle-docker/bin/moodle-docker-wait-for-db
- name: Compile & launch production app with Docker
run: |
docker build -t moodlehq/moodleapp:performance .
docker run -d --rm --name moodleapp moodlehq/moodleapp:performance
docker network connect moodle-docker_default moodleapp --alias moodleapp
- name: Init Behat
run: |
export MOODLE_DOCKER_WWWROOT=$GITHUB_WORKSPACE/moodle
$GITHUB_WORKSPACE/moodle-docker/bin/moodle-docker-compose exec -T webserver sh -c "php admin/tool/behat/cli/init.php"
- name: Run performance tests
run: |
export MOODLE_DOCKER_WWWROOT=$GITHUB_WORKSPACE/moodle
for i in {0..2}
do
$GITHUB_WORKSPACE/moodle-docker/bin/moodle-docker-compose exec -T webserver sh -c "php admin/tool/behat/cli/run.php --tags="@performance" --auto-rerun"
done
- name: Show performance results
run: node ./scripts/print-performance-measures.js $GITHUB_WORKSPACE/moodle/behatperformancemeasures/
12 changes: 7 additions & 5 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@ jobs:
- name: Use Node.js
uses: actions/setup-node@v1
with:
node-version: '12.x'
node-version: '14'
- name: Install npm packages
run: npm ci
run: |
npm install -g npm@7
npm ci --no-audit
- name: Check langindex
run: |
result=$(cat scripts/langindex.json | grep \"TBD\" | wc -l); test $result -eq 0
Expand Down Expand Up @@ -49,11 +51,11 @@ jobs:
echo "Found $found missing langkeys"
exit 1
fi
- name: Run Linter
run: npm run lint
- name: Run Linter (ignore warnings)
run: npm run lint -- --quiet
- name: Run tests
run: npm run test:ci
- name: Production builds
run: npm run build:prod
- name: JavaScript code compatibility
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
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
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v14.15.0
22 changes: 18 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
os: linux
dist: trusty
node_js: 12
node_js: 14

git:
depth: 3
Expand All @@ -18,12 +18,12 @@ cache:
- $HOME/.android/build-cache

before_install:
- nvm install 12
- nvm install
- npm install npm@^7 -g
- node --version
- npm --version
- nvm --version
- npm ci
- npm install npm@^6 -g

before_script:
- npx gulp
Expand All @@ -46,16 +46,30 @@ jobs:
- extra-google-google_play_services
- extra-google-m2repository
- extra-android-m2repository
before_install:
- nvm install
- npm install npm@^7 -g
- node --version
- npm --version
- nvm --version
- npm ci
- yes | sdkmanager "build-tools;30.0.3"
addons:
apt:
packages:
- libsecret-1-dev
- php5-cli
- php5-common
- stage: build
name: "Build iOS"
language: node_js
if: env(BUILD_IOS) = 1 AND (env(DEPLOY) = 1 OR (env(DEPLOY) = 2 AND tag IS NOT blank))
os: osx
osx_image: xcode12.5
osx_image: xcode13.1
addons:
homebrew:
packages:
- jq
- stage: test
name: "End to end tests (mod_forum and mod_messages)"
services:
Expand Down
5 changes: 5 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"recommendations": [
"dbaeumer.vscode-eslint"
]
}
19 changes: 19 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@
{

/**
* Formatting.
*/
"editor.defaultFormatter": "dbaeumer.vscode-eslint",
"[html]": {
"editor.defaultFormatter": "vscode.html-language-features",
},
"editor.formatOnSave": true,
"eslint.format.enable": true,
"html.format.endWithNewline": true,
"html.format.wrapLineLength": 140,
"files.eol": "\n",
"files.trimFinalNewlines": true,
"files.insertFinalNewline": true,
"files.trimTrailingWhitespace": true,

/**
* Config files.
*/
"files.associations": {
"moodle.config.json": "jsonc",
"moodle.config.*.json": "jsonc",
Expand Down
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ WORKDIR /app
# Prepare node dependencies
RUN apt-get update && apt-get install libsecret-1-0 -y
COPY package*.json ./
RUN npm ci
RUN npm install -g npm@7
RUN npm ci --no-audit

# Build source
ARG build_command="npm run build:prod"
Expand Down
19 changes: 6 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,15 @@
Moodle Mobile
Moodle App
=================

This is the primary repository of source code for the official Moodle Mobile app.
This is the primary repository of source code for the official mobile app for Moodle.

* [User documentation](http://docs.moodle.org/en/Moodle_Mobile)
* [Developer documentation](http://docs.moodle.org/dev/Moodle_Mobile)
* [Development environment setup](http://docs.moodle.org/dev/Setting_up_your_development_environment_for_Moodle_Mobile_2)
* [User documentation](https://docs.moodle.org/en/Moodle_app)
* [Developer documentation](http://docs.moodle.org/dev/Moodle_App)
* [Development environment setup](https://docs.moodle.org/dev/Setting_up_your_development_environment_for_the_Moodle_App)
* [Bug Tracker](https://tracker.moodle.org/browse/MOBILE)
* [Release Notes](http://docs.moodle.org/dev/Moodle_Mobile_Release_Notes)
* [Release Notes](https://docs.moodle.org/dev/Moodle_App_Release_Notes)

License
-------

[Apache 2.0](http://www.apache.org/licenses/LICENSE-2.0)

Big Thanks
-----------

Cross-browser Testing Platform and Open Source <3 Provided by [Sauce Labs](https://saucelabs.com)

![Sauce Labs Logo](https://user-images.githubusercontent.com/557037/43443976-d88d5a78-94a2-11e8-8915-9f06521423dd.png)
26 changes: 23 additions & 3 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,14 @@
"schematics": {},
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"builder": "@angular-builders/custom-webpack:browser",
"options": {
"customWebpackConfig": {
"path": "./webpack.config.js"
},
"allowedCommonJsDependencies":[
"chart.js"
],
"outputPath": "www",
"index": "src/index.html",
"main": "src/main.ts",
Expand Down Expand Up @@ -55,11 +61,25 @@
"budgets": [
{
"type": "initial",
"maximumWarning": "50mb",
"maximumError": "100mb"
"maximumWarning": "5mb",
"maximumError": "20mb"
}
]
},
"testing": {
"optimization": {
"scripts": false,
"styles": true
},
"outputHashing": "all",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"aot": true,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true
},
"ci": {
"progress": false
}
Expand Down
Loading

0 comments on commit 782d94f

Please sign in to comment.