Skip to content

Commit

Permalink
Merge branch 'trunk' into _9/UI/DataTable-Mobile
Browse files Browse the repository at this point in the history
  • Loading branch information
catenglaender authored Jul 17, 2023
2 parents 264d2cc + dc0f354 commit fdad83e
Show file tree
Hide file tree
Showing 1,256 changed files with 54,555 additions and 61,809 deletions.
59 changes: 56 additions & 3 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,59 @@
{
"extends": "airbnb-base",
"parserOptions": {
"ecmaVersion": 6
"ecmaVersion": "latest",
"sourceType": "module"
},
"extends": "airbnb-base"
}
// allow certain globals to be used without declaration.
"globals": {
// globals from the browser environment.
"document": "readonly",
"window": "readonly",
"il": "writable",
// globals from the mocha testing framework.
"beforeEach": "readonly",
"afterEach": "readonly",
"describe": "readonly",
"before": "readonly",
"after": "readonly",
"it": "readonly"
},
// minified and bundled scripts are exempt from the
// code-style.
"ignorePatterns": [
"**/dist/*",
"*.min.js"
],
"rules": {
// allow function hoisting as javascript code is
// compiled before execution.
"no-use-before-define": [
"error",
"nofunc"
],
// enforce camelcase for classes as well.
"camelcase": [
"error",
{
"properties": "always",
"ignoreDestructuring": false,
"ignoreGlobals": false
}
],
// allow anonymous functions for iife's and mocha.js.
"func-names": [
"warn",
"never"
],
// allow unresolved imports due to module-bundling
// and third-party libraries.
"import/no-unresolved": 0,
// allow import of devDependencies in test files.
"import/no-extraneous-dependencies": [
"error",
{
"devDependencies": true
}
]
}
}
18 changes: 16 additions & 2 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ jobs:
fail-fast: false
matrix:
php: [8.1, 8.2]
nodejs: [ 19.x ]
steps:
- name: Checkout code
uses: actions/checkout@v2
Expand All @@ -22,18 +23,31 @@ jobs:
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: dom, curl, libxml, mbstring, zip, gd, json, readline, xsl
extensions: dom, curl, libxml, mbstring, zip, gd, json, readline, xsl, imagick
tools: composer:v2
coverage: none

- name: Install dependencies
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.nodejs }}

- name: Install Composer packages
run: composer install --no-interaction --no-progress

- name: Install Node.js packages
run: npm install --ignore-scripts

- name: PHP Unit Test
run: CI/PHPUnit/run_tests.sh
env:
GHRUN: "yes"

- name: JS Unit Test
run: npm test
env:
GHRUN: "yes"

- name: PHP CS Fixer
run: CI/PHP-CS-Fixer/run_check.sh
env:
Expand Down
23 changes: 23 additions & 0 deletions .github/workflows/style-to-repo_trunk.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Build and deploy style files
on:
push:
branches:
- "trunk"

jobs:
style-to-repo:
if: |
github.event.pull_request.merged == true ||
github.event_name == 'push'
runs-on: ubuntu-latest
outputs:
all: ${{ steps.changes.outputs.all }}
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: build and deploy
run: CI/Style-To-Repo/build-and-deploy.sh
env:
STYLE_REPO_PUSH_SECRET: ${{ secrets.STYLE_REPO_PUSH_SECRET }}
STYLE_REPO_USER_NAME: ${{ vars.STYLE_REPO_USER_NAME }}
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
/extern
/Services/PHPUnit/config/cfg.phpunit.php
/nbproject
/templates/default/delos.css.map

# General Patterns
*.bak
Expand All @@ -20,6 +21,10 @@
*.swp
*.swo

# Core Components and Components From Other Vendors
/component/*
!/component/ILIAS

# Generated Files
/ilias.ini.php
/ilias.log
Expand Down
8 changes: 8 additions & 0 deletions .mocharc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"require": [
"@babel/register"
],
"spec": [
"tests"
]
}
6 changes: 0 additions & 6 deletions CI/Copyright-Checker/copyright-checker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -147,12 +147,6 @@ function perform_copyright_check() {

local exit_status=0
for file in ${files[@]}; do
# remove this theck once JavaScript files are properly
# supported as well (concept for minified scripts).
if [[ ${file} == *".js" ]]; then
continue
fi

# skip files which don't exist to take care of deleted
# files when provided by git.
if ! [ -f "${file}" ]; then
Expand Down
36 changes: 36 additions & 0 deletions CI/Copyright-Checker/copyright.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/**
* This file is part of ILIAS, a powerful learning management system
* published by ILIAS open source e-Learning e.V.
*
* ILIAS is licensed with the GPL-3.0,
* see https://www.gnu.org/licenses/gpl-3.0.en.html
* You should have received a copy of said license along with the
* source code, too.
*
* If this is not the case or you just want to try ILIAS, you'll find
* us at:
* https://www.ilias.de
* https://github.com/ILIAS-eLearning
*
* @author Thibeau Fuhrer <[email protected]>
*/

/**
* @type {string}
*/
const copyright = '/**\n'
+ ' * This file is part of ILIAS, a powerful learning management system\n'
+ ' * published by ILIAS open source e-Learning e.V.\n'
+ ' *\n'
+ ' * ILIAS is licensed with the GPL-3.0,\n'
+ ' * see https://www.gnu.org/licenses/gpl-3.0.en.html\n'
+ ' * You should have received a copy of said license along with the\n'
+ ' * source code, too.\n'
+ ' *\n'
+ " * If this is not the case or you just want to try ILIAS, you'll find\n"
+ ' * us at:\n'
+ ' * https://www.ilias.de\n'
+ ' * https://github.com/ILIAS-eLearning\n'
+ ' */';

export default copyright;
45 changes: 45 additions & 0 deletions CI/Copyright-Checker/preserveCopyright.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/**
* This file is part of ILIAS, a powerful learning management system
* published by ILIAS open source e-Learning e.V.
*
* ILIAS is licensed with the GPL-3.0,
* see https://www.gnu.org/licenses/gpl-3.0.en.html
* You should have received a copy of said license along with the
* source code, too.
*
* If this is not the case or you just want to try ILIAS, you'll find
* us at:
* https://www.ilias.de
* https://github.com/ILIAS-eLearning
*
* @author Thibeau Fuhrer <[email protected]>
*/

/**
* Function used by '@rollup/plugin-terser' to preserve only comments which
* contain a string indicating a copyright notice.
*
* Additionally, it only keeps ILIAS copyright notices if they are at the beginning
* of a file, so that the license is not duplicated in the bundled file (this works
* due to plugins being ran after the bundle is created).
*
* @param {Object} node
* @param {number} line
* @param {string} value
* @return {boolean}
*/
export default function preserveCopyright(node, { line, value }) {
const copyrightRegex = /(copyright|license|@preserve|@license|@cc_on)/i;
const iliasRegex = /(ilias)/i;

if (!copyrightRegex.test(value)) {
return false;
}

// keeps comments which are at the begining of a file.
if (iliasRegex.test(value)) {
return (line === 0 || line === 1);
}

return true;
}
1 change: 1 addition & 0 deletions CI/PHP-CS-Fixer/code-format.php_cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ return (new PhpCsFixer\Config())
'strict_param' => false,
'concat_space' => ['spacing' => 'one'],
'function_typehint_space' => true,
'function_declaration' => ['closure_fn_spacing' => 'none'],
'binary_operator_spaces' => ['default' => 'single_space'],
// 'types_spaces' => ['space' => 'single'],
])
Expand Down
32 changes: 32 additions & 0 deletions CI/Style-To-Repo/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Style to Repo

These scripts ensure that all style-relevant files are copied to a separate repository.
With each push/merge to the original repository, a commit is created when changes are
made to the style files, which is then pushed into the style repository.
This commit contains the original commit message, the commit hash and a URL to the corresponding commit.

## Steps to do

Please change the placeholder values of the variables in deploy.sh.

STYLE_REPO="https://github.com/foo/style_test.git"
STYLE_REPO_NAME_SHORT="foo/style_test.git"

### Add a token for an user with admin access to style repository

- open settings for the user on github
- click 'Developer settings/Personal access tokens/Tokens (classic)'
- click 'Generate new token (classic)'
- add a note for the token
- check repo
- click 'Generate token'
- copy the generated token for the next step

### Add a secret to the original repository on github

- open 'Settings' for the repo on github
- select 'Secrets/Actions' from left menu
- click on 'New repository secret'
- the name must be 'STYLE_REPO_NAME_SHORT'
- the secret is the token from the step before
- add the username of the user as variable "STYLE_REPO_USER_NAME"
53 changes: 53 additions & 0 deletions CI/Style-To-Repo/build-and-deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#!/bin/bash

# This file is part of ILIAS, a powerful learning management system
# published by ILIAS open source e-Learning e.V.
#
# ILIAS is licensed with the GPL-3.0,
# see https://www.gnu.org/licenses/gpl-3.0.en.html
# You should have received a copy of said license along with the
# source code, too.
#
# If this is not the case or you just want to try ILIAS, you'll find
# us at:
# https://www.ilias.de
# https://github.com/ILIAS-eLearning
#
# Build and deploy style specific files.

if [ -z ${STYLE_REPO_PUSH_SECRET} ]
then
echo "Please ensure you follow the steps in the 'README.md' and you deposit a 'STYLE_REPO_PUSH_SECRET"
exit
fi

if [ -z ${STYLE_REPO_USER_NAME} ]
then
echo "Please ensure you follow the steps in the 'README.md' and you deposit a 'STYLE_REPO_USER_NAME"
exit
fi

MSG=$(git show-branch --no-name HEAD)
HASH=$(git rev-parse HEAD)
URL="https://github.com/ILIAS-eLearning/ILIAS/commit/${HASH}"
BRANCH=$(git rev-parse --abbrev-ref HEAD)

source "./CI/Style-To-Repo/build.sh"
source "./CI/Style-To-Repo/deploy.sh"
source "./CI/Style-To-Repo/cleanup.sh"

NOW=$(date +'%d.%m.%Y %I:%M:%S')
echo "[${NOW}] Build style folder."
build

NOW=$(date +'%d.%m.%Y %I:%M:%S')
echo "[${NOW}] Deploy style folder."
deploy "${MSG}" "${HASH}" "${URL}" "${BRANCH}" "${STYLE_REPO_PUSH_SECRET}" "${STYLE_REPO_USER_NAME}"

NOW=$(date +'%d.%m.%Y %I:%M:%S')
echo "[${NOW}] Cleanup build and deploy artifacts."
removeBuildArtifacts
removeDeployArtifacts

NOW=$(date +'%d.%m.%Y %I:%M:%S')
echo "[${NOW}] Done"
Loading

0 comments on commit fdad83e

Please sign in to comment.