Update version, dependencies #114
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: ci | |
on: | |
pull_request: | |
push: | |
branches: | |
- main | |
workflow_call: | |
inputs: | |
version: | |
description: Version to build. | |
required: false | |
type: string | |
default: '' | |
outputs: | |
node-version: | |
description: Version of node used to build package. | |
value: ${{ jobs.test.outputs.node-version }} | |
package-name: | |
description: Name of the package built. | |
value: ${{ jobs.test.outputs.package-name }} | |
permissions: | |
checks: write | |
statuses: write | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
test: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
node-version: | |
- '18.x' | |
os: | |
- macos-latest | |
- ubuntu-latest | |
- windows-latest | |
vscode-channel: | |
- stable | |
- insiders | |
include: | |
- os: ubuntu-latest | |
vscode-channel: stable | |
build-package: true | |
outputs: | |
node-version: ${{ steps.package.outputs.node-version }} | |
package-name: ${{ steps.package.outputs.package-name }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup Node ${{ matrix.node-version }} | |
uses: actions/setup-node@v3 | |
with: | |
cache: npm | |
node-version: ${{ matrix.node-version }} | |
- name: Install dependencies | |
run: npm ci | |
- name: Test (Linux) | |
if: runner.os == 'Linux' | |
run: xvfb-run -a npm test | |
env: | |
CODE_VERSION: ${{ matrix.vscode-channel }} | |
TEST_RESULTS_PATH: ${{ github.workspace }}/.vscode-test/test-results.xml | |
- name: Test | |
if: runner.os != 'Linux' | |
run: npm test | |
env: | |
CODE_VERSION: ${{ matrix.vscode-channel }} | |
TEST_RESULTS_PATH: ${{ github.workspace }}/.vscode-test/test-results.xml | |
- name: Publish test results | |
uses: dorny/test-reporter@v1 | |
with: | |
name: test-results-${{ matrix.os }}-${{ matrix.vscode-channel }} | |
path: .vscode-test/test-results.xml | |
reporter: jest-junit | |
- id: package | |
name: Package | |
run: | | |
BUILD_VERSION="${{ inputs.version }}" | |
if [[ -z "${BUILD_VERSION}" ]]; then | |
BUILD_VERSION="$(npm pkg get version | tr -d \")-pre" | |
fi | |
BUILD_VERSION="${BUILD_VERSION#v}" | |
echo "BUILD_VERSION=${BUILD_VERSION}" >> $GITHUB_ENV | |
npm install -g @vscode/vsce | |
vsce package -o "${{ runner.temp }}/vscode-guid-${BUILD_VERSION}.vsix" | |
echo "node-version=${{ matrix.node-version }}" >> $GITHUB_OUTPUT | |
echo "package-name=vscode-guid-${BUILD_VERSION}.vsix" >> $GITHUB_OUTPUT | |
if: matrix.build-package | |
- name: Upload package | |
uses: actions/upload-artifact@v3 | |
with: | |
name: artifact | |
path: ${{ runner.temp }}/vscode-guid-${{ env.BUILD_VERSION }}.vsix | |
if: matrix.build-package | |
check: | |
needs: test | |
runs-on: ubuntu-latest | |
if: ${{ !cancelled() }} | |
steps: | |
- name: Check | |
run: | | |
if [[ "${{ needs.test.result }}" != "success" ]]; then | |
exit 1 | |
fi | |
echo "All tests passed :tada:" >> $GITHUB_STEP_SUMMARY |