diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4a1eac8..f67eb5b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -76,3 +76,122 @@ jobs: - name: Output coverage to summary if: success() || failure() && steps.run-unit-tests.outcome == 'success' run: cat ./platform/reports/SummaryGithub.md >> $GITHUB_STEP_SUMMARY + + + build-mac: + runs-on: macos-latest + + steps: + - uses: actions/checkout@v4 + + - name: Setup node 18 + uses: actions/setup-node@v4 + with: + node-version: 18 + + - name: Install node dependencies + run: | + npm ci + npm install -g karma-cli + + - name: Setup safari driver + run: | + sudo safaridriver --enable + + - name: Build the education platform + id: build-platform + if: success() || failure() + run: npm run build --workspaces + + - name: Run the unit tests + id: run-unit-tests + if: success() || failure() && steps.build-platform.outcome == 'success' + run: npm test --workspaces -- --browsers SafariNative + + - name: Create test report + uses: dorny/test-reporter@v1 + if: success() || failure() && steps.run-unit-tests.outcome == 'success' + with: + name: Unit Test Results - mac + path: platform/reports/TESTS*.xml + reporter: java-junit + fail-on-error: true + + - name: Setup .NET Core - for coverage report # Required to execute ReportGenerator + uses: actions/setup-dotnet@v4 + if: success() || failure() && steps.run-unit-tests.outcome == 'success' + with: + dotnet-version: 8.x + dotnet-quality: 'ga' + + - name: Create coverage md report + uses: danielpalme/ReportGenerator-GitHub-Action@5.2.1 + if: success() || failure() && steps.run-unit-tests.outcome == 'success' + with: + reports: ./platform/reports/coverage-report.xml + targetdir: ./platform/reports/ + reporttypes: MarkdownSummaryGithub + + - name: Output coverage to summary + if: success() || failure() && steps.run-unit-tests.outcome == 'success' + run: cat ./platform/reports/SummaryGithub.md >> $GITHUB_STEP_SUMMARY + + + build-win: + runs-on: windows-latest + env: + EDGE_BIN: C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe + steps: + - uses: actions/checkout@v4 + + - name: Setup node 18 + uses: actions/setup-node@v4 + with: + node-version: 18 + + - name: Install node dependencies + run: | + npm ci + npm install -g karma-cli + + - name: Setup edge driver + run: | + choco install selenium-chromium-edge-driver + + - name: Build the education platform + id: build-platform + if: success() || failure() + run: npm run build --workspaces + + - name: Run the unit tests + id: run-unit-tests + if: success() || failure() && steps.build-platform.outcome == 'success' + run: npm test --workspaces -- --browsers EdgeHeadless + + - name: Create test report + uses: dorny/test-reporter@v1 + if: success() || failure() && steps.run-unit-tests.outcome == 'success' + with: + name: Unit Test Results - win + path: platform/reports/TESTS*.xml + reporter: java-junit + fail-on-error: true + + - name: Setup .NET Core - for coverage report # Required to execute ReportGenerator + uses: actions/setup-dotnet@v4 + if: success() || failure() && steps.run-unit-tests.outcome == 'success' + with: + dotnet-version: 8.x + dotnet-quality: 'ga' + + - name: Create coverage md report + uses: danielpalme/ReportGenerator-GitHub-Action@5.2.1 + if: success() || failure() && steps.run-unit-tests.outcome == 'success' + with: + reports: ./platform/reports/coverage-report.xml + targetdir: ./platform/reports/ + reporttypes: MarkdownSummaryGithub + + - name: Output coverage to summary + if: success() || failure() && steps.run-unit-tests.outcome == 'success' + run: Get-Content -Path ".\platform\reports\SummaryGithub.md" >> $Env:GITHUB_STEP_SUMMARY diff --git a/package-lock.json b/package-lock.json index 0eab295..b3ced76 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5041,6 +5041,21 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/is-docker": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-2.2.1.tgz", + "integrity": "sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ==", + "dev": true, + "bin": { + "is-docker": "cli.js" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/is-extglob": { "version": "2.1.1", "dev": true, @@ -5095,6 +5110,18 @@ "node": ">=0.10.0" } }, + "node_modules/is-wsl": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-2.2.0.tgz", + "integrity": "sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww==", + "dev": true, + "dependencies": { + "is-docker": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/isarray": { "version": "1.0.0", "license": "MIT" @@ -5452,6 +5479,40 @@ "node": ">=10.0.0" } }, + "node_modules/karma-edgium-launcher": { + "version": "4.0.0-0", + "resolved": "https://registry.npmjs.org/karma-edgium-launcher/-/karma-edgium-launcher-4.0.0-0.tgz", + "integrity": "sha512-zixTg4O7ogl43t15LKPO03Cns23sXZE0RjwT7oWAWSAgGQo+xERnx7xdPCtCBBGNBrgB2k+1dEVvFym/OA/pdQ==", + "dev": true, + "dependencies": { + "which": "^1.2.1" + } + }, + "node_modules/karma-firefox-launcher": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/karma-firefox-launcher/-/karma-firefox-launcher-2.1.3.tgz", + "integrity": "sha512-LMM2bseebLbYjODBOVt7TCPP9OI2vZIXCavIXhkO9m+10Uj5l7u/SKoeRmYx8FYHTVGZSpk6peX+3BMHC1WwNw==", + "dev": true, + "dependencies": { + "is-wsl": "^2.2.0", + "which": "^3.0.0" + } + }, + "node_modules/karma-firefox-launcher/node_modules/which": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/which/-/which-3.0.1.tgz", + "integrity": "sha512-XA1b62dzQzLfaEOSQFTCOd5KFf/1VSzZo7/7TUjnya6u0vGGKzU96UQBZTAThCb2j4/xjBAyii1OhRLJEivHvg==", + "dev": true, + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/which.js" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, "node_modules/karma-jasmine": { "version": "5.1.0", "dev": true, @@ -5496,6 +5557,15 @@ "karma": ">=0.9" } }, + "node_modules/karma-safarinative-launcher": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/karma-safarinative-launcher/-/karma-safarinative-launcher-1.1.0.tgz", + "integrity": "sha512-vdMjdQDHkSUbOZc8Zq2K5bBC0yJGFEgfrKRJTqt0Um0SC1Rt8drS2wcN6UA3h4LgsL3f1pMcmRSvKucbJE8Qdg==", + "dev": true, + "peerDependencies": { + "karma": ">=0.9" + } + }, "node_modules/karma-webpack": { "version": "5.0.0", "dev": true, @@ -7483,9 +7553,12 @@ "karma": "^6.4.1", "karma-chrome-launcher": "^3.1.1", "karma-coverage": "^2.2.1", + "karma-edgium-launcher": "^4.0.0-0", + "karma-firefox-launcher": "^2.1.3", "karma-jasmine": "^5.1.0", "karma-jasmine-html-reporter": "^2.0.0", "karma-junit-reporter": "^2.0.1", + "karma-safarinative-launcher": "^1.1.0", "karma-webpack": "^5.0.0", "webpack": "^5.90.3", "webpack-cli": "^5.1.1" @@ -10826,6 +10899,12 @@ "hasown": "^2.0.0" } }, + "is-docker": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-2.2.1.tgz", + "integrity": "sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ==", + "dev": true + }, "is-extglob": { "version": "2.1.1", "dev": true @@ -10856,6 +10935,15 @@ "isobject": "^3.0.1" } }, + "is-wsl": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-2.2.0.tgz", + "integrity": "sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww==", + "dev": true, + "requires": { + "is-docker": "^2.0.0" + } + }, "isarray": { "version": "1.0.0" }, @@ -11123,6 +11211,36 @@ "minimatch": "^3.0.4" } }, + "karma-edgium-launcher": { + "version": "4.0.0-0", + "resolved": "https://registry.npmjs.org/karma-edgium-launcher/-/karma-edgium-launcher-4.0.0-0.tgz", + "integrity": "sha512-zixTg4O7ogl43t15LKPO03Cns23sXZE0RjwT7oWAWSAgGQo+xERnx7xdPCtCBBGNBrgB2k+1dEVvFym/OA/pdQ==", + "dev": true, + "requires": { + "which": "^1.2.1" + } + }, + "karma-firefox-launcher": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/karma-firefox-launcher/-/karma-firefox-launcher-2.1.3.tgz", + "integrity": "sha512-LMM2bseebLbYjODBOVt7TCPP9OI2vZIXCavIXhkO9m+10Uj5l7u/SKoeRmYx8FYHTVGZSpk6peX+3BMHC1WwNw==", + "dev": true, + "requires": { + "is-wsl": "^2.2.0", + "which": "^3.0.0" + }, + "dependencies": { + "which": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/which/-/which-3.0.1.tgz", + "integrity": "sha512-XA1b62dzQzLfaEOSQFTCOd5KFf/1VSzZo7/7TUjnya6u0vGGKzU96UQBZTAThCb2j4/xjBAyii1OhRLJEivHvg==", + "dev": true, + "requires": { + "isexe": "^2.0.0" + } + } + } + }, "karma-jasmine": { "version": "5.1.0", "dev": true, @@ -11149,6 +11267,13 @@ "xmlbuilder": "12.0.0" } }, + "karma-safarinative-launcher": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/karma-safarinative-launcher/-/karma-safarinative-launcher-1.1.0.tgz", + "integrity": "sha512-vdMjdQDHkSUbOZc8Zq2K5bBC0yJGFEgfrKRJTqt0Um0SC1Rt8drS2wcN6UA3h4LgsL3f1pMcmRSvKucbJE8Qdg==", + "dev": true, + "requires": {} + }, "karma-webpack": { "version": "5.0.0", "dev": true, @@ -11296,15 +11421,18 @@ "eslint": "^8.56.0", "handlebars": "^4.7.7", "jasmine": "^4.5.0", - "jasmine-ajax": "*", + "jasmine-ajax": "^4.0.0", "jquery": "^3.6.0", "jszip": "^3.10.1", "karma": "^6.4.1", "karma-chrome-launcher": "^3.1.1", "karma-coverage": "^2.2.1", + "karma-edgium-launcher": "*", + "karma-firefox-launcher": "^2.1.3", "karma-jasmine": "^5.1.0", "karma-jasmine-html-reporter": "^2.0.0", "karma-junit-reporter": "^2.0.1", + "karma-safarinative-launcher": "^1.1.0", "karma-webpack": "^5.0.0", "metro4": "^4.5.1", "svg-pan-zoom": "^3.6.1", diff --git a/platform/karma.conf.js b/platform/karma.conf.js index 219a89c..c18e8d4 100644 --- a/platform/karma.conf.js +++ b/platform/karma.conf.js @@ -9,6 +9,9 @@ module.exports = function(config) { require('karma-coverage'), require('karma-jasmine'), require('karma-chrome-launcher'), + require("karma-firefox-launcher"), + require("karma-edgium-launcher"), + require("karma-safarinative-launcher"), require('karma-jasmine-html-reporter'), require('karma-junit-reporter') ], @@ -97,7 +100,7 @@ module.exports = function(config) { // start these browsers // available browser launchers: https://www.npmjs.com/search?q=keywords:karma-launcher - browsers: ['ChromeHeadless'], + browsers: ['ChromeHeadless','FirefoxHeadless'], // Continuous Integration mode diff --git a/platform/package.json b/platform/package.json index 276c4d7..9be5e3a 100644 --- a/platform/package.json +++ b/platform/package.json @@ -21,9 +21,12 @@ "karma": "^6.4.1", "karma-chrome-launcher": "^3.1.1", "karma-coverage": "^2.2.1", + "karma-edgium-launcher": "^4.0.0-0", + "karma-firefox-launcher": "^2.1.3", "karma-jasmine": "^5.1.0", "karma-jasmine-html-reporter": "^2.0.0", "karma-junit-reporter": "^2.0.1", + "karma-safarinative-launcher": "^1.1.0", "karma-webpack": "^5.0.0", "webpack": "^5.90.3", "webpack-cli": "^5.1.1"