Skip to content

Commit

Permalink
Merge pull request #405 from badsyntax/fix-ci
Browse files Browse the repository at this point in the history
Build & CI improvements
  • Loading branch information
badsyntax authored May 19, 2020
2 parents 0718663 + 6b078fa commit dfa7350
Show file tree
Hide file tree
Showing 27 changed files with 574 additions and 1,237 deletions.
43 changes: 33 additions & 10 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,14 @@ jobs:
uses: actions/setup-node@v1
with:
node-version: 12.16.2
- name: Build Project
uses: eskatos/gradle-command-action@v1
with:
arguments: build
- name: Lint
uses: eskatos/gradle-command-action@v1
with:
arguments: lint
- name: SonarQube Analyse
- name: Build & Analyse
uses: eskatos/gradle-command-action@v1
with:
arguments: sonarqube
arguments: tasks-server:build sonarqube -x :test -x extension:test -x npm-package:test
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_SONARCLOUD_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
Expand Down Expand Up @@ -61,10 +57,12 @@ jobs:
with:
java-version: ${{ matrix.java-version }}
architecture: x64
- name: Build Project
- name: Build Extension
uses: eskatos/gradle-command-action@v1
with:
arguments: build -x test -x serverStartScripts -x compileJava -x shadowJar -x startShadowScripts
arguments: extension:build
env:
NODE_OPTIONS: '--max-old-space-size=4096'
- name: Download lib
uses: actions/download-artifact@v1
with:
Expand All @@ -79,10 +77,35 @@ jobs:
chmod +x extension/lib/tasks-server
unset npm_config_prefix
if: matrix.os != 'windows-latest'
- name: Test extension
- name: Prepare gradle-groovy-custom-build-file
uses: eskatos/gradle-command-action@v1
with:
arguments: build
build-root-directory: extension/test-fixtures/gradle-groovy-custom-build-file
wrapper-directory: extension/test-fixtures/gradle-groovy-custom-build-file
- name: Prepare gradle-groovy-default-build-file
uses: eskatos/gradle-command-action@v1
with:
arguments: build
build-root-directory: extension/test-fixtures/gradle-groovy-default-build-file
wrapper-directory: extension/test-fixtures/gradle-groovy-default-build-file
- name: Prepare gradle-kotlin-default-build-file
uses: eskatos/gradle-command-action@v1
with:
arguments: testVsCode -x test -x serverStartScripts -x compileJava -x shadowJar -x startShadowScripts
arguments: build
build-root-directory: extension/test-fixtures/gradle-kotlin-default-build-file
wrapper-directory: extension/test-fixtures/gradle-kotlin-default-build-file
# - name: Test extension
# uses: eskatos/gradle-command-action@v1
# with:
# arguments: testVsCode
# env:
# DISPLAY: ':99.0'
# CI: 'true'
- name: Test extension
run: |
cd extension
npm test
env:
DISPLAY: ':99.0'
CI: 'true'
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- name: Build & prepare extension
uses: eskatos/gradle-command-action@v1
with:
arguments: extension:prepareForRelease npm-package:build
arguments: prepareForRelease
- name: Publish types
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
Expand Down
46 changes: 32 additions & 14 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"runtimeExecutable": "${execPath}",
"args": ["--extensionDevelopmentPath=${workspaceFolder}/extension"],
"outFiles": ["${workspaceFolder}/extension/dist/**/*.js"],
"preLaunchTask": "Gradle: Build TypeScript",
"preLaunchTask": "Gradle: Build",
"presentation": {
"group": "debug",
"order": 1
Expand All @@ -33,7 +33,7 @@
"runtimeExecutable": "${execPath}",
"args": ["--extensionDevelopmentPath=${workspaceFolder}/extension"],
"outFiles": ["${workspaceFolder}/extension/dist/**/*.js"],
"preLaunchTask": "Gradle: Build TypeScript",
"preLaunchTask": "Gradle: Build",
"env": {
"VSCODE_DEBUG_SERVER": "true"
},
Expand All @@ -56,8 +56,11 @@
"--extensionTestsPath=${workspaceFolder}/extension/out/test/gradle",
"${workspaceFolder}/extension/test-fixtures/gradle-groovy-default-build-file"
],
"outFiles": ["${workspaceFolder}/extension/out/test/**/*.js"],
"preLaunchTask": "Gradle: Build TypeScript & Tests",
"outFiles": [
"${workspaceFolder}/extension/dist/**/*.js",
"${workspaceFolder}/extension/out/test/**/*.js"
],
"preLaunchTask": "Gradle: Build",
"presentation": {
"group": "test"
}
Expand All @@ -77,8 +80,11 @@
"--extensionTestsPath=${workspaceFolder}/extension/out/test/gradle",
"${workspaceFolder}/extension/test-fixtures/gradle-kotlin-default-build-file"
],
"outFiles": ["${workspaceFolder}/extension/out/test/**/*.js"],
"preLaunchTask": "Gradle: Build TypeScript & Tests",
"outFiles": [
"${workspaceFolder}/extension/dist/**/*.js",
"${workspaceFolder}/extension/out/test/**/*.js"
],
"preLaunchTask": "Gradle: Build",
"presentation": {
"group": "test"
}
Expand All @@ -98,8 +104,11 @@
"--extensionTestsPath=${workspaceFolder}/extension/out/test/gradle",
"${workspaceFolder}/extension/test-fixtures/gradle-groovy-custom-build-file"
],
"outFiles": ["${workspaceFolder}/extension/out/test/**/*.js"],
"preLaunchTask": "Gradle: Build TypeScript & Tests",
"outFiles": [
"${workspaceFolder}/extension/dist/**/*.js",
"${workspaceFolder}/extension/out/test/**/*.js"
],
"preLaunchTask": "Gradle: Build",
"presentation": {
"group": "test"
}
Expand All @@ -118,8 +127,11 @@
"--extensionTestsPath=${workspaceFolder}/extension/out/test/no-gradle/",
"${workspaceFolder}/extension/test-fixtures/no-gradle"
],
"outFiles": ["${workspaceFolder}/extension/out/test/**/*.js"],
"preLaunchTask": "Gradle: Build TypeScript & Tests",
"outFiles": [
"${workspaceFolder}/extension/dist/**/*.js",
"${workspaceFolder}/extension/out/test/**/*.js"
],
"preLaunchTask": "Gradle: Build",
"presentation": {
"group": "test"
}
Expand All @@ -139,8 +151,11 @@
"--extensionTestsPath=${workspaceFolder}/extension/out/test/multi-root/",
"${workspaceFolder}/extension/test-fixtures/multi-root/multiple-project.code-workspace"
],
"outFiles": ["${workspaceFolder}/extension/out/test/**/*.js"],
"preLaunchTask": "Gradle: Build TypeScript & Tests",
"outFiles": [
"${workspaceFolder}/extension/dist/**/*.js",
"${workspaceFolder}/extension/out/test/**/*.js"
],
"preLaunchTask": "Gradle: Build",
"presentation": {
"group": "test"
}
Expand All @@ -159,8 +174,11 @@
"--extensionTestsPath=${workspaceFolder}/extension/out/test/multi-project/",
"${workspaceFolder}/extension/test-fixtures/multi-project"
],
"outFiles": ["${workspaceFolder}/extension/out/test/**/*.js"],
"preLaunchTask": "Gradle: Build TypeScript & Tests",
"outFiles": [
"${workspaceFolder}/extension/dist/**/*.js",
"${workspaceFolder}/extension/out/test/**/*.js"
],
"preLaunchTask": "Gradle: Build",
"presentation": {
"group": "test"
}
Expand Down
27 changes: 2 additions & 25 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,37 +2,14 @@
"version": "2.0.0",
"tasks": [
{
"label": "Gradle: Build TypeScript",
"label": "Gradle: Build",
"type": "shell",
"problemMatcher": "$tsc-watch",
"command": "./gradlew",
"windows": {
"command": ".\\gradlew.bat"
},
"args": [":extension:buildTypeScript", "-x", "test"],
"isBackground": true,
"presentation": {
"reveal": "always"
},
"group": {
"kind": "build",
"isDefault": true
}
},
{
"label": "Gradle: Build TypeScript & Tests",
"type": "shell",
"problemMatcher": "$tsc-watch",
"command": "./gradlew",
"windows": {
"command": ".\\gradlew.bat"
},
"args": [
":extension:buildTypeScript",
":extension:buildTypeScriptTests",
"-x",
"test"
],
"args": ["build", "-x", "test", "-x", "npm-package:build"],
"isBackground": true,
"presentation": {
"reveal": "always"
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Open the root of the project in VS Code.

Open the Debug panel, and select one of the `debug` tasks, for example `Debug Extension`, or any of the test launch configurations.

You can also run `./gradlew test testVsCode` to run all tests.
You can also run `./gradlew build testVsCode` to run all tests.

### Code Style

Expand Down
2 changes: 0 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,3 @@ subprojects {
task(format) {
dependsOn(spotlessApply)
}

project.tasks["sonarqube"].dependsOn ':extension:buildTypeScript'
32 changes: 17 additions & 15 deletions extension/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ compileTestJava.enabled = false
processResources.enabled = false;

clean {
dependsOn ':tasks-server:clean'
delete protobuf.generatedFilesBaseDir
delete file('node_modules')
delete file(protoLib)
Expand Down Expand Up @@ -112,7 +111,7 @@ task npmInstall(type: CrossPlatformExec) {
description 'Installs node dependencies'
inputs.file('package-lock.json')
outputs.dir('node_modules')
commandLine 'npm', 'install'
commandLine 'npm', 'ci'
}

task lint(type: CrossPlatformExec) {
Expand All @@ -126,19 +125,19 @@ task format(type: CrossPlatformExec) {
commandLine 'npm', 'run', 'lint:fix'
}

task buildTypeScript(type: CrossPlatformExec) {
dependsOn assemble, ':tasks-server:generateProto', copyProtoJs, copyProtoTs
task buildDev(type: CrossPlatformExec) {
dependsOn copyProtoJs, copyProtoTs
group 'build'
description 'Builds TypeScript source files'
description 'Builds development version TypeScript source files'
outputs.dir('dist')
inputs.dir('src')
inputs.file('webpack.config.js')
inputs.file('tsconfig.json')
commandLine 'npm', 'run', 'compile:dev'
}

task buildTypeScriptTests(type: CrossPlatformExec) {
dependsOn assemble, ':tasks-server:generateProto', copyProtoJs, copyProtoTs
task buildTest(type: CrossPlatformExec) {
dependsOn copyProtoJs, copyProtoTs
group 'build'
description 'Builds TypeScript test source files'
buildDir = 'out'
Expand All @@ -149,24 +148,29 @@ task buildTypeScriptTests(type: CrossPlatformExec) {
commandLine 'npm', 'run', 'compile:test'
}

task bundle(type: CrossPlatformExec) {
dependsOn ':tasks-server:build', ':npm-package:build', copyProtoJs, copyProtoTs
task buildProd(type: CrossPlatformExec) {
dependsOn copyProtoJs, copyProtoTs
group 'build'
description 'Bundles the extension files for release'
description 'Builds production version TypeScript source files'
buildDir = 'dist'
outputs.dir("$buildDir")
inputs.dir('src')
inputs.file('webpack.config.js')
commandLine 'npm', 'run', 'compile:prod'
}

task bundle() {
dependsOn buildProd, ':npm-package:build'
group 'build'
description 'Bundles the extension files for release'
}

task installExtension(type: CrossPlatformExec) {
dependsOn bundle
commandLine 'npm', 'run', 'install:ext'
}

task testVsCode(type: CrossPlatformExec) {
dependsOn copyProtoJs, copyProtoTs
group 'verification'
description 'Tests the extension'
commandLine 'npm', 'run', 'test'
Expand All @@ -180,9 +184,7 @@ task copyDocs(type: Copy) {
}

task prepareForRelease() {
dependsOn build, bundle, copyDocs
dependsOn bundle, copyDocs
}

build.dependsOn ':tasks-server:build'
assemble.dependsOn ':tasks-server:build'
assemble.finalizedBy buildTypeScript, buildTypeScriptTests
build.finalizedBy buildDev, buildTest
7 changes: 0 additions & 7 deletions extension/i18n/es/package.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,6 @@
"extension.config.enableTasksExplorer.description": "Habilitar una vista de explorador para tareas de Gradle",
"extension.config.debug.description": "Mostrar información adicional de depuración en el panel de salida",
"extension.config.focusTaskInExplorer.description": "Enfoca la tarea en el explorador cuando ejecutas una tarea",
"extension.config.taskPresentationOptions.description": "Opciones de terminal para ejecutar una tarea",
"extension.config.taskPresentationOptions.reveal.description": "Controla si el panel Terminal integrado se lleva al frente",
"extension.config.taskPresentationOptions.focus.description": "Controla si el terminal está tomando el foco de entrada o no",
"extension.config.taskPresentationOptions.echo.description": "Controla si el comando ejecutado se repite en el terminal",
"extension.config.taskPresentationOptions.showReuseMessage.description": "Controla si mostrar el \"Terminal será reutilizado por tareas, presione cualquier tecla para cerrarlo \" mensaje",
"extension.config.taskPresentationOptions.panel.description": "Controla si la instancia de terminal se comparte entre ejecuciones de tareas",
"extension.config.taskPresentationOptions.clear.description": "Controla si el terminal se borra antes de ejecutar esta tarea",
"extension.config.javaDebug.description": "Opciones de depuración de Java",
"extension.config.javaDebug.tasks.description": "Lista de tareas JavaExec para depurar"
}
Loading

0 comments on commit dfa7350

Please sign in to comment.