Skip to content

Commit

Permalink
✨ Integrating release workflow - initial build, test, package, and up…
Browse files Browse the repository at this point in the history
…load artifacts to the ci runs. (#34)

This workflow builds the package, runs tests, and packages the
extension. It also uploads it to the GH ci runs. Supports
linux, macos, windows.
ref issue: #11

Signed-off-by: Savitha Raghunathan <saveetha13@gmail.com>
  • Loading branch information
savitharaghunathan authored Oct 3, 2024
1 parent 5d3d5e3 commit 3984bdc
Show file tree
Hide file tree
Showing 5 changed files with 166 additions and 85 deletions.
184 changes: 155 additions & 29 deletions .github/workflows/ci-repo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,48 @@ on:
branches:
- "main"
- "release-*"

workflow_dispatch:
inputs:
shouldRelease:
description: 'Should a release be created?'
required: false
default: 'false'

workflow_call:

inputs:
shouldRelease:
type: boolean
description: 'Should a release be created?'
required: false
default: false


concurrency:
group: ci-repo-${{ github.event_name }}-${{ github.ref }}
cancel-in-progress: true

jobs:
package-tests:
runs-on: ubuntu-latest
build:
name: Build (${{ matrix.arch }})
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
arch: linux
- os: macos-latest
arch: macos
- os: windows-latest
arch: windows
max-parallel: 3

steps:
- name: Check-out repository
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ github.ref }}

- name: Use Node.js from .nvmrc
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version-file: "vscode/.nvmrc"
Expand All @@ -39,43 +63,145 @@ jobs:
key: ${{ runner.os }}-node-${{ hashFiles('vscode/package-lock.json') }}

- name: Install dependencies
working-directory: ./vscode
run: |
cd vscode
npm version
npm ci
- name: Lint sources
run: |
cd vscode
npm run lint
working-directory: ./vscode
run: npm run lint

test:
name: Test (${{ matrix.arch }})
runs-on: ${{ matrix.os }}
needs: build
strategy:
matrix:
include:
- os: ubuntu-latest
arch: linux
- os: macos-latest
arch: macos
- os: windows-latest
arch: windows

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version-file: "vscode/.nvmrc"

- name: Install dependencies
working-directory: ./vscode
run: npm ci

# Run tests on Linux
- name: Run tests (Linux)
if: matrix.arch == 'linux'
working-directory: ./vscode
run:
xvfb-run -a npm run test

# Run tests on macOS
- name: Run tests (macOS)
if: matrix.arch == 'macos'
working-directory: ./vscode
run: npm test

# Run tests on Windows
- name: Run tests (Windows)
if: matrix.arch == 'windows'
working-directory: ./vscode
shell: cmd
run: npm test

package:
name: Package (${{ matrix.arch }})
runs-on: ${{ matrix.os }}
needs: test
strategy:
matrix:
include:
- os: ubuntu-latest
arch: linux
- os: macos-latest
arch: macos
- os: windows-latest
arch: windows
max-parallel: 3

- name: Build
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version-file: "vscode/.nvmrc"

- name: Install dependencies
working-directory: ./vscode
run: npm ci

- name: Build Package
working-directory: ./vscode
run: npm run package

- name: Generate .vsix package
working-directory: ./vscode
run: |
cd vscode
npm run package
npm install @vscode/vsce
npx vsce package
- name: Upload VSIX artifact
uses: actions/upload-artifact@v4
with:
name: vscode-extension-${{ matrix.arch }}
path: "vscode/*.vsix"

vscode-tests:
release:
name: Release
runs-on: ubuntu-latest
needs: package
if: |
github.ref == 'refs/heads/main' &&
(github.event.inputs.shouldRelease == 'true' || github.event.inputs.shouldRelease == true)
steps:
- name: Check-out repository
- name: Checkout code
uses: actions/checkout@v4

- name: Use Node.js from .nvmrc
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version-file: "vscode/.nvmrc"

- name: Cache extension node_modules
uses: actions/cache@v3
- name: Download VSIX artifacts
uses: actions/download-artifact@v3
with:
path: vscode/node_modules
key: ${{ runner.os }}-node-${{ hashFiles('vscode/package-lock.json') }}
path: ./artifacts

- run: |
cd vscode
npm ci
- run: |
cd vscode
xvfb-run -a npm run test
- name: Read version from package.json
id: get_version
working-directory: ./vscode
run: echo "version=$(node -p \"require('./package.json').version\")" >> $GITHUB_OUTPUT

- name: Generate tag name with timestamp
id: vars
shell: bash
run: |
TAG_NAME="v${{ steps.get_version.outputs.version }}-dev+$(date +%Y%m%d)"
echo "tag_name=$TAG_NAME" >> $GITHUB_OUTPUT
- name: Create Pre-release
uses: ncipollo/release-action@v1
with:
tag: ${{ steps.vars.outputs.tag_name }}
commit: ${{ github.sha }}
artifacts: "./artifacts/**/*.vsix"
prerelease: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 2 additions & 0 deletions .github/workflows/nightly-ci-repo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ on:
jobs:
nightly:
uses: ./.github/workflows/ci-repo.yml
with:
shouldRelease: true
2 changes: 1 addition & 1 deletion vscode/.nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v20.13.0
v20.13.1
3 changes: 2 additions & 1 deletion vscode/.vscodeignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.vscode/**
.vscode-test/**
out/**
test_out/**
node_modules/**
src/**
.gitignore
Expand All @@ -12,3 +12,4 @@ vsc-extension-quickstart.md
**/*.map
**/*.ts
**/.vscode-test.*
test_out/*
60 changes: 6 additions & 54 deletions vscode/README.md
Original file line number Diff line number Diff line change
@@ -1,71 +1,23 @@
# konveyor-vscode README
# konveyor-vscode

This is the README for your extension "konveyor-vscode". After writing up a brief description, we recommend including the following sections.
This extension allows the user to run Konveyor AI from VSCode.

## Features

Describe specific features of your extension including screenshots of your extension in action. Image paths are relative to this README file.

For example if there is an image subfolder under your extension project workspace:

\!\[feature X\]\(images/feature-x.png\)

> Tip: Many popular extensions utilize animations. This is an excellent way to show off your extension! We recommend short, focused animations that are easy to follow.
TODO

## Requirements

If you have any requirements or dependencies, add a section describing those and how to install and configure them.
TODO

## Extension Settings

Include if your extension adds any VS Code settings through the `contributes.configuration` extension point.

For example:

This extension contributes the following settings:

* `myExtension.enable`: Enable/disable this extension.
* `myExtension.thing`: Set to `blah` to do something.

## Known Issues

Calling out known issues can help limit users opening duplicate issues against your extension.
TODO

## Release Notes

Users appreciate release notes as you update your extension.

### 1.0.0

Initial release of ...

### 1.0.1

Fixed issue #.

### 1.1.0

Added features X, Y, and Z.

---

## Following extension guidelines

Ensure that you've read through the extensions guidelines and follow the best practices for creating your extension.

* [Extension Guidelines](https://code.visualstudio.com/api/references/extension-guidelines)

## Working with Markdown

You can author your README using Visual Studio Code. Here are some useful editor keyboard shortcuts:

* Split the editor (`Cmd+\` on macOS or `Ctrl+\` on Windows and Linux).
* Toggle preview (`Shift+Cmd+V` on macOS or `Shift+Ctrl+V` on Windows and Linux).
* Press `Ctrl+Space` (Windows, Linux, macOS) to see a list of Markdown snippets.

## For more information

* [Visual Studio Code's Markdown Support](http://code.visualstudio.com/docs/languages/markdown)
* [Markdown Syntax Reference](https://help.github.com/articles/markdown-basics/)
TODO

**Enjoy!**

0 comments on commit 3984bdc

Please sign in to comment.