2020-12-01 10:46:42 +00:00
name : Testing
on : [ push, pull_request]
jobs :
2021-02-25 11:02:08 +00:00
test :
2020-12-01 10:46:42 +00:00
runs-on : ubuntu-latest
steps :
2023-11-23 10:54:08 +00:00
- uses : actions/checkout@v4
- uses : actions/setup-node@v4
2020-12-01 10:46:42 +00:00
with :
2022-07-07 07:46:32 +00:00
node-version-file : '.nvmrc'
2021-05-13 10:13:26 +00:00
- name : Install npm packages
2023-07-05 08:43:57 +00:00
run : |
npm ci --no-audit
npm ci --no-audit --prefix cordova-plugin-moodleapp
2021-05-13 10:13:26 +00:00
- name : Check langindex
run : |
result=$(cat scripts/langindex.json | grep \"TBD\" | wc -l); test $result -eq 0
if [ $result -ne 0 ]; then
echo "There are lang strings to be decided on langindex.json"
exit 1
fi
gulp
2021-05-20 10:21:56 +00:00
langcount=`jq -r '. | length' src/assets/lang/en.json`
langindexcount=`jq -r '. | length' scripts/langindex.json`
2022-11-03 09:44:54 +00:00
if [ $langcount -ne $langindexcount ]; then
echo "Lang file has $langcount while langindex $langindexcount"
2021-05-13 10:13:26 +00:00
exit 1
fi
2022-11-03 09:44:54 +00:00
langkeys=`jq -r 'keys[]' src/assets/lang/en.json`
2021-05-13 10:13:26 +00:00
langindex=`jq -r 'keys[]' scripts/langindex.json`
found=0
for i in $langkeys; do
skip=
for j in $langindex; do
if [ "$i" == "$j" ]; then
skip=1
break;
fi
done
[ [ -n $skip ]] || { echo "$i key not found"; found=$(($found + 1)); }
done
if [ $found -ne 0 ]; then
echo "Found $found missing langkeys"
exit 1
fi
2023-07-05 08:43:57 +00:00
- name : Run Linters (ignore warnings)
run : |
npm run lint -- --quiet
npm run lint --prefix cordova-plugin-moodleapp
2021-05-13 10:13:26 +00:00
- name : Run tests
run : npm run test:ci
- name : Production builds
2023-07-05 08:43:57 +00:00
run : |
npm run build:prod
npm run prod --prefix cordova-plugin-moodleapp
2021-05-13 10:13:26 +00:00
- name : JavaScript code compatibility
2023-11-30 13:39:28 +00:00
run : |
2024-01-24 10:25:19 +00:00
npx check-es-compat www/*.js --polyfills="\{Array,String,TypedArray\}.prototype.at,Array.prototype.flatMap,Array.prototype.flat,Array.prototype.includes,globalThis,Object.fromEntries,Object.hasOwn,Promise.prototype.finally,String.prototype.matchAll,String.prototype.trimRight" | grep "No issues found. Files are compatible with the target runtimes."
2023-11-30 13:39:28 +00:00
npx check-es-compat cordova-plugin-moodleapp/www/*.js