mirror of
https://gitlab.com/PronounsPage/PronounsPage.git
synced 2025-09-23 04:34:15 -04:00
(ci) put all checks into a single job
a large time is spend on install dependencies and even a (working) cache does not help much to reduce times as we will be using a single executor in mid-term perspective, this would be the fastest approach the CI dependencies are now included into package.json and yarn.lock to enable the check --frozen-lockfile
This commit is contained in:
parent
af2918562a
commit
87fa99a8d5
122
.gitlab-ci.yml
122
.gitlab-ci.yml
@ -1,51 +1,68 @@
|
|||||||
image: node:latest
|
check:
|
||||||
|
|
||||||
lint:
|
|
||||||
stage: test
|
stage: test
|
||||||
|
image: node:latest
|
||||||
|
before_script:
|
||||||
|
- export NODE_ENV=development
|
||||||
|
- >
|
||||||
|
start_section () {
|
||||||
|
current_section=$1;
|
||||||
|
echo -e "\e[0Ksection_start:`date +%s`:${current_section//[^a-zA-Z0-9]/-}\r\e[0K$current_section";
|
||||||
|
};
|
||||||
|
end_section () {
|
||||||
|
echo -e "\e[0Ksection_end:`date +%s`:${current_section//[^a-zA-Z0-9]/-}\r\e[0K";
|
||||||
|
};
|
||||||
|
failures=();
|
||||||
|
record_failure () {
|
||||||
|
exit_code=$?;
|
||||||
|
name=${1:-$current_section};
|
||||||
|
echo -e "\033[0;31m$name failed with exit code $exit_code\033[0m"; failures+=("$name");
|
||||||
|
};
|
||||||
script:
|
script:
|
||||||
- set -o pipefail
|
- start_section "Install Dependencies"
|
||||||
|
# temporarily replace FontAwesomePro dependency with its fake version as the CI can’t access it
|
||||||
- echo -e "\e[0Ksection_start:`date +%s`:prepare_dependencies\r\e[0KPrepare Dependencies"
|
# the name needs to be changed in both package.json and yarn.lock
|
||||||
- 'sed -i ''s/git+ssh:\/\/git@gitlab.com:Avris\/FontAwesomePro.git/git+https:\/\/git@gitlab.com\/Avris\/FakeFontAwesomePro.git/'' package.json'
|
- 'sed -i "s/git+ssh:\/\/git@gitlab.com:Avris\/FontAwesomePro.git/git+https:\/\/gitlab.com\/Avris\/FakeFontAwesomePro.git/" package.json yarn.lock'
|
||||||
- 'sed -i ''/"devDependencies"/a "eslint-formatter-gitlab": "*",'' package.json'
|
# the referenced SHA needs to be additionally changed in yarn.lock
|
||||||
- echo -e "\e[0Ksection_end:`date +%s`:prepare_dependencies\r\e[0K"
|
- 'sed -i "s/f00db606f659dca78b143b7bcab5671b2cb459a8/0d322c775cbe9bf99da261700be30251291b51a8/" yarn.lock'
|
||||||
|
- yarn install --frozen-lockfile || record_failure
|
||||||
- make switch LANG=en
|
|
||||||
|
|
||||||
- echo -e "\e[0Ksection_start:`date +%s`:install_dependencies\r\e[0KInstall Dependencies"
|
|
||||||
- yarn install --immutable --immutable-cache --check-cache --cache-folder .yarn
|
|
||||||
- echo -e "\e[0Ksection_end:`date +%s`:install_dependencies\r\e[0K"
|
|
||||||
|
|
||||||
- echo -e "\e[0Ksection_start:`date +%s`:reset_dependencies\r\e[0KReset Dependencies"
|
|
||||||
- git restore package.json yarn.lock
|
- git restore package.json yarn.lock
|
||||||
- echo -e "\e[0Ksection_end:`date +%s`:reset_dependencies\r\e[0K"
|
- end_section
|
||||||
|
|
||||||
- echo -e "\e[0Ksection_start:`date +%s`:check_lints\r\e[0KCheck linting rules"
|
|
||||||
- yarn lint --format gitlab --color --fix --quiet
|
|
||||||
- echo -e "\e[0Ksection_end:`date +%s`:check_lints\r\e[0K"
|
|
||||||
|
|
||||||
- echo -e "\e[0Ksection_start:`date +%s`:check_fixable\r\e[0KCheck for fixable problems"
|
|
||||||
- git diff --stat --exit-code
|
|
||||||
- echo -e "\e[0Ksection_end:`date +%s`:check_fixable\r\e[0K"
|
|
||||||
artifacts:
|
|
||||||
reports:
|
|
||||||
codequality: gl-codequality.json
|
|
||||||
|
|
||||||
unit-tests:
|
|
||||||
stage: test
|
|
||||||
script:
|
|
||||||
- echo -e "\e[0Ksection_start:`date +%s`:prepare_dependencies\r\e[0KPrepare Dependencies"
|
|
||||||
- 'sed -i ''s/git+ssh:\/\/git@gitlab.com:Avris\/FontAwesomePro.git/git+https:\/\/git@gitlab.com\/Avris\/FakeFontAwesomePro.git/'' package.json'
|
|
||||||
- 'sed -i ''/"devDependencies"/a "jest-junit": "*",'' package.json'
|
|
||||||
- echo -e "\e[0Ksection_end:`date +%s`:prepare_dependencies\r\e[0K"
|
|
||||||
|
|
||||||
- make switch LANG=en
|
- make switch LANG=en
|
||||||
|
|
||||||
- echo -e "\e[0Ksection_start:`date +%s`:install_dependencies\r\e[0KInstall Dependencies"
|
- start_section "Unit Tests"
|
||||||
- yarn install --immutable --immutable-cache --check-cache --cache-folder .yarn
|
- >
|
||||||
- echo -e "\e[0Ksection_end:`date +%s`:install_dependencies\r\e[0K"
|
yarn test --ci --reporters=default --reporters=jest-junit
|
||||||
|
--coverage --collect-coverage-from="./{plugins,server,src,store}/**"
|
||||||
|
--coverage-reporters=text --coverage-reporters=cobertura || record_failure
|
||||||
|
- end_section
|
||||||
|
|
||||||
- yarn test --ci --reporters=default --reporters=jest-junit --coverage --collect-coverage-from="./{plugins,server,src,store}/**" --coverage-reporters=text --coverage-reporters=cobertura
|
- start_section "Check linting rules"
|
||||||
|
- yarn lint --format gitlab --color --fix --quiet || record_failure
|
||||||
|
- end_section
|
||||||
|
|
||||||
|
- start_section "Check for fixable problems"
|
||||||
|
- git diff --stat --exit-code || record_failure
|
||||||
|
- end_section
|
||||||
|
|
||||||
|
# calls scripts to check for simple issues while disabling actual work (e.g. no publishing to third party)
|
||||||
|
# some scripts are left out because they need special configuration or are not safe to smoke test
|
||||||
|
- start_section "Smoke test server scripts"
|
||||||
|
- node server/migrate.js || record_failure "Smoke test migrate"
|
||||||
|
- node server/calendarBot.js en,pl,es,pt,de,nl,fr,ja,ru,sv,lad,ua,vi "" || record_failure "Smoke test calendarBot"
|
||||||
|
- node server/cleanupAccounts.js || record_failure "Smoke test cleanupAccounts"
|
||||||
|
- node server/notify.js || record_failure "Smoke test notify"
|
||||||
|
- node server/stats.js || record_failure "Smoke test stats"
|
||||||
|
- node server/subscriptions.js || record_failure "Smoke test subscriptions"
|
||||||
|
- end_section
|
||||||
|
|
||||||
|
- >
|
||||||
|
if [[ ${failures[@]} ]]; then
|
||||||
|
echo -e "\033[0;31mSome checks have failed:";
|
||||||
|
printf -- "- %s\n" "${failures[@]}";
|
||||||
|
echo -en "\033[0m";
|
||||||
|
false;
|
||||||
|
fi
|
||||||
coverage: /All files[^|]*\|[^|]*\s+([\d\.]+)/
|
coverage: /All files[^|]*\|[^|]*\s+([\d\.]+)/
|
||||||
artifacts:
|
artifacts:
|
||||||
reports:
|
reports:
|
||||||
@ -53,25 +70,4 @@ unit-tests:
|
|||||||
coverage_report:
|
coverage_report:
|
||||||
coverage_format: cobertura
|
coverage_format: cobertura
|
||||||
path: coverage/cobertura-coverage.xml
|
path: coverage/cobertura-coverage.xml
|
||||||
|
codequality: gl-codequality.json
|
||||||
server-scripts-smoke-test:
|
|
||||||
stage: test
|
|
||||||
script:
|
|
||||||
- echo -e "\e[0Ksection_start:`date +%s`:prepare_dependencies\r\e[0KPrepare Dependencies"
|
|
||||||
- 'sed -i ''s/git+ssh:\/\/git@gitlab.com:Avris\/FontAwesomePro.git/git+https:\/\/git@gitlab.com\/Avris\/FakeFontAwesomePro.git/'' package.json'
|
|
||||||
- echo -e "\e[0Ksection_end:`date +%s`:prepare_dependencies\r\e[0K"
|
|
||||||
|
|
||||||
- make switch LANG=en
|
|
||||||
|
|
||||||
- echo -e "\e[0Ksection_start:`date +%s`:install_dependencies\r\e[0KInstall Dependencies"
|
|
||||||
- yarn install --immutable --immutable-cache --check-cache --cache-folder .yarn
|
|
||||||
- echo -e "\e[0Ksection_end:`date +%s`:install_dependencies\r\e[0K"
|
|
||||||
|
|
||||||
# calls scripts to check for simple issues while disabling actual work (e.g. no publishing to third party)
|
|
||||||
# some scripts are left out because they need special configuration and are not safe to smoke test
|
|
||||||
- node server/calendarBot.js en,pl,es,pt,de,nl,fr,ja,ru,sv,lad,ua,vi ""
|
|
||||||
- node server/cleanupAccounts.js
|
|
||||||
- node server/migrate.js
|
|
||||||
- node server/notify.js
|
|
||||||
- node server/stats.js
|
|
||||||
- node server/subscriptions.js
|
|
||||||
|
@ -88,6 +88,7 @@
|
|||||||
"css-loader": "^5.2.7",
|
"css-loader": "^5.2.7",
|
||||||
"csv-loader": "^3.0.3",
|
"csv-loader": "^3.0.3",
|
||||||
"eslint": "^8.55.0",
|
"eslint": "^8.55.0",
|
||||||
|
"eslint-formatter-gitlab": "^5.1.0",
|
||||||
"eslint-plugin-import": "^2.29.0",
|
"eslint-plugin-import": "^2.29.0",
|
||||||
"eslint-plugin-jsonc": "^2.11.2",
|
"eslint-plugin-jsonc": "^2.11.2",
|
||||||
"eslint-plugin-vue": "^9.19.2",
|
"eslint-plugin-vue": "^9.19.2",
|
||||||
@ -95,6 +96,7 @@
|
|||||||
"globals": "^13.24.0",
|
"globals": "^13.24.0",
|
||||||
"html-loader": "^1.3.2",
|
"html-loader": "^1.3.2",
|
||||||
"jest": "^29.7.0",
|
"jest": "^29.7.0",
|
||||||
|
"jest-junit": "^16.0.0",
|
||||||
"markdown-loader": "^6.0.0",
|
"markdown-loader": "^6.0.0",
|
||||||
"postcss": "^8.2.15",
|
"postcss": "^8.2.15",
|
||||||
"postcss-import": "^13.0.0",
|
"postcss-import": "^13.0.0",
|
||||||
|
23
yarn.lock
23
yarn.lock
@ -5578,6 +5578,14 @@ eslint-compat-utils@^0.1.1, eslint-compat-utils@^0.1.2:
|
|||||||
resolved "https://registry.yarnpkg.com/eslint-compat-utils/-/eslint-compat-utils-0.1.2.tgz#f45e3b5ced4c746c127cf724fb074cd4e730d653"
|
resolved "https://registry.yarnpkg.com/eslint-compat-utils/-/eslint-compat-utils-0.1.2.tgz#f45e3b5ced4c746c127cf724fb074cd4e730d653"
|
||||||
integrity sha512-Jia4JDldWnFNIru1Ehx1H5s9/yxiRHY/TimCuUc0jNexew3cF1gI6CYZil1ociakfWO3rRqFjl1mskBblB3RYg==
|
integrity sha512-Jia4JDldWnFNIru1Ehx1H5s9/yxiRHY/TimCuUc0jNexew3cF1gI6CYZil1ociakfWO3rRqFjl1mskBblB3RYg==
|
||||||
|
|
||||||
|
eslint-formatter-gitlab@^5.1.0:
|
||||||
|
version "5.1.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/eslint-formatter-gitlab/-/eslint-formatter-gitlab-5.1.0.tgz#33162a17eefba5a44a257af568511d360212e866"
|
||||||
|
integrity sha512-IxhrjLYzDlbFgPWEnvZlWLwPjMeyymbyo0hDHWntZ3DSAP9AP9huj15KbU+BK3OqeO3OHhbFEh2TA6sR0KZhkA==
|
||||||
|
dependencies:
|
||||||
|
chalk "^4.0.0"
|
||||||
|
yaml "^2.0.0"
|
||||||
|
|
||||||
eslint-import-resolver-node@^0.3.9:
|
eslint-import-resolver-node@^0.3.9:
|
||||||
version "0.3.9"
|
version "0.3.9"
|
||||||
resolved "https://registry.yarnpkg.com/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.9.tgz#d4eaac52b8a2e7c3cd1903eb00f7e053356118ac"
|
resolved "https://registry.yarnpkg.com/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.9.tgz#d4eaac52b8a2e7c3cd1903eb00f7e053356118ac"
|
||||||
@ -7897,6 +7905,16 @@ jest-haste-map@^29.7.0:
|
|||||||
optionalDependencies:
|
optionalDependencies:
|
||||||
fsevents "^2.3.2"
|
fsevents "^2.3.2"
|
||||||
|
|
||||||
|
jest-junit@^16.0.0:
|
||||||
|
version "16.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/jest-junit/-/jest-junit-16.0.0.tgz#d838e8c561cf9fdd7eb54f63020777eee4136785"
|
||||||
|
integrity sha512-A94mmw6NfJab4Fg/BlvVOUXzXgF0XIH6EmTgJ5NDPp4xoKq0Kr7sErb+4Xs9nZvu58pJojz5RFGpqnZYJTrRfQ==
|
||||||
|
dependencies:
|
||||||
|
mkdirp "^1.0.4"
|
||||||
|
strip-ansi "^6.0.1"
|
||||||
|
uuid "^8.3.2"
|
||||||
|
xml "^1.0.1"
|
||||||
|
|
||||||
jest-leak-detector@^29.7.0:
|
jest-leak-detector@^29.7.0:
|
||||||
version "29.7.0"
|
version "29.7.0"
|
||||||
resolved "https://registry.yarnpkg.com/jest-leak-detector/-/jest-leak-detector-29.7.0.tgz#5b7ec0dadfdfec0ca383dc9aa016d36b5ea4c728"
|
resolved "https://registry.yarnpkg.com/jest-leak-detector/-/jest-leak-detector-29.7.0.tgz#5b7ec0dadfdfec0ca383dc9aa016d36b5ea4c728"
|
||||||
@ -13841,6 +13859,11 @@ xml2js@0.5.0:
|
|||||||
sax ">=0.6.0"
|
sax ">=0.6.0"
|
||||||
xmlbuilder "~11.0.0"
|
xmlbuilder "~11.0.0"
|
||||||
|
|
||||||
|
xml@^1.0.1:
|
||||||
|
version "1.0.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/xml/-/xml-1.0.1.tgz#78ba72020029c5bc87b8a81a3cfcd74b4a2fc1e5"
|
||||||
|
integrity sha512-huCv9IH9Tcf95zuYCsQraZtWnJvBtLVE0QHMOs8bWyZAFZNDcYjsPq1nEx8jKA9y+Beo9v+7OBPRisQTjinQMw==
|
||||||
|
|
||||||
xmlbuilder@~11.0.0:
|
xmlbuilder@~11.0.0:
|
||||||
version "11.0.1"
|
version "11.0.1"
|
||||||
resolved "https://registry.yarnpkg.com/xmlbuilder/-/xmlbuilder-11.0.1.tgz#be9bae1c8a046e76b31127726347d0ad7002beb3"
|
resolved "https://registry.yarnpkg.com/xmlbuilder/-/xmlbuilder-11.0.1.tgz#be9bae1c8a046e76b31127726347d0ad7002beb3"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user