Skip to content

Commit e08d8a2

Browse files
Merge pull request #2 from intersystems-community/github-actions
CI, UnitTests, fixed compilation, vsceignore
2 parents d9f0e3b + 94c46e5 commit e08d8a2

File tree

9 files changed

+267
-96
lines changed

9 files changed

+267
-96
lines changed

.github/workflows/main.yml

Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
paths-ignore:
8+
- '*.md'
9+
- '**/*.md'
10+
pull_request:
11+
branches:
12+
- master
13+
release:
14+
types:
15+
- created
16+
jobs:
17+
build:
18+
runs-on: ${{ matrix.os }}
19+
strategy:
20+
matrix:
21+
os: [ubuntu-latest, windows-latest, macOS-latest]
22+
steps:
23+
- uses: actions/checkout@master
24+
- run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
25+
- name: Set an output
26+
id: set-version
27+
if: runner.os == 'Linux'
28+
run: |
29+
set -x
30+
VERSION=$(jq -r '.version' package.json | cut -d- -f1)
31+
[ $GITHUB_EVENT_NAME == 'release' ] && VERSION=${{ github.event.release.tag_name }} && VERSION=${VERSION/v/}
32+
CHANGELOG=$(cat CHANGELOG.md | sed -n "/## \[${VERSION}\]/,/## /p" | sed '/^$/d;1d;$d')
33+
CHANGELOG="${CHANGELOG//$'\n'/'%0A'}"
34+
echo ::set-output name=changelog::$CHANGELOG
35+
git tag -l | cat
36+
[ $GITHUB_EVENT_NAME == 'push' ] && VERSION+=-beta && VERSION+=.$(($(git tag -l "v$VERSION.*" | sort -nt. -k4 2>/dev/null | tail -1 | cut -d. -f4)+1))
37+
[ $GITHUB_EVENT_NAME == 'pull_request' ] && VERSION+=-dev
38+
echo ::set-output name=version::$VERSION
39+
NAME=$(jq -r '.name' package.json)-$VERSION
40+
echo ::set-output name=name::$NAME
41+
tmp=$(mktemp)
42+
jq --arg version "$VERSION" '.version = $version' package.json > "$tmp" && mv "$tmp" package.json
43+
mkdir dist
44+
echo $VERSION > ./dist/.version
45+
echo $NAME > ./dist/.name
46+
- name: Use Node.js
47+
uses: actions/setup-node@master
48+
with:
49+
node-version: 12.x
50+
- run: npm install
51+
- run: npm run compile
52+
- name: npm test
53+
uses: GabrielBB/[email protected]
54+
with:
55+
run: npm run test
56+
- name: Build package
57+
if: runner.os == 'Linux'
58+
run: |
59+
./node_modules/.bin/vsce package -o ./dist/package.vsix
60+
- uses: actions/upload-artifact@master
61+
if: runner.os == 'Linux'
62+
with:
63+
name: vsix
64+
path: ./dist/
65+
beta:
66+
if: (github.event_name == 'push')
67+
runs-on: ubuntu-latest
68+
needs: build
69+
steps:
70+
- uses: actions/download-artifact@master
71+
with:
72+
name: vsix
73+
path: ./dist/
74+
- name: Set an output
75+
id: set-version
76+
if: runner.os == 'Linux'
77+
run: |
78+
set -x
79+
echo ::set-output name=version::`cat ./dist/.version`
80+
echo ::set-output name=name::`cat ./dist/.name`
81+
- name: Create Release
82+
id: create_release
83+
uses: actions/create-release@master
84+
if: runner.os == 'Linux'
85+
env:
86+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
87+
with:
88+
tag_name: v${{ steps.set-version.outputs.version }}
89+
release_name: v${{ steps.set-version.outputs.version }}
90+
prerelease: ${{ github.event_name != 'release' }}
91+
body: |
92+
Changes in this release
93+
${{ steps.set-version.outputs.changelog }}
94+
- name: Upload Release Asset
95+
id: upload-release-asset
96+
uses: actions/upload-release-asset@master
97+
if: runner.os == 'Linux'
98+
env:
99+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
100+
with:
101+
upload_url: ${{ steps.create_release.outputs.upload_url }}
102+
asset_path: ./dist/package.vsix
103+
asset_name: ${{ steps.set-version.outputs.name }}.vsix
104+
asset_content_type: application/zip
105+
publish:
106+
if: github.event_name == 'release'
107+
runs-on: ubuntu-latest
108+
needs: build
109+
steps:
110+
- uses: actions/checkout@v2
111+
with:
112+
ref: master
113+
- uses: actions/download-artifact@master
114+
with:
115+
name: vsix
116+
path: ./dist/
117+
- name: Use Node.js
118+
uses: actions/setup-node@master
119+
with:
120+
node-version: 12.x
121+
- name: Prepare build
122+
id: set-version
123+
run: |
124+
VERSION=`cat ./dist/.version`
125+
echo ::set-output name=name::`cat ./dist/.name`
126+
tmp=$(mktemp)
127+
git config --global user.name 'ProjectBot'
128+
git config --global user.email '[email protected]'
129+
jq --arg version "${VERSION}-SNAPSHOT" '.version = $version' package.json > "$tmp" && mv "$tmp" package.json
130+
git add package.json
131+
git commit -m 'auto bump version with release'
132+
jq --arg version "$VERSION" '.version = $version' package.json > "$tmp" && mv "$tmp" package.json
133+
jq '.enableProposedApi = false' package.json > "$tmp" && mv "$tmp" package.json
134+
npm install
135+
npm i -g vsce ovsx
136+
git push
137+
- name: Upload Release Asset
138+
id: upload-release-asset
139+
uses: actions/upload-release-asset@master
140+
if: runner.os == 'Linux'
141+
env:
142+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
143+
with:
144+
upload_url: ${{ github.event.release.upload_url }}
145+
asset_path: ./dist/package.vsix
146+
asset_name: ${{ steps.set-version.outputs.name }}.vsix
147+
asset_content_type: application/zip
148+
- name: Publish to Marketplaces
149+
run: |
150+
vsce publish -p ${{ secrets.VSCE_TOKEN }}
151+
ovsx publish --pat ${{ secrets.OVSX_TOKEN }}
152+

.vscodeignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,10 @@
1+
.github/**
2+
.vscode/**
3+
.vscode-test/**
4+
out/test/**
15
**/*.ts
6+
**/*.map
7+
.gitignore
28
**/tsconfig.json
9+
**/tslint.json
10+
**/.eslintrc.json

package-lock.json

Lines changed: 4 additions & 89 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
},
1212
"license": "MIT",
1313
"keywords": [
14+
"intersystems",
15+
"objectscript",
1416
"multi-root ready"
1517
],
1618
"engines": {
@@ -103,7 +105,10 @@
103105
"scheme": {
104106
"type": "string",
105107
"description": "Protocol used for connections.",
106-
"enum": ["http", "https"],
108+
"enum": [
109+
"http",
110+
"https"
111+
],
107112
"default": "http"
108113
},
109114
"host": {
@@ -134,7 +139,10 @@
134139
"description": "Optional prefix for the path to the resource. Only needed when one web server publishes services on behalf of multiple InterSystems® servers."
135140
}
136141
},
137-
"required": ["host", "port"],
142+
"required": [
143+
"host",
144+
"port"
145+
],
138146
"additionalProperties": false
139147
},
140148
"username": {
@@ -150,15 +158,17 @@
150158
"description": "Optional description of the server."
151159
}
152160
},
153-
"required": ["webServer"],
161+
"required": [
162+
"webServer"
163+
],
154164
"additionalProperties": false
155165
}
156166
},
157167
"properties": {
158168
"/default": {
159169
"type": "string",
160170
"description": "Name of the default server."
161-
}
171+
}
162172
},
163173
"additionalProperties": false
164174
}

src/extension.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
'use strict';
2+
export const extensionId = "intersystems-community.servermanager";
23

34
import * as vscode from 'vscode';
45

0 commit comments

Comments
 (0)