-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
153 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,151 @@ | ||
pipeline { | ||
agent { | ||
label 'builder' | ||
} | ||
stages { | ||
stage('Resolve TAO dependencies') { | ||
environment { | ||
GITHUB_ORGANIZATION='oat-sa' | ||
REPO_NAME='oat-sa/extension-tao-group' | ||
} | ||
steps { | ||
sh( | ||
label : 'Create build build directory', | ||
script: 'mkdir -p build' | ||
) | ||
|
||
withCredentials([string(credentialsId: 'jenkins_github_token', variable: 'GIT_TOKEN')]) { | ||
sh( | ||
label : 'Run the Dependency Resolver', | ||
script: ''' | ||
changeBranch=$CHANGE_BRANCH | ||
TEST_BRANCH="${changeBranch:-$BRANCH_NAME}" | ||
echo "select branch : ${TEST_BRANCH}" | ||
docker run --rm \\ | ||
-e "GITHUB_ORGANIZATION=${GITHUB_ORGANIZATION}" \\ | ||
-e "GITHUB_SECRET=${GIT_TOKEN}" \\ | ||
tao/dependency-resolver oat:dependencies:resolve --main-branch ${TEST_BRANCH} --repository-name ${REPO_NAME} > build/dependencies.json | ||
|
||
cat > build/composer.json <<- composerjson | ||
{ | ||
"repositories": [ | ||
{ | ||
"type": "vcs", | ||
"url": "https://github.com/${REPO_NAME}", | ||
"no-api": true | ||
} | ||
], | ||
composerjson | ||
tail -n +2 build/dependencies.json >> build/composer.json | ||
''' | ||
) | ||
sh( | ||
label: 'composer.json', | ||
script: 'cat build/composer.json' | ||
) | ||
} | ||
} | ||
} | ||
stage('Install') { | ||
agent { | ||
docker { | ||
image 'alexwijn/docker-git-php-composer' | ||
args "-v $BUILDER_CACHE_DIR/composer:/tmp/.composer-cache -e COMPOSER_CACHE_DIR=/tmp/.composer-cache" | ||
reuseNode true | ||
} | ||
} | ||
environment { | ||
HOME = '.' | ||
} | ||
options { | ||
skipDefaultCheckout() | ||
} | ||
steps { | ||
dir('build') { | ||
sh( | ||
label: 'Install/Update sources from Composer', | ||
script: 'COMPOSER_DISCARD_CHANGES=true composer install --prefer-dist --no-interaction --no-ansi --no-progress --no-suggest' | ||
) | ||
sh( | ||
label: 'Add phpunit', | ||
script: 'composer require phpunit/phpunit:^8.5 --no-progress' | ||
) | ||
sh( | ||
label: "Extra filesystem mocks", | ||
script: ''' | ||
mkdir -p taoQtiItem/views/js/mathjax/ && touch taoQtiItem/views/js/mathjax/MathJax.js | ||
mkdir -p tao/views/locales/en-US/ | ||
echo "{\\"serial\\":\\"${BUILD_ID}\\",\\"date\\":$(date +%s),\\"version\\":\\"3.3.0-${BUILD_NUMBER}\\",\\"translations\\":{}}" > tao/views/locales/en-US/messages.json | ||
mkdir -p tao/views/locales/en-US/ | ||
''' | ||
) | ||
} | ||
} | ||
} | ||
stage('Tests') { | ||
parallel { | ||
stage('Backend Tests') { | ||
when { | ||
expression { | ||
fileExists('build/taoGroups/test/unit') | ||
} | ||
} | ||
agent { | ||
docker { | ||
image 'alexwijn/docker-git-php-composer' | ||
reuseNode true | ||
} | ||
} | ||
options { | ||
skipDefaultCheckout() | ||
} | ||
steps { | ||
dir('build'){ | ||
sh( | ||
label: 'Run backend tests', | ||
script: './vendor/bin/phpunit taoGroups/test/unit' | ||
) | ||
} | ||
} | ||
} | ||
stage('Frontend Tests') { | ||
when { | ||
expression { | ||
fileExists('build/taoGroups/views/build/grunt/test.js') | ||
} | ||
} | ||
agent { | ||
docker { | ||
image 'btamas/puppeteer-git' | ||
args "-v $BUILDER_CACHE_DIR/npm:/tmp/.npm-cache -e npm_config_cache=/tmp/.npm-cache" | ||
reuseNode true | ||
} | ||
} | ||
environment { | ||
HOME = '.' | ||
} | ||
options { | ||
skipDefaultCheckout() | ||
} | ||
steps { | ||
dir('build/tao/views/build') { | ||
sh( | ||
label: 'Install tao-core frontend extensions', | ||
script: 'npm install' | ||
) | ||
sh ( | ||
label : 'Run frontend tests', | ||
script: 'npx grunt connect:test taogroupstest' | ||
) | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
post { | ||
always { | ||
cleanWs disableDeferredWipeout: true | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters