From 5e19279114a3b6c464cbf01419d4ada4fd7dbd80 Mon Sep 17 00:00:00 2001 From: Aaron Powell Date: Fri, 28 Jun 2019 16:36:16 +1000 Subject: [PATCH] templating the build up a bit --- .azure-pipelines/build.yml | 18 +++++ .azure-pipelines/lint.yml | 6 ++ .azure-pipelines/package.yml | 11 +++ .azure-pipelines/test.yml | 24 +++++++ azure-pipelines.yml | 132 +++++------------------------------ 5 files changed, 77 insertions(+), 114 deletions(-) create mode 100755 .azure-pipelines/build.yml create mode 100755 .azure-pipelines/lint.yml create mode 100755 .azure-pipelines/package.yml create mode 100755 .azure-pipelines/test.yml diff --git a/.azure-pipelines/build.yml b/.azure-pipelines/build.yml new file mode 100755 index 0000000..64682dd --- /dev/null +++ b/.azure-pipelines/build.yml @@ -0,0 +1,18 @@ +steps: + - task: NodeTool@0 + displayName: 'Use $(node_version)' + inputs: + versionSpec: $(node_version) + + - task: Npm@1 + displayName: 'Install dependencies' + inputs: + verbose: false + command: install + + - task: Npm@1 + displayName: 'Compile Extension' + inputs: + command: custom + verbose: false + customCommand: 'run compile' diff --git a/.azure-pipelines/lint.yml b/.azure-pipelines/lint.yml new file mode 100755 index 0000000..6383a8a --- /dev/null +++ b/.azure-pipelines/lint.yml @@ -0,0 +1,6 @@ +steps: +- task: Npm@1 + displayName: 'Lint' + inputs: + command: custom + customCommand: run lint \ No newline at end of file diff --git a/.azure-pipelines/package.yml b/.azure-pipelines/package.yml new file mode 100755 index 0000000..1457e97 --- /dev/null +++ b/.azure-pipelines/package.yml @@ -0,0 +1,11 @@ +steps: + - script: | + npx vsce package -o release.vsix + displayName: 'create vsix' + + - task: PublishPipelineArtifact@0 + displayName: 'Publish Pipeline Artifact' + inputs: + targetPath: release.vsix + condition: and(succeeded(), eq(variables['node_version'], '12.x')) + diff --git a/.azure-pipelines/test.yml b/.azure-pipelines/test.yml new file mode 100755 index 0000000..97f1446 --- /dev/null +++ b/.azure-pipelines/test.yml @@ -0,0 +1,24 @@ +steps: + # starts a process that allows the vscode test environment to run + - script: | + set -e + /usr/bin/Xvfb :10 -ac >> /tmp/Xvfb.out 2>&1 & + disown -ar + displayName: 'Start xvfb' + condition: eq(variables['Agent.OS'], 'Linux') + + - task: Npm@1 + displayName: 'Run tests via npm script' + inputs: + command: custom + verbose: false + customCommand: 'run test:ci' + env: + DISPLAY: :10 + + - task: PublishTestResults@2 + displayName: 'Publish Test Results' + inputs: + testResultsFiles: '*-results.xml' + testRunTitle: '$(Agent.OS)' + condition: succeededOrFailed() diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 38d9467..ebf204a 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -17,129 +17,33 @@ jobs: node_12_x: node_version: 12.x steps: - - task: NodeTool@0 - displayName: 'Use $(node_version)' - inputs: - versionSpec: $(node_version) - - - task: Npm@1 - displayName: 'Install dependencies' - inputs: - verbose: false - command: install - - - task: Npm@1 - displayName: 'Compile Extension' - inputs: - command: custom - verbose: false - customCommand: 'run compile' - - # starts a process that allows the vscode test environment to run - - script: | - set -e - /usr/bin/Xvfb :10 -ac >> /tmp/Xvfb.out 2>&1 & - disown -ar - displayName: 'Start xvfb' - - - task: Npm@1 - displayName: 'Run tests via npm script' - inputs: - command: custom - verbose: false - customCommand: 'run test:ci' - env: - DISPLAY: :10 - - - task: PublishTestResults@2 - displayName: 'Publish Test Results' - inputs: - testResultsFiles: '*-results.xml' - testRunTitle: '$(Agent.OS)' - condition: succeededOrFailed() - - - script: | - npx vsce package -o release.vsix - displayName: 'create vsix' - - - task: PublishPipelineArtifact@0 - displayName: 'Publish Pipeline Artifact' - inputs: - targetPath: release.vsix - condition: and(succeeded(), eq(variables['node_version'], '12.x')) + - template: .azure-pipelines/build.yml + - template: .azure-pipelines/lint.yml + - template: .azure-pipelines/test.yml + - template: .azure-pipelines/package.yml - job: Windows pool: name: Hosted VS2017 demands: npm + strategy: + matrix: + node_10_x: + node_version: 10.x steps: - - task: NodeTool@0 - displayName: 'Use Node 10.x' - inputs: - versionSpec: 10.x - - - task: Npm@1 - displayName: 'Install dependencies' - inputs: - verbose: false - command: install - - - task: Npm@1 - displayName: 'Compile Extension' - inputs: - command: custom - verbose: false - customCommand: 'run compile' - - - task: Npm@1 - displayName: 'Run tests via npm script' - inputs: - command: custom - verbose: false - customCommand: 'run test:ci' - env: - DISPLAY: :10 - - - task: PublishTestResults@2 - displayName: 'Publish Test Results' - inputs: - testResultsFiles: '*-results.xml' - testRunTitle: '$(Agent.OS)' - condition: succeededOrFailed() + - template: .azure-pipelines/build.yml + - template: .azure-pipelines/lint.yml + - template: .azure-pipelines/test.yml - job: macOS pool: name: Hosted macOS demands: npm + strategy: + matrix: + node_10_x: + node_version: 10.x steps: - - task: NodeTool@0 - displayName: 'Use Node 10.x' - inputs: - versionSpec: 10.x - - - task: Npm@1 - displayName: 'Install dependencies' - inputs: - verbose: false - command: install - - - task: Npm@1 - displayName: 'Compile Extension' - inputs: - command: custom - verbose: false - customCommand: 'run compile' - - - task: Npm@1 - displayName: 'Run tests via npm script' - inputs: - command: custom - verbose: false - customCommand: 'run test:ci' - - - task: PublishTestResults@2 - displayName: 'Publish Test Results' - inputs: - testResultsFiles: '*-results.xml' - testRunTitle: '$(Agent.OS)' - condition: succeededOrFailed() + - template: .azure-pipelines/build.yml + - template: .azure-pipelines/lint.yml + - template: .azure-pipelines/test.yml \ No newline at end of file