Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to 1es pipelines [v3.x] #266

Merged
merged 1 commit into from
Jun 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

|Branch|Status|Support level|Node.js Versions|
|---|---|---|---|
|v3.x|[![Build Status](https://img.shields.io/azure-devops/build/azfunc/Azure%2520Functions/145/v3.x)](https://azfunc.visualstudio.com/Azure%20Functions/_build/latest?definitionId=145&branchName=v3.x) [![Test Status](https://img.shields.io/azure-devops/tests/azfunc/Azure%2520Functions/146/v3.x?compact_message)](https://azfunc.visualstudio.com/Azure%20Functions/_build/latest?definitionId=146&branchName=v3.x)|GA|20 (Preview), 18, 16, 14|
|v3.x|[![Build Status](https://img.shields.io/azure-devops/build/azfunc/public/514/v3.x)](https://azfunc.visualstudio.com/public/_build/latest?definitionId=514&branchName=v3.x) [![Test Status](https://img.shields.io/azure-devops/tests/azfunc/public/514/v3.x?compact_message)](https://azfunc.visualstudio.com/public/_build/latest?definitionId=514&branchName=v3.x)|GA|20, 18, 16, 14|

## Install

Expand Down
72 changes: 0 additions & 72 deletions azure-pipelines/build.yml

This file was deleted.

50 changes: 50 additions & 0 deletions azure-pipelines/official-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
parameters:
- name: IsPrerelease
type: boolean
default: true

trigger:
batch: true
branches:
include:
- v3.x

# CI only, does not trigger on PRs.
pr: none

resources:
repositories:
- repository: 1es
type: git
name: 1ESPipelineTemplates/1ESPipelineTemplates
ref: refs/tags/release

extends:
template: v1/1ES.Official.PipelineTemplate.yml@1es
parameters:
pool:
name: 1es-pool-azfunc
image: 1es-windows-2022
os: windows

stages:
- stage: WindowsUnitTests
dependsOn: []
jobs:
- template: /azure-pipelines/templates/test.yml@self

- stage: LinuxUnitTests
dependsOn: []
jobs:
- template: /azure-pipelines/templates/test.yml@self
pool:
name: 1es-pool-azfunc
image: 1es-ubuntu-22.04
os: linux

- stage: Build
dependsOn: []
jobs:
- template: /azure-pipelines/templates/build.yml@self
parameters:
IsPrerelease: ${{ parameters.IsPrerelease }}
49 changes: 49 additions & 0 deletions azure-pipelines/public-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# This build is used for public PR and CI builds.

trigger:
batch: true
branches:
include:
- v3.x

pr:
branches:
include:
- v3.x

resources:
repositories:
- repository: 1es
type: git
name: 1ESPipelineTemplates/1ESPipelineTemplates
ref: refs/tags/release

extends:
template: v1/1ES.Unofficial.PipelineTemplate.yml@1es
parameters:
pool:
name: 1es-pool-azfunc-public
image: 1es-windows-2022
os: windows

stages:
- stage: WindowsUnitTests
dependsOn: []
jobs:
- template: /azure-pipelines/templates/test.yml@self

- stage: LinuxUnitTests
dependsOn: []
jobs:
- template: /azure-pipelines/templates/test.yml@self
pool:
name: 1es-pool-azfunc-public
image: 1es-ubuntu-22.04
os: linux

- stage: Build
dependsOn: []
jobs:
- template: /azure-pipelines/templates/build.yml@self
parameters:
IsPrerelease: true
46 changes: 46 additions & 0 deletions azure-pipelines/templates/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
jobs:
- job:
templateContext:
outputs:
- output: pipelineArtifact
path: $(Build.ArtifactStagingDirectory)/dropOutput
artifact: drop
sbomBuildDropPath: '$(Build.ArtifactStagingDirectory)/dropInput'
sbomPackageName: 'Azure Functions Node.js Programming Model'
# The list of components can't be determined from the webpacked file in the staging dir, so reference the original node_modules folder
sbomBuildComponentPath: '$(Build.SourcesDirectory)/node_modules'
steps:
- task: NodeTool@0
inputs:
versionSpec: 20.x
displayName: 'Install Node.js'
- script: npm ci
displayName: 'npm ci'
- script: npm run updateVersion -- --buildNumber $(Build.BuildNumber)
displayName: 'npm run updateVersion'
condition: and(succeeded(), eq(${{ parameters.IsPrerelease }}, true))
- script: npm run build
displayName: 'npm run build'
- script: npm run minify
displayName: 'npm run minify'
- task: CopyFiles@2
displayName: 'Copy files to staging'
inputs:
sourceFolder: '$(Build.SourcesDirectory)'
contents: |
dist/**
src/**
types/**
LICENSE
package.json
README.md
targetFolder: '$(Build.ArtifactStagingDirectory)/dropInput'
cleanTargetFolder: true
- script: npm prune --production
displayName: 'npm prune --production' # so that only production dependencies are included in SBOM
- script: npm pack
displayName: 'npm pack'
workingDirectory: '$(Build.ArtifactStagingDirectory)/dropInput'
- script: mkdir dropOutput && mv dropInput/*.tgz dropOutput
displayName: 'Move package to dropOutput'
workingDirectory: '$(Build.ArtifactStagingDirectory)'
35 changes: 35 additions & 0 deletions azure-pipelines/templates/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
jobs:
- job: UnitTests

strategy:
matrix:
Node14:
NODE_VERSION: '14.x'
Node16:
NODE_VERSION: '16.x'
Node18:
NODE_VERSION: '18.x'
Node20:
NODE_VERSION: '20.x'

steps:
- task: NodeTool@0
inputs:
versionSpec: $(NODE_VERSION)
displayName: 'Install Node.js'
- script: npm ci
displayName: 'npm ci'
- script: npm run build
displayName: 'npm run build'
- script: npm run lint
displayName: 'npm run lint'
- script: npm run updateVersion -- --validate
displayName: 'validate version'
- script: npm test
displayName: 'Run unit tests'
- task: PublishTestResults@2
displayName: 'Publish Unit Test Results'
inputs:
testResultsFiles: 'test/unit-test-results.xml'
testRunTitle: '$(Agent.JobName)'
condition: succeededOrFailed()
78 changes: 0 additions & 78 deletions azure-pipelines/test.yml

This file was deleted.

3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@
"src/",
"types/",
"LICENSE",
"README.md",
"_manifest"
"README.md"
],
"scripts": {
"build": "webpack --mode development",
Expand Down