diff --git a/.azure-pipelines/azure-pipelines.yml b/.azure-pipelines/azure-pipelines.yml new file mode 100644 index 0000000..e50a427 --- /dev/null +++ b/.azure-pipelines/azure-pipelines.yml @@ -0,0 +1,35 @@ +# CI and PR build script +# +# Basic information can be found here: +# https://code.visualstudio.com/api/working-with-extensions/continuous-integration +# +# The structure of this pipeline configuration is mainly inspired by microsofts code extension for azure pipelines. +# It can be found here: +# https://github.com/microsoft/azure-pipelines-vscode +# +# +trigger: +- master +pr: +- master + +pool: + vmImage: ubuntu-16.04 + +steps: +# tag CI-produced packages with a version number pointing to the commit which was built. +# for PRs, also include the PR #. +- bash: | + PACKAGE_VERSION=$(node -p "require('./package.json').version") + if [ -n "$SYSTEM_PULLREQUEST_PULLREQUESTNUMBER" ]; then + VERSION_STRING=${PACKAGE_VERSION}-pr-${SYSTEM_PULLREQUEST_PULLREQUESTNUMBER}-$(git rev-parse --short HEAD) + else + VERSION_STRING=${PACKAGE_VERSION}-ci-$(git rev-parse --short HEAD) + fi + npm --no-git-tag-version version $VERSION_STRING + echo "##vso[build.updatebuildnumber]${VERSION_STRING}_${BUILD_BUILDID}" + echo "$PACKAGE_VERSION" > version.txt + displayName: Set version number of package and build + condition: eq(variables['Agent.OS'], 'Linux') + +- template: basic-steps.yml \ No newline at end of file diff --git a/.azure-pipelines/basic-steps.yml b/.azure-pipelines/basic-steps.yml new file mode 100644 index 0000000..6be8b9c --- /dev/null +++ b/.azure-pipelines/basic-steps.yml @@ -0,0 +1,60 @@ +# Basic steps template +steps: +- bash: | + /usr/bin/Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 & + echo ">>> Started xvfb" + displayName: Start xvfb + condition: and(succeeded(), eq(variables['Agent.OS'], 'Linux')) + +- bash: | + echo ">>> Compile vscode-test" + yarn && yarn compile + echo ">>> Compiled vscode-test" + cd sample + echo ">>> Run sample integration test" + yarn && yarn compile && yarn test + displayName: Run Tests + env: + DISPLAY: ':99.0' + + # Acquire the `vsce` tool and use it to package + # Copy a file to prevent webpack from failing as a workaround. +- script: | + sudo npm install -g vsce + sudo cp client/node_modules/copy-paste/platform/linux.js client/node_modules/copy-paste/platform/openbsd.js + vsce package + displayName: Create VSIX + condition: and(succeeded(), eq(variables['Agent.OS'], 'Linux')) + +- script: | + npm run vscode:prepublish + cat /home/vsts/.npm/_logs/*.log + displayName: Echo npm error logs on failure + condition: failed() + +# For releasable builds, we'll want the branch and the changelog +# Expects that a 'version.txt' has been laid down by a previous step +- bash: | + echo $(Build.SourceBranch) | sed "s|refs/[^/]*/||" > branch.txt + PACKAGE_VERSION=$(cat version.txt) + VERSION_REGEX="## $(echo $PACKAGE_VERSION | sed 's/\./\\./g')" + sed -n "/$VERSION_REGEX/,/## 1\..*/p" CHANGELOG.md | head -n -2 > minichangelog.txt + displayName: Get branch and mini-changelog + +# Choose files to publish +- task: CopyFiles@2 + displayName: Stage VSIX for publishing + inputs: + contents: |- + *.vsix + version.txt + branch.txt + minichangelog.txt + targetFolder: $(Build.ArtifactStagingDirectory) + +# Publish files as an artifact +- task: PublishPipelineArtifact@1 + displayName: Publish VSIX + inputs: + artifact: openhab-vscode + targetPath: $(Build.ArtifactStagingDirectory) diff --git a/.vscodeignore b/.vscodeignore index 54450b0..f0d67ae 100644 --- a/.vscodeignore +++ b/.vscodeignore @@ -1,4 +1,4 @@ -#General +#General .vscode/** .vscode-test/** .github/** @@ -21,7 +21,7 @@ shared.webpack.config.js # openHAB vscode repo meta files AUTHORS -azure-pipelines.yml +.azure-pipelines/* CHANGELOG.md CONTRIBUTING.md NOTICE diff --git a/azure-pipelines.yml b/azure-pipelines.yml deleted file mode 100644 index c99b6a5..0000000 --- a/azure-pipelines.yml +++ /dev/null @@ -1,40 +0,0 @@ -trigger: -- master -pr: -- master - -strategy: - matrix: - linux: - imageName: 'ubuntu-16.04' - mac: - imageName: 'macos-10.13' - windows: - imageName: 'vs2017-win2016' - -pool: - vmImage: $(imageName) - -steps: - -- task: NodeTool@0 - inputs: - versionSpec: '8.x' - displayName: 'Install Node.js' - -- bash: | - /usr/bin/Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 & - echo ">>> Started xvfb" - displayName: Start xvfb - condition: and(succeeded(), eq(variables['Agent.OS'], 'Linux')) - -- bash: | - echo ">>> Compile vscode-test" - yarn && yarn compile - echo ">>> Compiled vscode-test" - cd sample - echo ">>> Run sample integration test" - yarn && yarn compile && yarn test - displayName: Run Tests - env: - DISPLAY: ':99.0' \ No newline at end of file