From ed1eb9680041afea07083e2a34601c83e31a6900 Mon Sep 17 00:00:00 2001 From: Marcin Rataj Date: Tue, 6 Feb 2018 22:17:31 +0100 Subject: [PATCH] CI: run addon-linter after build --- Dockerfile | 1 + ci/Jenkinsfile | 26 +++++++++++++++++++------- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index 93842cd1d..e4652bd45 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,4 +4,5 @@ WORKDIR /usr/src/app COPY package.json /usr/src/app/package.json COPY yarn.lock /usr/src/app/yarn.lock RUN npm run ci:install +ENV PATH="/usr/src/app/node_modules/.bin:${PATH}" COPY . /usr/src/app diff --git a/ci/Jenkinsfile b/ci/Jenkinsfile index 6911d2a6a..740e843bc 100644 --- a/ci/Jenkinsfile +++ b/ci/Jenkinsfile @@ -1,18 +1,30 @@ node(label: 'linux') { - stage('Checkout') { + stage('git:checkout') { checkout scm + sh 'printenv' } stage('ci:install') { - sh 'docker build -t ipfs-companion .' + sh 'docker build -t ipfs-companion:${BUILD_NUMBER} .' } catchError { stage('ci:test') { - sh 'docker run -i -v $(pwd)/test/data:/usr/src/app/test/data -e JUNIT_REPORT_PATH=test/data/report.xml ipfs-companion npm run ci:test' + sh 'docker run -i --name ipfs-companion-test-${BUILD_NUMBER} -e JUNIT_REPORT_PATH=test/report.xml ipfs-companion:${BUILD_NUMBER} npm run ci:test' + sh 'docker cp ipfs-companion-test-${BUILD_NUMBER}:/usr/src/app/test/report.xml test/report.xml || true' // copy test report } } - junit allowEmptyResults: true, testResults: 'test/data/report.xml' - stage('ci:build') { - sh 'docker run -i -v $(pwd)/build:/usr/src/app/build ipfs-companion npm run ci:build' - archiveArtifacts artifacts: 'build/*.zip', fingerprint: true + sh 'docker rm ipfs-companion-test-${BUILD_NUMBER}' + junit allowEmptyResults: true, testResults: 'test/report.xml' + catchError { + stage('ci:build') { + sh 'docker run -i --name ipfs-companion-build-${BUILD_NUMBER} ipfs-companion:${BUILD_NUMBER} npm run ci:build' + sh 'docker cp ipfs-companion-build-${BUILD_NUMBER}:/usr/src/app/build/ . || true' // copy package + sh 'docker cp ipfs-companion-build-${BUILD_NUMBER}:/usr/src/app/add-on/dist add-on/ || true' // needed for lint:web-ext + archiveArtifacts artifacts: 'build/*.zip', fingerprint: true + } + stage('lint:web-ext') { + sh 'docker run -i --rm -v $(pwd)/add-on/dist:/usr/src/app/add-on/dist ipfs-companion:${BUILD_NUMBER} npm run lint:web-ext' + } } + sh 'docker rm ipfs-companion-build-${BUILD_NUMBER}' + sh 'docker rmi -f ipfs-companion:${BUILD_NUMBER}' }