Skip to content

Commit

Permalink
Merge branch 'master' into kh/links-for-download
Browse files Browse the repository at this point in the history
  • Loading branch information
kraenhansen authored Oct 25, 2017
2 parents 9188618 + caaa7b9 commit 5cc840f
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 12 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,6 @@ data/

# Secrets
secrets.sh

# Test results from JUnit
test-results.xml
30 changes: 19 additions & 11 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,34 +3,42 @@
@Library('realm-ci') _

jobWrapper {
stage('Checkout') {
node('docker') {
node('docker') {
stage('Checkout') {
rlmCheckout scm
}
}

stage('Build & test') {
if (env.CHANGE_TARGET) {
// This is a PR
node('docker') {
rlmCheckout scm

stage('Build') {
// Computing a packageHash from the package-lock.json
def packageHash = sh(
script: "git ls-files -s package-lock.json | cut -d ' ' -f 2",
returnStdout: true
).trim()

// Using buildDockerEnv ensures that the image is pushed
image = buildDockerEnv("ci/realm-studio:pr-${packageHash}", extra_args: '-f Dockerfile.testing')
}

stage('Test') {
image.inside("-e HOME=${env.WORKSPACE} -v /etc/passwd:/etc/passwd:ro") {
// Link in the node_modules from the image
sh 'ln -s /tmp/node_modules .'
// Test that the package-lock has changed while building the image
// - if it has, a dependency was changed in package.json but not updated in the lock
sh 'npm run check:package-lock'
// Run the tests with xvfb to allow opening windows virtually
sh './node_modules/.bin/xvfb-maybe npm test'
// Trying to test - but that might fail
try {
// Run the tests with xvfb to allow opening windows virtually, and report using the junit reporter
sh './node_modules/.bin/xvfb-maybe npm run test:ci'
} catch (err) {
error "Tests failed - see results on CI"
} finally {
junit(
allowEmptyResults: true,
keepLongStdio: true,
testResults: 'test-results.xml'
)
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion Jenkinsfile.prepare
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobWrapper {
).trim()
// Update the version in the package lock
def lock = readJSON(file: 'package-lock.json')
lock.version = nextVersion
lock.version = nextVersion.substring(1) // Removing the v-prefix
writeJSON(file: 'package-lock.json', json: lock, pretty: 2)
}
// Push the change to GitHub
Expand Down
6 changes: 6 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@
"prepare-next-release": "node ./scripts/prepare-next-release.js",
"start": "rm -rf ./build && npm run build && npm run electron",
"test": "mocha-webpack",
"test:ci": "mocha-webpack --reporter mocha-junit-reporter",
"tslint-prettier": "tslint --fix 'src/**/*.ts' 'src/**/*.tsx'",
"wait-for-bundle": "node ./webpack.wait-for-bundle.js",
"webpack:main": "webpack --config=webpack.main.config.js",
Expand Down Expand Up @@ -146,6 +147,7 @@
"jsdom": "^11.3.0",
"lint-staged": "^4.3.0",
"mocha": "^3.5.3",
"mocha-junit-reporter": "^1.15.0",
"mocha-webpack": "^1.0.0-rc.1",
"node-sass": "^4.5.3",
"null-loader": "^0.1.1",
Expand Down

0 comments on commit 5cc840f

Please sign in to comment.