Skip to content

Telemetry PoC

Telemetry PoC #7940

name: Build VSCode extension
on:
workflow_dispatch:
push:
branches: [main]
pull_request:
permissions:
contents: read
jobs:
checksecret:
name: check if SONAR_TOKEN is set in github secrets
runs-on: ubuntu-latest
outputs:
is_SONAR_TOKEN_set: ${{ steps.checksecret_job.outputs.is_SONAR_TOKEN_set }}
steps:
- name: Check whether unity activation requests should be done
id: checksecret_job
run: |
echo "is_SONAR_TOKEN_set=${{ env.SONAR_TOKEN != '' }}" >> $GITHUB_OUTPUT
build_extension:
needs: [checksecret]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20.x
- id: last_release
run: |
$releaseVersion = gh release list --exclude-drafts --exclude-pre-releases --json tagName,isLatest | ConvertFrom-Json | ? {$_.isLatest -eq $true} | select -first 1 -ExpandProperty tagName
Write-Output "RELEASE_VERSION=$releaseVersion" >> $Env:GITHUB_OUTPUT
shell: pwsh
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- run: scripts/update-vscode-releases.ps1 -version "${{ steps.last_release.outputs.RELEASE_VERSION }}" -filePath "./vscode/microsoft-kiota/package.json" -online
shell: pwsh
- name: Install dependencies
run: npm ci
working-directory: vscode/microsoft-kiota
- run: npm run lint
working-directory: vscode/microsoft-kiota
- name: run tests(linux)
if: runner.os == 'Linux'
run: xvfb-run -a npm run test-with-coverage
working-directory: vscode/microsoft-kiota
- name: run tests
if: runner.os != 'Linux'
run: npm run test-with-coverage
working-directory: vscode/microsoft-kiota
- name: Run sonar cloud analysis
if: needs.checksecret.outputs.is_SONAR_TOKEN_set == 'true'
uses: SonarSource/sonarqube-scan-action@v5
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
with:
projectBaseDir: vscode/microsoft-kiota
- run: npm run package
working-directory: vscode/microsoft-kiota
- run: npm i -g @vscode/vsce
- run: vsce package
working-directory: vscode/microsoft-kiota
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: vscode-extension
path: vscode/microsoft-kiota/*.vsix