# ==================================================================================
# Pipeline for CMake Tools API CG
# ==================================================================================

trigger: none

schedules:
- cron: 0 6 * * 0
  branches:
    include:
    - main
  always: true

resources:
  repositories:
  - repository: self
    type: git
    ref: refs/heads/main
  - repository: MicroBuildTemplate
    type: git
    name: 1ESPipelineTemplates/MicroBuildTemplate
    ref: refs/tags/release

name: $(Date:yyyyMMdd).$(Rev:r)

variables:
- name: Codeql.Enabled
  value: true
- name: Codeql.TSAEnabled
  value: true
- name: TeamName
  value: C++ Cross Platform and Cloud

extends:
  template: azure-pipelines/MicroBuild.1ES.Official.yml@MicroBuildTemplate
  parameters:
    pool:
      name: AzurePipelines-EO
      image: 1ESPT-Windows2022
      os: windows
    sdl:
      sourceAnalysisPool: 
        name: AzurePipelines-EO
        image: 1ESPT-Windows2022
        os: windows
    customBuildTags:
    - ES365AIMigrationTooling
    stages:
    - stage: stage
      jobs:
      - job: Job_1
        displayName: Agent job 1
        templateContext:
          outputs:
          - output: pipelineArtifact
            displayName: 'Publish Artifact: SBOM'
            targetPath: $(Build.ArtifactStagingDirectory)
            sbomBuildDropPath: $(Build.SourcesDirectory) 
            artifactName: SBOM
        steps:
        - checkout: self
          fetchTags: false
        
        - task: NodeTool@0
          displayName: Use Node 16.x
          inputs:
            versionSpec: 16.x
        
        - task: Npm@1
          displayName: npm install
          inputs:
            verbose: false
        
        - task: DeleteFiles@1
          displayName: Remove code that should not be scanned
          inputs:
            Contents: |
              node_modules