improve travis ci (#6951)

add deprecate build script
This commit is contained in:
Eugenio Romano 2021-04-27 09:26:13 +01:00 committed by GitHub
parent 9c165b2307
commit 672891e21b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 89 additions and 14 deletions

View File

@ -41,19 +41,20 @@ branches:
stages:
- name: Setup
if: branch != master AND (type = cron || type = pull_request) AND tag IS blank
- name: "Build lib"
if: branch != master AND (type = cron || type = pull_request) AND tag IS blank
if: tag IS blank
- name: "Check bundle"
if: branch != master AND type = cron AND tag IS blank
if: type = push AND tag IS blank
- name: "Trigger Alpha ADF child build"
if: branch = develop AND type = cron
- name: "Build"
if: branch != master AND (type = cron || type = pull_request) AND tag IS blank
- name: "Build Demo shell and Unit test Lib"
if: branch != master AND tag IS blank
- name: "e2e Test"
if: branch != master AND (type = cron || type = pull_request) AND tag IS blank
if: branch != master AND tag IS blank
- name: "Release tag"
if: branch = master
- name: "Deprecate develop builds"
if: branch = master
addons:
chrome: stable
@ -95,7 +96,7 @@ jobs:
workspaces:
use: node_modules_cache
- stage: "Build"
- stage: "Build Demo shell and Unit test Lib"
name: "Demo Shell :Build && dockerize"
script:
# Build Demo shell for production docker"
@ -109,25 +110,25 @@ jobs:
use:
- built_libs_cache
- stage: "Build"
- stage: "Build Demo shell and Unit test Lib"
name: "content::unit"
script: ./scripts/travis/unit-test/content.sh
workspaces:
use: built_libs_cache
- stage: "Build"
- stage: "Build Demo shell and Unit test Lib"
name: "core-extension::unit"
script: ./scripts/travis/unit-test/core-extension.sh
workspaces:
use: built_libs_cache
- stage: "Build"
- stage: "Build Demo shell and Unit test Lib"
name: "process-insights::unit"
script: ./scripts/travis/unit-test/process.sh
workspaces:
use: built_libs_cache
- stage: "Build"
- stage: "Build Demo shell and Unit test Lib"
name: "process-cloud::unit"
script: ./scripts/travis/unit-test/process-cloud.sh
workspaces:
@ -142,6 +143,9 @@ jobs:
- stage: "Release tag"
script: ./scripts/travis/release/git-tag.sh
- stage: "Deprecate develop builds"
script: ./scripts/travis/release/deprecate-develop-build.sh -v ${ADF_VERSION}
- stage: "e2e Test"
name: "Core"
before_script:

View File

@ -0,0 +1,68 @@
#!/usr/bin/env bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
eval VERSION=""
eval projects=( "adf-core"
"adf-insights"
"adf-content-services"
"adf-extensions"
"adf-testing"
"adf-process-services"
"adf-process-services-cloud" )
show_help() {
echo "Usage: deprecate-develop-build.sh"
echo "-v or -version to check -v 1.4.0 "
echo ""
}
set_npm_registry() {
npm set registry https://registry.npmjs.org/
}
version() {
if [[ $1 == "" ]];
then
echo "You need to add a version"
exit 1
fi
VERSION=$1
}
while [[ $1 == -* ]]; do
case "$1" in
-h|--help|-\?) show_help; exit 0;;
-v|--version) version $2; shift 2;;
-*) echo "invalid option: $1" 1>&2; show_help; exit 1;;
esac
done
if [[ $VERSION == "" ]];
then
echo "You need to add a version"
fi
for PACKAGE in ${projects[@]}
do
echo "@alfresco/$PACKAGE"
for VERSION_TO_DEPRECATE in $(npm view "@alfresco/$PACKAGE" versions --json | jq -r '.[] | select( . | contains("-")) | select( . | contains("'$VERSION'"))')
do
deprecated=$(npm view "@alfresco/$PACKAGE@$VERSION_TO_DEPRECATE" -json | jq '.deprecated')
if [[ $deprecated != null ]];
then
echo "Already deprecated @alfresco/$PACKAGE@$VERSION_TO_DEPRECATE"
else
echo "Deprecate alpha/beta version @alfresco/$PACKAGE@$VERSION_TO_DEPRECATE"
npm deprecate "@alfresco/$PACKAGE@$VERSION_TO_DEPRECATE" "Upgrade to @latest or $VERSION"
fi
done
done

View File

@ -35,8 +35,6 @@ async function main() {
.option('-title, --title [type]', 'title')
.parse(process.argv);
console.log('process.argv ', program);
const { token, title, head, repo } = program,
prCreator = new PrCreator(ORGANISATION, repo, token);
@ -49,10 +47,15 @@ async function main() {
main()
.then(prNumber => {
console.log("======= PR Created =========");
console.log(prNumber)
process.exit(0);
})
.catch(error => {
console.error(error);
console.error("======= Impossible create PR =========");
console.error(error.response.status);
console.error(error.response.statusText);
process.exit(1);
});