Skip to content

Commit

Permalink
chore: also run tests for minimum supported version
Browse files Browse the repository at this point in the history
  • Loading branch information
sockmaster27 committed Mar 17, 2024
1 parent 76b8526 commit 7c7aa4c
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 5 deletions.
40 changes: 35 additions & 5 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,44 @@ on:
branches: [ master ]

jobs:
build:
configure:
runs-on: ubuntu-latest
outputs:
minimum-version: ${{ steps.minver.outputs.version }}
steps:
- uses: actions/checkout@v4
- name: Read package.json
id: package
# Reads the contents of `pacakge.json` into `steps.package.outputs.content`
run: |
content=`cat ./package.json`
content="${content//'%'/'%25'}"
content="${content//$'\n'/'%0A'}"
content="${content//$'\r'/'%0D'}"
echo "::set-output name=content::$content"
- name: Extract minimum version
id: minver
# Reads the contents of the `engines.vscode` field into `steps.minver.outputs.version` with the leading ^ removed.
run: |
version=${{ fromJson(steps.package.outputs.content).engines.vscode }}
version=${version#^}
echo "::set-output name=version::$version"
check:
runs-on: ubuntu-latest
needs: configure

strategy:
matrix:
node-version: [18.x, 20.x]
vscode-version:
- ${{ needs.configure.outputs.minimum-version }}
- stable
node-version:
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
- 18.x
- 20.x

steps:
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
Expand All @@ -31,7 +59,9 @@ jobs:
node-version: ${{ matrix.node-version }}
- name: Install dependencies
run: npm ci
- name: Run tests
- name: Run tests on VS Code ${{ matrix.vscode-version }}
run: xvfb-run -a npm test
env:
VSCODE_VERSION: ${{ matrix.vscode-version }}
- name: Package extension
run: npx @vscode/vsce package
run: npx --yes @vscode/vsce package
8 changes: 8 additions & 0 deletions .vscode-test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
const { defineConfig } = require('@vscode/test-cli')

/**
* The desired version of VS Code can be optionally passed as an environment variable, for example:
* - `stable`
* - `1.80.0`
*/
let version = process.env.VSCODE_VERSION

module.exports = defineConfig({
version,
files: ['test/out/**/*.test.js'],
workspaceFolder: 'test/testWorkspace',

Expand Down

0 comments on commit 7c7aa4c

Please sign in to comment.