Skip to content

Commit

Permalink
Merge pull request #2 from intersystems-community/github-actions
Browse files Browse the repository at this point in the history
CI, UnitTests, fixed compilation, vsceignore
  • Loading branch information
gjsjohnmurray authored Jun 26, 2020
2 parents d9f0e3b + 94c46e5 commit e08d8a2
Show file tree
Hide file tree
Showing 9 changed files with 267 additions and 96 deletions.
152 changes: 152 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
name: CI

on:
push:
branches:
- master
paths-ignore:
- '*.md'
- '**/*.md'
pull_request:
branches:
- master
release:
types:
- created
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
steps:
- uses: actions/checkout@master
- run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
- name: Set an output
id: set-version
if: runner.os == 'Linux'
run: |
set -x
VERSION=$(jq -r '.version' package.json | cut -d- -f1)
[ $GITHUB_EVENT_NAME == 'release' ] && VERSION=${{ github.event.release.tag_name }} && VERSION=${VERSION/v/}
CHANGELOG=$(cat CHANGELOG.md | sed -n "/## \[${VERSION}\]/,/## /p" | sed '/^$/d;1d;$d')
CHANGELOG="${CHANGELOG//$'\n'/'%0A'}"
echo ::set-output name=changelog::$CHANGELOG
git tag -l | cat
[ $GITHUB_EVENT_NAME == 'push' ] && VERSION+=-beta && VERSION+=.$(($(git tag -l "v$VERSION.*" | sort -nt. -k4 2>/dev/null | tail -1 | cut -d. -f4)+1))
[ $GITHUB_EVENT_NAME == 'pull_request' ] && VERSION+=-dev
echo ::set-output name=version::$VERSION
NAME=$(jq -r '.name' package.json)-$VERSION
echo ::set-output name=name::$NAME
tmp=$(mktemp)
jq --arg version "$VERSION" '.version = $version' package.json > "$tmp" && mv "$tmp" package.json
mkdir dist
echo $VERSION > ./dist/.version
echo $NAME > ./dist/.name
- name: Use Node.js
uses: actions/setup-node@master
with:
node-version: 12.x
- run: npm install
- run: npm run compile
- name: npm test
uses: GabrielBB/xvfb-action@v1.0
with:
run: npm run test
- name: Build package
if: runner.os == 'Linux'
run: |
./node_modules/.bin/vsce package -o ./dist/package.vsix
- uses: actions/upload-artifact@master
if: runner.os == 'Linux'
with:
name: vsix
path: ./dist/
beta:
if: (github.event_name == 'push')
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/download-artifact@master
with:
name: vsix
path: ./dist/
- name: Set an output
id: set-version
if: runner.os == 'Linux'
run: |
set -x
echo ::set-output name=version::`cat ./dist/.version`
echo ::set-output name=name::`cat ./dist/.name`
- name: Create Release
id: create_release
uses: actions/create-release@master
if: runner.os == 'Linux'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ steps.set-version.outputs.version }}
release_name: v${{ steps.set-version.outputs.version }}
prerelease: ${{ github.event_name != 'release' }}
body: |
Changes in this release
${{ steps.set-version.outputs.changelog }}
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@master
if: runner.os == 'Linux'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./dist/package.vsix
asset_name: ${{ steps.set-version.outputs.name }}.vsix
asset_content_type: application/zip
publish:
if: github.event_name == 'release'
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v2
with:
ref: master
- uses: actions/download-artifact@master
with:
name: vsix
path: ./dist/
- name: Use Node.js
uses: actions/setup-node@master
with:
node-version: 12.x
- name: Prepare build
id: set-version
run: |
VERSION=`cat ./dist/.version`
echo ::set-output name=name::`cat ./dist/.name`
tmp=$(mktemp)
git config --global user.name 'ProjectBot'
git config --global user.email 'bot@users.noreply.github.com'
jq --arg version "${VERSION}-SNAPSHOT" '.version = $version' package.json > "$tmp" && mv "$tmp" package.json
git add package.json
git commit -m 'auto bump version with release'
jq --arg version "$VERSION" '.version = $version' package.json > "$tmp" && mv "$tmp" package.json
jq '.enableProposedApi = false' package.json > "$tmp" && mv "$tmp" package.json
npm install
npm i -g vsce ovsx
git push
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@master
if: runner.os == 'Linux'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./dist/package.vsix
asset_name: ${{ steps.set-version.outputs.name }}.vsix
asset_content_type: application/zip
- name: Publish to Marketplaces
run: |
vsce publish -p ${{ secrets.VSCE_TOKEN }}
ovsx publish --pat ${{ secrets.OVSX_TOKEN }}
8 changes: 8 additions & 0 deletions .vscodeignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,10 @@
.github/**
.vscode/**
.vscode-test/**
out/test/**
**/*.ts
**/*.map
.gitignore
**/tsconfig.json
**/tslint.json
**/.eslintrc.json
93 changes: 4 additions & 89 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 14 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
},
"license": "MIT",
"keywords": [
"intersystems",
"objectscript",
"multi-root ready"
],
"engines": {
Expand Down Expand Up @@ -103,7 +105,10 @@
"scheme": {
"type": "string",
"description": "Protocol used for connections.",
"enum": ["http", "https"],
"enum": [
"http",
"https"
],
"default": "http"
},
"host": {
Expand Down Expand Up @@ -134,7 +139,10 @@
"description": "Optional prefix for the path to the resource. Only needed when one web server publishes services on behalf of multiple InterSystems® servers."
}
},
"required": ["host", "port"],
"required": [
"host",
"port"
],
"additionalProperties": false
},
"username": {
Expand All @@ -150,15 +158,17 @@
"description": "Optional description of the server."
}
},
"required": ["webServer"],
"required": [
"webServer"
],
"additionalProperties": false
}
},
"properties": {
"/default": {
"type": "string",
"description": "Name of the default server."
}
}
},
"additionalProperties": false
}
Expand Down
1 change: 1 addition & 0 deletions src/extension.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
'use strict';
export const extensionId = "intersystems-community.servermanager";

import * as vscode from 'vscode';

Expand Down
Loading

0 comments on commit e08d8a2

Please sign in to comment.