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:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- name: Use Node.js
|
|
|
|
uses: actions/setup-node@v1
|
|
|
|
with:
|
|
|
|
node-version: '12.x'
|
2021-05-13 10:13:26 +00:00
|
|
|
- name: Install npm packages
|
|
|
|
run: npm ci
|
|
|
|
- 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`
|
|
|
|
freemiumcount=`jq 'keys' src/assets/lang/en.json | grep "freemium." | wc -l | xargs`
|
|
|
|
allcount=$(($langcount - $freemiumcount))
|
|
|
|
langindexcount=`jq -r '. | length' scripts/langindex.json`
|
|
|
|
if [ $allcount -ne $langindexcount ]; then
|
|
|
|
echo "Lang file has $langcount ($freemiumcount) while langindex $langindexcount"
|
2021-05-13 10:13:26 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
langkeys=`jq -r 'keys[]' src/assets/lang/en.json`
|
|
|
|
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
|
|
|
|
- name: Run Linter
|
|
|
|
run: npm run lint
|
|
|
|
- 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
|