pr: none

trigger: none

parameters:
  - name: buildQuality
    displayName: Published Build Quality
    type: string
    default: insider
    values:
      - exploration
      - insider
      - stable

  - name: buildCommit
    displayName: Published Build Commit
    type: string
    default: ''

  - name: npmRegistry
    displayName: Custom NPM Registry URL
    type: string
    default: https://pkgs.dev.azure.com/monacotools/Monaco/_packaging/vscode/npm/registry/

variables:
  - name: skipComponentGovernanceDetection
    value: true
  - name: Codeql.SkipTaskAutoInjection
    value: true
  - name: BUILD_COMMIT
    ${{ if ne(parameters.buildCommit, '') }}:
      value: ${{ parameters.buildCommit }}
    ${{ else }}:
      value: $(resources.pipeline.vscode.sourceCommit)
  - name: BUILD_QUALITY
    ${{ if ne(parameters.buildCommit, '') }}:
      value: ${{ parameters.buildQuality }}
    ${{ elseif startsWith(variables['Build.SourceBranch'], 'refs/heads/release/') }}:
      value: stable
    ${{ else }}:
      value: insider
  - name: NPM_REGISTRY
    value: ${{ parameters.npmRegistry }}

name: "$(Date:yyyyMMdd).$(Rev:r) (${{ parameters.buildQuality }} ${{ parameters.buildCommit }})"

resources:
  repositories:
    - repository: 1esPipelines
      type: git
      name: 1ESPipelineTemplates/1ESPipelineTemplates
      ref: refs/tags/release
  pipelines:
    - pipeline: vscode
      # allow-any-unicode-next-line
      source: '⭐️ VS Code'
      trigger:
        stages:
          - Publish
        branches:
          include:
            - main
            - release/*

extends:
  template: v1/1ES.Official.PipelineTemplate.yml@1esPipelines
  parameters:
    sdl:
      tsa:
        enabled: false
      codeql:
        compiled:
          enabled: false
          justificationForDisabling: Sanity tests only, no code compilation
      credscan:
        suppressionsFile: $(Build.SourcesDirectory)/build/azure-pipelines/config/CredScanSuppressions.json
      eslint:
        enabled: false
      sourceAnalysisPool: 1es-windows-2022-x64
      createAdoIssuesForJustificationsForDisablement: false
    stages:
      - stage: sanity_tests
        displayName: Sanity Tests
        jobs:
          # macOS
          - template: build/azure-pipelines/common/sanity-tests.yml@self
            parameters:
              name: macos_x64
              displayName: MacOS x64 (no runtime)
              poolName: AcesShared
              os: macOS
              args: --no-detection --grep "darwin-x64"

          - template: build/azure-pipelines/common/sanity-tests.yml@self
            parameters:
              name: macos_arm64
              displayName: MacOS arm64
              poolName: AcesShared
              os: macOS

          # Windows
          - template: build/azure-pipelines/common/sanity-tests.yml@self
            parameters:
              name: windows_x64
              displayName: Windows x64
              poolName: 1es-windows-2022-x64
              os: windows

          - template: build/azure-pipelines/common/sanity-tests.yml@self
            parameters:
              name: windows_arm64
              displayName: Windows arm64
              poolName: 1es-windows-2022-arm64
              os: windows
              arch: arm64

          # Alpine 3.22
          - template: build/azure-pipelines/common/sanity-tests.yml@self
            parameters:
              name: alpine_amd64
              displayName: Alpine 3.22 amd64
              poolName: 1es-ubuntu-22.04-x64
              container: alpine
              arch: amd64

          - template: build/azure-pipelines/common/sanity-tests.yml@self
            parameters:
              name: alpine_arm64
              displayName: Alpine 3.22 arm64
              poolName: 1es-azure-linux-3-arm64
              container: alpine
              arch: arm64

          # CentOS Stream 9
          - template: build/azure-pipelines/common/sanity-tests.yml@self
            parameters:
              name: centos_stream9_amd64
              displayName: CentOS Stream 9 amd64
              poolName: 1es-ubuntu-22.04-x64
              container: centos
              arch: amd64

          - template: build/azure-pipelines/common/sanity-tests.yml@self
            parameters:
              name: centos_stream9_arm64
              displayName: CentOS Stream 9 arm64
              poolName: 1es-azure-linux-3-arm64
              container: centos
              arch: arm64

          # Debian 10
          - template: build/azure-pipelines/common/sanity-tests.yml@self
            parameters:
              name: debian_10_amd64
              displayName: Debian 10 amd64
              poolName: 1es-ubuntu-22.04-x64
              container: debian-10
              arch: amd64

          - template: build/azure-pipelines/common/sanity-tests.yml@self
            parameters:
              name: debian_10_arm32
              displayName: Debian 10 arm32
              poolName: 1es-azure-linux-3-arm64
              container: debian-10
              arch: arm

          - template: build/azure-pipelines/common/sanity-tests.yml@self
            parameters:
              name: debian_10_arm64
              displayName: Debian 10 arm64
              poolName: 1es-azure-linux-3-arm64
              container: debian-10
              arch: arm64

          # Debian 12
          - template: build/azure-pipelines/common/sanity-tests.yml@self
            parameters:
              name: debian_12_amd64
              displayName: Debian 12 amd64
              poolName: 1es-ubuntu-22.04-x64
              container: debian-12
              arch: amd64

          - template: build/azure-pipelines/common/sanity-tests.yml@self
            parameters:
              name: debian_12_arm32
              displayName: Debian 12 arm32
              poolName: 1es-azure-linux-3-arm64
              container: debian-12
              arch: arm

          - template: build/azure-pipelines/common/sanity-tests.yml@self
            parameters:
              name: debian_12_arm64
              displayName: Debian 12 arm64
              poolName: 1es-azure-linux-3-arm64
              container: debian-12
              arch: arm64

          # Fedora 36
          - template: build/azure-pipelines/common/sanity-tests.yml@self
            parameters:
              name: fedora_36_amd64
              displayName: Fedora 36 amd64
              poolName: 1es-ubuntu-22.04-x64
              container: fedora
              baseImage: fedora:36
              arch: amd64

          - template: build/azure-pipelines/common/sanity-tests.yml@self
            parameters:
              name: fedora_36_arm64
              displayName: Fedora 36 arm64
              poolName: 1es-azure-linux-3-arm64
              container: fedora
              baseImage: fedora:36
              arch: arm64

          # Fedora 40
          - template: build/azure-pipelines/common/sanity-tests.yml@self
            parameters:
              name: fedora_40_amd64
              displayName: Fedora 40 amd64
              poolName: 1es-ubuntu-22.04-x64
              container: fedora
              baseImage: fedora:40
              arch: amd64

          - template: build/azure-pipelines/common/sanity-tests.yml@self
            parameters:
              name: fedora_40_arm64
              displayName: Fedora 40 arm64
              poolName: 1es-azure-linux-3-arm64
              container: fedora
              baseImage: fedora:40
              arch: arm64

          # openSUSE Leap 16.0
          - template: build/azure-pipelines/common/sanity-tests.yml@self
            parameters:
              name: opensuse_leap_amd64
              displayName: openSUSE Leap 16.0 amd64
              poolName: 1es-ubuntu-22.04-x64
              container: opensuse
              arch: amd64

          - template: build/azure-pipelines/common/sanity-tests.yml@self
            parameters:
              name: opensuse_leap_arm64
              displayName: openSUSE Leap 16.0 arm64
              poolName: 1es-azure-linux-3-arm64
              container: opensuse
              arch: arm64

          # Red Hat UBI 9
          - template: build/azure-pipelines/common/sanity-tests.yml@self
            parameters:
              name: redhat_ubi9_amd64
              displayName: Red Hat UBI 9 amd64
              poolName: 1es-ubuntu-22.04-x64
              container: redhat
              arch: amd64

          - template: build/azure-pipelines/common/sanity-tests.yml@self
            parameters:
              name: redhat_ubi9_arm64
              displayName: Red Hat UBI 9 arm64
              poolName: 1es-azure-linux-3-arm64
              container: redhat
              arch: arm64

          # Ubuntu 22.04 Native (Snap coverage)
          - template: build/azure-pipelines/common/sanity-tests.yml@self
            parameters:
              name: ubuntu_native_x64
              displayName: Ubuntu 22.04 x64 Native
              poolName: 1es-ubuntu-22.04-x64
              os: linux

          # Ubuntu 22.04
          - template: build/azure-pipelines/common/sanity-tests.yml@self
            parameters:
              name: ubuntu_22_04_amd64
              displayName: Ubuntu 22.04 amd64
              poolName: 1es-ubuntu-22.04-x64
              container: ubuntu
              baseImage: ubuntu:22.04
              arch: amd64

          - template: build/azure-pipelines/common/sanity-tests.yml@self
            parameters:
              name: ubuntu_22_04_arm32
              displayName: Ubuntu 22.04 arm32
              poolName: 1es-azure-linux-3-arm64
              container: ubuntu
              baseImage: ubuntu:22.04
              arch: arm

          - template: build/azure-pipelines/common/sanity-tests.yml@self
            parameters:
              name: ubuntu_22_04_arm64
              displayName: Ubuntu 22.04 arm64
              poolName: 1es-azure-linux-3-arm64
              container: ubuntu
              baseImage: ubuntu:22.04
              arch: arm64

          # Ubuntu 24.04
          - template: build/azure-pipelines/common/sanity-tests.yml@self
            parameters:
              name: ubuntu_24_04_amd64
              displayName: Ubuntu 24.04 amd64
              poolName: 1es-ubuntu-22.04-x64
              container: ubuntu
              baseImage: ubuntu:24.04
              arch: amd64

          - template: build/azure-pipelines/common/sanity-tests.yml@self
            parameters:
              name: ubuntu_24_04_arm32
              displayName: Ubuntu 24.04 arm32
              poolName: 1es-azure-linux-3-arm64
              container: ubuntu
              baseImage: ubuntu:24.04
              arch: arm

          - template: build/azure-pipelines/common/sanity-tests.yml@self
            parameters:
              name: ubuntu_24_04_arm64
              displayName: Ubuntu 24.04 arm64
              poolName: 1es-azure-linux-3-arm64
              container: ubuntu
              baseImage: ubuntu:24.04
              arch: arm64
