Skip to content

Commit

Permalink
Repo housekeeping (#66)
Browse files Browse the repository at this point in the history
Update lerna and minimum node version
- eclipse-glsp/glsp#676: 
Update to lerna 6 and set node 14 as minimum engine version

- eclipse-glsp/glsp#812:
 Improve yarn scripts
    - Remove linting from prepare step
    - Add dedicated :ci scrips for testing and linting
    - Add 'all' script on root level
    - Consistently sort scripts ascending

- eclipse-glsp/glsp#680: 
Update to latest `@eclipse-glsp/config` version

- eclipse-glsp/glsp#794: Update Jenkinsfile to
    - directly include the npm deploy step instead of spawning a new dedicated job
    - enable error reporting when master builds fail
  • Loading branch information
tortmayr committed Dec 13, 2022
1 parent 3504bcf commit 27d3688
Show file tree
Hide file tree
Showing 8 changed files with 432 additions and 295 deletions.
68 changes: 33 additions & 35 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ defaults:
working-directory: ./client
on:
push:
branches: [ master ]
branches: [master]
pull_request:
# The branches below must be a subset of the branches above
branches: [ master ]
branches: [master]
schedule:
- cron: '19 3 * * 5'
- cron: "19 3 * * 5"

jobs:
analyze:
Expand All @@ -34,47 +34,45 @@ jobs:
strategy:
fail-fast: false
matrix:
language: [ 'java', 'javascript' ]
language: ["java", "javascript"]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
# Learn more:
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed

steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Checkout repository
uses: actions/checkout@v2

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

- name: Build with Maven
run: mvn -B -Pm2 clean verify --file pom.xml
working-directory: server

- name: Build Client with yarn
uses: actions/setup-node@v2
with:
node-version: '12'
- run: yarn install
- name: Build with Maven
run: mvn -B -Pm2 clean verify --file pom.xml
working-directory: server

- name: Build Client with yarn
uses: actions/setup-node@v2
with:
node-version: "14"
- run: yarn install

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language

#- run: |
# make bootstrap
# make release
#- run: |
# make bootstrap
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
97 changes: 81 additions & 16 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ kind: Pod
spec:
containers:
- name: ci
image: eclipseglsp/ci:alpine
image: eclipseglsp/ci:alpine-v3.1
tty: true
resources:
limits:
Expand All @@ -15,6 +15,7 @@ spec:
cpu: "1"
command:
- cat
tty: true
env:
- name: "MAVEN_OPTS"
value: "-Duser.home=/home/jenkins"
Expand All @@ -31,6 +32,8 @@ spec:
readOnly: true
- name: m2-repo
mountPath: /home/jenkins/.m2/repository
- name: volume-known-hosts
mountPath: /home/jenkins/.ssh
volumes:
- name: "jenkins-home"
emptyDir: {}
Expand All @@ -44,6 +47,9 @@ spec:
path: settings.xml
- name: m2-repo
emptyDir: {}
- name: volume-known-hosts
configMap:
name: known-hosts
"""
pipeline {
agent {
Expand All @@ -59,6 +65,7 @@ pipeline {
environment {
YARN_CACHE_FOLDER = "${env.WORKSPACE}/yarn-cache"
SPAWN_WRAP_SHIM_ROOT = "${env.WORKSPACE}"
EMAIL_TO= "[email protected]"
}

stages {
Expand All @@ -67,8 +74,14 @@ pipeline {
container('ci') {
timeout(30){
dir('client') {
sh 'yarn install --ignore-scripts'
sh 'yarn build'
sh "yarn install"
script {
// Fail the step if there are uncommited changes to the yarn.lock file
if (sh(returnStatus: true, script: 'git diff --name-only | grep -q "^yarn.lock"') == 0) {
echo 'The yarn.lock file has uncommited changes!'
error 'The yarn.lock file has uncommited changes!'
}
}
}
}
}
Expand Down Expand Up @@ -97,33 +110,46 @@ pipeline {
}
// Execute eslint checks
dir('client') {
sh 'yarn lint -o eslint.xml -f checkstyle'
sh 'yarn lint:ci'
}
}
}
}
}

stage('Deploy (master only)') {
when {
allOf {
branch 'master';
expression {
/* Only trigger the deployment job if the changeset contains changes in
the `server` or `client/packages/` directory */
sh(returnStatus: true, script: 'git diff --name-only HEAD^ | grep --quiet "^server\\|client/packages/"') == 0
stages {
stage('Deploy client (NPM)') {
steps {
container('ci') {
timeout(30) {
dir('client') {
withCredentials([string(credentialsId: 'npmjs-token', variable: 'NPM_AUTH_TOKEN')]) {
sh 'printf "//registry.npmjs.org/:_authToken=${NPM_AUTH_TOKEN}\n" >> $WORKSPACE/client/.npmrc'
}
sh 'git config user.email "[email protected]"'
sh 'git config user.name "eclipse-glsp-bot"'
sh 'yarn publish:next'
}
}
}
}
}
stage('Deploy server (P2)') {
steps {
sh "rm -rf ${WORKSPACE}/p2-update-site/ide/p2"
sh "mkdir -p ${WORKSPACE}/p2-update-site/ide/p2/nightly"
sshagent ( ['projects-storage.eclipse.org-bot-ssh']) {
sh "mvn clean install -Prelease -B -Dlocal.p2.root=${WORKSPACE}/p2-update-site"
}
}
}
}
steps {
build job: 'deploy-p2-ide-integration', wait: true
build job: 'deploy-npm-ide-integration', wait: true
}
}
}

post{
always{
success{
container('ci') {

// Record & publish checkstyle issues
Expand All @@ -138,6 +164,45 @@ pipeline {
recordIssues enabledForFailure: true, publishAllIssues: true, aggregatingResults: true,
tools: [esLint(pattern: 'client/node_modules/**/*/eslint.xml')],
qualityGates: [[threshold: 1, type: 'TOTAL', unstable: true]]

script {
if (env.BRANCH_NAME == 'master') {
archiveArtifacts artifacts: 'p2-update-site/**', followSymlinks: false
}
}
}
}
failure {
script {
if (env.BRANCH_NAME == 'master') {
echo "Build result FAILURE: Send email notification to ${EMAIL_TO}"
emailext attachLog: true,
from: '[email protected]',
body: 'Job: ${JOB_NAME}<br>Build Number: ${BUILD_NUMBER}<br>Build URL: ${BUILD_URL}',
mimeType: 'text/html', subject: 'Build ${JOB_NAME} (#${BUILD_NUMBER}) FAILURE', to: "${EMAIL_TO}"
}
}
}
unstable {
script {
if (env.BRANCH_NAME == 'master') {
echo "Build result UNSTABLE: Send email notification to ${EMAIL_TO}"
emailext attachLog: true,
from: '[email protected]',
body: 'Job: ${JOB_NAME}<br>Build Number: ${BUILD_NUMBER}<br>Build URL: ${BUILD_URL}',
mimeType: 'text/html', subject: 'Build ${JOB_NAME} (#${BUILD_NUMBER}) UNSTABLE', to: "${EMAIL_TO}"
}
}
}
fixed {
script {
if (env.BRANCH_NAME == 'master') {
echo "Build back to normal: Send email notification to ${EMAIL_TO}"
emailext attachLog: false,
from: '[email protected]',
body: 'Job: ${JOB_NAME}<br>Build Number: ${BUILD_NUMBER}<br>Build URL: ${BUILD_URL}',
mimeType: 'text/html', subject: 'Build ${JOB_NAME} back to normal (#${BUILD_NUMBER})', to: "${EMAIL_TO}"
}
}
}
}
Expand Down
6 changes: 1 addition & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
# Eclipse GLSP Eclipse IDE Integration

[![build-status](https://img.shields.io/jenkins/build?jobUrl=https%3A%2F%2Fci.eclipse.org%2Fglsp%2Fjob%2Feclipse-glsp%2Fjob%2Fglsp-eclipse-integration%2Fjob%2Fmaster%2F)](https://ci.eclipse.org/glsp/job/eclipse-glsp/job/glsp-eclipse-integration/)
[![publish-status-npm](https://img.shields.io/jenkins/build?jobUrl=https://ci.eclipse.org/glsp/job/deploy-npm-ide-integration/&label=npm)](https://ci.eclipse.org/glsp/job/deploy-npm-ide-integration/)
[![publish-status-p2](https://img.shields.io/jenkins/build?jobUrl=https://ci.eclipse.org/glsp/job/deploy-p2-ide-integration/&label=p2)](https://ci.eclipse.org/glsp/job/deploy-p2-ide-integration/)
# Eclipse GLSP Eclipse IDE Integration [![build-status](https://img.shields.io/jenkins/build?jobUrl=https%3A%2F%2Fci.eclipse.org%2Fglsp%2Fjob%2Feclipse-glsp%2Fjob%2Fglsp-eclipse-integration%2Fjob%2Fmaster%2F)](https://ci.eclipse.org/glsp/job/eclipse-glsp/job/glsp-eclipse-integration/) [![publish-status-p2](https://img.shields.io/jenkins/build?jobUrl=https://ci.eclipse.org/glsp/job/deploy-p2-ide-integration/&label=p2)](https://ci.eclipse.org/glsp/job/deploy-p2-ide-integration/)

Contains the glue code for opening browser-based GLSP diagrams in an Eclipse IDE Editor

Expand Down
3 changes: 2 additions & 1 deletion client/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ lib

*.log
*.ttf
tsconfig.tsbuildinfo
tsconfig.tsbuildinfo
eslint.xml
8 changes: 5 additions & 3 deletions client/examples/workflow-webapp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,13 @@
"webpack-cli": "^4.9.1"
},
"scripts": {
"prepare": "yarn clean && yarn build && yarn lint",
"build": "tsc -b",
"clean": "rimraf lib tsconfig.tsbuildinfo app/bundle.js app/bundle.js.map",
"build": "tsc && webpack",
"lint": "eslint --ext .ts,.tsx ./src",
"lint:fix": "eslint --fix --ext .ts,.tsx ./src",
"lint:ci": "yarn lint -o eslint.xml -f checkstyle",
"prepare": "yarn clean && yarn build",
"test": "mocha --config ../../.mocharc.json \"./src/**/*.spec.?(ts|tsx)\"",
"test:ci": "export JUNIT_REPORT_PATH=./report.xml && yarn test --reporter mocha-jenkins-reporter",
"watch": "tsc -w"
}
}
25 changes: 14 additions & 11 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,31 @@
"name": "parent",
"version": "1.1.0-next",
"engines": {
"yarn": ">=1.7.0 <2.x.x"
"yarn": ">=1.7.0 <2.x.x",
"node": ">=14.18.0"
},
"devDependencies": {
"@eclipse-glsp/config": "next",
"@types/node": "12.x",
"@eclipse-glsp/config": "1.1.0-next.d03ad9f.112",
"@types/node": "14",
"copyfiles": "^2.4.1",
"lerna": "^4.0.0",
"reflect-metadata": "^0.1.13",
"rimraf": "^3.0.2",
"typescript": "^4.4.5"
"typescript": "^4.9.3"
},
"scripts": {
"prepare": "lerna run prepare && yarn copyClient",
"install:only": "yarn install --ignore-scripts",
"watch": "lerna run --parallel watch",
"build": "lerna run build",
"lint": "lerna run lint --",
"copyClient": "copyfiles -f ./examples/workflow-webapp/app/* ../server/example/org.eclipse.glsp.ide.workflow.editor/diagram",
"all": "yarn install && yarn lint",
"build": "lerna run build && yarn copy:client",
"clean": "lerna run clean",
"copy:client": "copyfiles -f ./examples/workflow-webapp/app/* ../server/example/org.eclipse.glsp.ide.workflow.editor/diagram",
"lint": "lerna run lint",
"lint:ci": "lerna run lint:ci",
"prepare": "lerna run prepare && yarn copy:client",
"publish:prepare": "lerna version --ignore-scripts --yes --no-push",
"publish:latest": "lerna publish from-git --no-git-reset --no-git-tag-version --no-verify-access --no-push",
"publish:next": "SHA=$(git rev-parse --short HEAD) && lerna publish preminor --exact --canary --preid next.${SHA} --dist-tag next --no-git-reset --no-git-tag-version --no-push --ignore-scripts --yes --no-verify-access",
"upgrade:next": "yarn upgrade -p \"@eclipse-glsp.*|sprotty\" --next "
"upgrade:next": "yarn upgrade -p \"@eclipse-glsp.*|sprotty.*\" --next ",
"watch": "lerna run --parallel watch"
},
"workspaces": [
"packages/*",
Expand Down
6 changes: 3 additions & 3 deletions client/packages/ide/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@
"@eclipse-glsp/client": "next"
},
"scripts": {
"prepare": "yarn clean && yarn build && yarn lint",
"build": "tsc -b",
"clean": "rimraf lib tsconfig.tsbuildinfo ",
"build": "tsc",
"lint": "eslint --ext .ts,.tsx ./src",
"lint:fix": "eslint --fix --ext .ts,.tsx ./src",
"lint:ci": "yarn lint -o eslint.xml -f checkstyle",
"prepare": "yarn clean && yarn build",
"watch": "tsc -w"
},
"publishConfig": {
Expand Down
Loading

0 comments on commit 27d3688

Please sign in to comment.