Optimise build workflow
This commit is contained in:
Родитель
0718663bc4
Коммит
6c05a27f13
|
@ -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 }}
|
||||
|
@ -49,7 +45,7 @@ jobs:
|
|||
matrix:
|
||||
node-version: [12.16.2]
|
||||
java-version: ['8', '11']
|
||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
||||
os: [macos-latest]
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- name: Use Node ${{ matrix.node-version }}
|
||||
|
@ -61,15 +57,19 @@ 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
|
||||
- name: Download lib
|
||||
uses: actions/download-artifact@v1
|
||||
with:
|
||||
name: lib
|
||||
path: extension/lib
|
||||
- name: MacOS fix
|
||||
run: |
|
||||
export NODE_OPTIONS="--no-force-async-hooks-checks"
|
||||
if: matrix.os == 'macos-latest'
|
||||
- name: Start Xvfb
|
||||
run: |
|
||||
Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &
|
||||
|
@ -82,7 +82,8 @@ jobs:
|
|||
- name: Test extension
|
||||
uses: eskatos/gradle-command-action@v1
|
||||
with:
|
||||
arguments: testVsCode -x test -x serverStartScripts -x compileJava -x shadowJar -x startShadowScripts
|
||||
arguments: testVsCode
|
||||
env:
|
||||
DISPLAY: ':99.0'
|
||||
CI: 'true'
|
||||
NODE_OPTIONS: '--no-force-async-hooks-checks'
|
||||
|
|
|
@ -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 }}
|
||||
|
|
|
@ -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
|
||||
|
@ -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"
|
||||
},
|
||||
|
@ -57,7 +57,7 @@
|
|||
"${workspaceFolder}/extension/test-fixtures/gradle-groovy-default-build-file"
|
||||
],
|
||||
"outFiles": ["${workspaceFolder}/extension/out/test/**/*.js"],
|
||||
"preLaunchTask": "Gradle: Build TypeScript & Tests",
|
||||
"preLaunchTask": "Gradle: Build",
|
||||
"presentation": {
|
||||
"group": "test"
|
||||
}
|
||||
|
@ -78,7 +78,7 @@
|
|||
"${workspaceFolder}/extension/test-fixtures/gradle-kotlin-default-build-file"
|
||||
],
|
||||
"outFiles": ["${workspaceFolder}/extension/out/test/**/*.js"],
|
||||
"preLaunchTask": "Gradle: Build TypeScript & Tests",
|
||||
"preLaunchTask": "Gradle: Build",
|
||||
"presentation": {
|
||||
"group": "test"
|
||||
}
|
||||
|
@ -99,7 +99,7 @@
|
|||
"${workspaceFolder}/extension/test-fixtures/gradle-groovy-custom-build-file"
|
||||
],
|
||||
"outFiles": ["${workspaceFolder}/extension/out/test/**/*.js"],
|
||||
"preLaunchTask": "Gradle: Build TypeScript & Tests",
|
||||
"preLaunchTask": "Gradle: Build",
|
||||
"presentation": {
|
||||
"group": "test"
|
||||
}
|
||||
|
@ -119,7 +119,7 @@
|
|||
"${workspaceFolder}/extension/test-fixtures/no-gradle"
|
||||
],
|
||||
"outFiles": ["${workspaceFolder}/extension/out/test/**/*.js"],
|
||||
"preLaunchTask": "Gradle: Build TypeScript & Tests",
|
||||
"preLaunchTask": "Gradle: Build",
|
||||
"presentation": {
|
||||
"group": "test"
|
||||
}
|
||||
|
@ -140,7 +140,7 @@
|
|||
"${workspaceFolder}/extension/test-fixtures/multi-root/multiple-project.code-workspace"
|
||||
],
|
||||
"outFiles": ["${workspaceFolder}/extension/out/test/**/*.js"],
|
||||
"preLaunchTask": "Gradle: Build TypeScript & Tests",
|
||||
"preLaunchTask": "Gradle: Build",
|
||||
"presentation": {
|
||||
"group": "test"
|
||||
}
|
||||
|
@ -160,7 +160,7 @@
|
|||
"${workspaceFolder}/extension/test-fixtures/multi-project"
|
||||
],
|
||||
"outFiles": ["${workspaceFolder}/extension/out/test/**/*.js"],
|
||||
"preLaunchTask": "Gradle: Build TypeScript & Tests",
|
||||
"preLaunchTask": "Gradle: Build",
|
||||
"presentation": {
|
||||
"group": "test"
|
||||
}
|
||||
|
|
|
@ -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"],
|
||||
"isBackground": true,
|
||||
"presentation": {
|
||||
"reveal": "always"
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -50,5 +50,3 @@ subprojects {
|
|||
task(format) {
|
||||
dependsOn(spotlessApply)
|
||||
}
|
||||
|
||||
project.tasks["sonarqube"].dependsOn ':extension:buildTypeScript'
|
||||
|
|
|
@ -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)
|
||||
|
@ -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) {
|
||||
|
@ -126,10 +125,10 @@ 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')
|
||||
|
@ -137,8 +136,8 @@ task buildTypeScript(type: CrossPlatformExec) {
|
|||
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'
|
||||
|
@ -149,10 +148,10 @@ 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')
|
||||
|
@ -160,13 +159,18 @@ task bundle(type: CrossPlatformExec) {
|
|||
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'
|
||||
|
@ -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
|
||||
|
|
|
@ -183,6 +183,7 @@ export class GradleTaskProvider
|
|||
*/): Promise<
|
||||
vscode.Task | undefined
|
||||
> {
|
||||
console.log('TRYING TO RESOLVE TASK');
|
||||
return undefined;
|
||||
}
|
||||
|
||||
|
|
|
@ -103,10 +103,12 @@ describe(fixtureName, () => {
|
|||
const task = (await vscode.tasks.fetchTasks({ type: 'gradle' })).find(
|
||||
({ name }) => name === 'helloProjectProperty'
|
||||
);
|
||||
console.log('got task', JSON.stringify(task, null, 2));
|
||||
assert.ok(task);
|
||||
const spy = sinon.spy(extension.exports.logger, 'append');
|
||||
const treeDataProvider = extension?.exports
|
||||
.treeDataProvider as GradleTasksTreeDataProvider;
|
||||
console.log('got treeData Provider', treeDataProvider);
|
||||
await new Promise((resolve) => {
|
||||
// eslint-disable-next-line sonarjs/no-identical-functions
|
||||
vscode.tasks.onDidEndTaskProcess((e) => {
|
||||
|
|
|
@ -22,7 +22,7 @@ task copyProtoLib(type: Copy) {
|
|||
}
|
||||
|
||||
task copyPublicApi(type: Copy) {
|
||||
dependsOn ':extension:buildTypeScript'
|
||||
dependsOn ':extension:buildProd'
|
||||
group 'copy'
|
||||
description 'Copies publc API types'
|
||||
from file("../extension/out")
|
||||
|
@ -34,7 +34,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 compileTypeScript(type: CrossPlatformExec) {
|
||||
|
@ -46,7 +46,7 @@ task compileTypeScript(type: CrossPlatformExec) {
|
|||
commandLine 'npm', 'run', 'compile'
|
||||
}
|
||||
|
||||
assemble.finalizedBy npmInstall,
|
||||
build.finalizedBy npmInstall,
|
||||
compileTypeScript,
|
||||
copyProtoLib,
|
||||
copyPublicApi
|
||||
|
|
|
@ -125,4 +125,5 @@ task(format) {
|
|||
dependsOn(spotlessApply)
|
||||
}
|
||||
|
||||
compileJava.dependsOn 'generateProto'
|
||||
assemble.dependsOn serverStartScripts
|
||||
|
|
Загрузка…
Ссылка в новой задаче