Build VSCode extension #13049
Workflow file for this run
This file contains hidden or 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: Build VSCode extension | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| merge_group: | |
| permissions: | |
| contents: read | |
| jobs: | |
| test_and_generate_binaries: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| binaries: | |
| - architecture: win-x64 | |
| os: windows-latest | |
| - architecture: win-arm64 | |
| os: windows-11-arm #preview image | |
| - architecture: linux-x64 | |
| os: ubuntu-latest | |
| - architecture: linux-arm64 | |
| os: ubuntu-24.04-arm #preview image | |
| - architecture: osx-arm64 | |
| os: macOS-latest | |
| runs-on: ${{ matrix.binaries.os }} | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 | |
| with: | |
| node-version: 22.x | |
| - name: Use .NET 10 | |
| uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 # v6.0.0 | |
| with: | |
| dotnet-version: "10.0.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 | |
| $releaseVersion = "$releaseVersion" -replace '^v', '' | |
| Write-Output "RELEASE_VERSION=$releaseVersion" >> $Env:GITHUB_OUTPUT | |
| shell: pwsh | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - run: scripts/update-vscode-releases.ps1 -version "v${{ steps.last_release.outputs.RELEASE_VERSION }}" -packageJsonFilePath "./vscode/packages/microsoft-kiota/package.json" -runtimeFilePath "./vscode/packages/npm-package/lib/runtime.json" -online | |
| shell: pwsh | |
| - name: Install dependencies | |
| run: npm ci | |
| working-directory: vscode | |
| - name: Publish kiota for testing - ${{ matrix.binaries.os }} - ${{ matrix.binaries.architecture }} | |
| run: | | |
| dotnet publish src/kiota/kiota.csproj -c Release --runtime ${{ matrix.binaries.architecture }} -p:PublishSingleFile=true --self-contained --output vscode/packages/npm-package/.kiotabin/${{ steps.last_release.outputs.RELEASE_VERSION }}/${{ matrix.binaries.architecture }} -f net10.0 | |
| shell: pwsh | |
| - name: Lint | |
| run: npm run lint | |
| working-directory: vscode | |
| - name: Run tests - package | |
| run: | | |
| if [[ "${{ matrix.binaries.os }}" == "ubuntu-latest" ]]; then | |
| xvfb-run -a npm run test:package:coverage | |
| else | |
| npm run test:package:coverage | |
| fi | |
| shell: bash | |
| working-directory: vscode | |
| - name: Run tests - vscode | |
| run: | | |
| if [[ "${{ matrix.binaries.os }}" == "ubuntu-latest" ]]; then | |
| xvfb-run -a npm run test:vscode:coverage | |
| else | |
| npm run test:vscode:coverage | |
| fi | |
| shell: bash | |
| working-directory: vscode | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | |
| with: | |
| name: ${{ matrix.binaries.architecture }} | |
| path: vscode/packages/npm-package/.kiotabin/${{ steps.last_release.outputs.RELEASE_VERSION }}/${{ matrix.binaries.architecture }} | |
| retention-days: 3 | |
| build: | |
| needs: [test_and_generate_binaries] | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| builds: | |
| - name: "VS Code Extension" | |
| path: "microsoft-kiota" | |
| id: "vscode" | |
| item: "vsix" | |
| - name: "Npm Package" | |
| path: "npm-package" | |
| id: "package" | |
| item: "tgz" | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 | |
| with: | |
| node-version: 22.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 }}" -packageJsonFilePath "./vscode/packages/microsoft-kiota/package.json" -runtimeFilePath "./vscode/packages/npm-package/lib/runtime.json" -online | |
| shell: pwsh | |
| - name: Install dependencies | |
| run: npm ci | |
| working-directory: vscode | |
| - run: npm run package:${{ matrix.builds.id }} | |
| if: matrix.builds.id == 'package' | |
| name: "Package - ${{ matrix.builds.id }}" | |
| working-directory: vscode | |
| - run: | | |
| npm i | |
| npm run build | |
| working-directory: vscode/packages/ | |
| name: "Package - ${{ matrix.builds.id }}" | |
| if: matrix.builds.id == 'vscode' | |
| - run: | | |
| npm i -g @vscode/vsce | |
| vsce package | |
| working-directory: vscode/packages/${{ matrix.builds.path }} | |
| name: "Package - ${{ matrix.builds.id }}" | |
| if: matrix.builds.id == 'vscode' | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | |
| with: | |
| name: ${{ matrix.builds.name }} | |
| path: vscode/packages/${{ matrix.builds.path }}/*.${{ matrix.builds.item }} | |
| build_extension: | |
| runs-on: ubuntu-latest | |
| needs: build | |
| if: always() | |
| steps: | |
| - name: All build matrix options are successful | |
| if: ${{ !(contains(needs.*.result, 'failure')) }} | |
| run: exit 0 | |
| - name: One or more build matrix options failed | |
| if: ${{ contains(needs.*.result, 'failure') }} | |
| run: exit 1 |