diff --git a/README.md b/README.md index 7dc3ab7..1523885 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,8 @@ |Branch|Status|Support level|Node.js Versions| |---|---|---|---| -|v4.x (default)|[![Build Status](https://img.shields.io/azure-devops/build/azfunc/Azure%2520Functions/145/v4.x)](https://azfunc.visualstudio.com/Azure%20Functions/_build/latest?definitionId=145&branchName=v4.x) [![Test Status](https://img.shields.io/azure-devops/tests/azfunc/Azure%2520Functions/146/v4.x?compact_message)](https://azfunc.visualstudio.com/Azure%20Functions/_build/latest?definitionId=146&branchName=v4.x)|GA|20, 18| -|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, 18, 16, 14| +|v4.x (default)|[![Build Status](https://img.shields.io/azure-devops/build/azfunc/public/514/v4.x)](https://azfunc.visualstudio.com/public/_build/latest?definitionId=514&branchName=v4.x) [![Test Status](https://img.shields.io/azure-devops/tests/azfunc/public/514/v4.x?compact_message)](https://azfunc.visualstudio.com/public/_build/latest?definitionId=514&branchName=v4.x)|GA|20, 18| +|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| > _**Version 4 is Generally Available! 🎉✨ Read our [blog post](https://aka.ms/AzFuncNodeV4) and let us know what you think by reacting or commenting on our [GA discussion thread](https://aka.ms/AzFuncNodeV4Discussion)**_ diff --git a/azure-pipelines/official-build.yml b/azure-pipelines/official-build.yml new file mode 100644 index 0000000..ee01b95 --- /dev/null +++ b/azure-pipelines/official-build.yml @@ -0,0 +1,50 @@ +parameters: + - name: IsPrerelease + type: boolean + default: true + +trigger: + batch: true + branches: + include: + - v4.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 }} diff --git a/azure-pipelines/public-build.yml b/azure-pipelines/public-build.yml new file mode 100644 index 0000000..58cf913 --- /dev/null +++ b/azure-pipelines/public-build.yml @@ -0,0 +1,49 @@ +# This build is used for public PR and CI builds. + +trigger: + batch: true + branches: + include: + - v4.x + +pr: + branches: + include: + - v4.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 diff --git a/azure-pipelines/build.yml b/azure-pipelines/templates/build.yml similarity index 50% rename from azure-pipelines/build.yml rename to azure-pipelines/templates/build.yml index 7041263..63dd49b 100644 --- a/azure-pipelines/build.yml +++ b/azure-pipelines/templates/build.yml @@ -1,26 +1,18 @@ -parameters: - - name: IsPrerelease - type: boolean - default: true - -pr: - branches: - include: - - v4.x - -trigger: - - v4.x - jobs: - - job: BuildArtifacts - pool: - name: '1ES-Hosted-AzFunc' - demands: - - ImageOverride -equals MMS2019TLS + - 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: 18.x + versionSpec: 20.x displayName: 'Install Node.js' - script: npm ci displayName: 'npm ci' @@ -42,33 +34,13 @@ jobs: LICENSE package.json README.md - targetFolder: '$(Build.ArtifactStagingDirectory)' + targetFolder: '$(Build.ArtifactStagingDirectory)/dropInput' cleanTargetFolder: true - script: npm prune --production displayName: 'npm prune --production' # so that only production dependencies are included in SBOM - - task: ManifestGeneratorTask@0 - displayName: 'Generate SBOM' - inputs: - BuildDropPath: '$(Build.ArtifactStagingDirectory)' - # The list of components can't be determined from the webpacked file in the staging dir, so reference the original node_modules folder - BuildComponentPath: '$(Build.SourcesDirectory)/node_modules' - PackageName: 'Azure Functions Node.js Framework' - 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)' - - task: CopyFiles@2 - displayName: 'Copy package to staging drop folder' - inputs: - sourceFolder: '$(Build.ArtifactStagingDirectory)' - contents: | - *.tgz - targetFolder: '$(Build.ArtifactStagingDirectory)/drop' - cleanTargetFolder: true - - task: PublishPipelineArtifact@1 - displayName: 'Publish drop' - inputs: - targetPath: '$(Build.ArtifactStagingDirectory)/drop' - artifact: 'drop' - publishLocation: 'pipeline' - - task: ms.vss-governance-buildtask.governance-build-task-component-detection.ComponentGovernanceComponentDetection@0 - displayName: 'Component Detection' diff --git a/azure-pipelines/templates/test.yml b/azure-pipelines/templates/test.yml new file mode 100644 index 0000000..ea04f4f --- /dev/null +++ b/azure-pipelines/templates/test.yml @@ -0,0 +1,31 @@ +jobs: + - job: UnitTests + + strategy: + matrix: + 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() diff --git a/azure-pipelines/test.yml b/azure-pipelines/test.yml deleted file mode 100644 index 9ea03d5..0000000 --- a/azure-pipelines/test.yml +++ /dev/null @@ -1,55 +0,0 @@ -variables: { NODE_18: '18.x', NODE_20: '20.x' } - -pr: - branches: - include: - - v4.x - -trigger: - - v4.x - -jobs: - - job: UnitTests - strategy: - matrix: - UBUNTU_NODE18: - IMAGE_TYPE: 'ubuntu-latest' - NODE_VERSION: $(NODE_18) - WINDOWS_NODE18: - IMAGE_TYPE: 'windows-latest' - NODE_VERSION: $(NODE_18) - MAC_NODE18: - IMAGE_TYPE: 'macOS-latest' - NODE_VERSION: $(NODE_18) - UBUNTU_NODE20: - IMAGE_TYPE: 'ubuntu-latest' - NODE_VERSION: $(NODE_20) - WINDOWS_NODE20: - IMAGE_TYPE: 'windows-latest' - NODE_VERSION: $(NODE_20) - MAC_NODE20: - IMAGE_TYPE: 'macOS-latest' - NODE_VERSION: $(NODE_20) - pool: - vmImage: $(IMAGE_TYPE) - 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() diff --git a/package.json b/package.json index afea4f1..010269e 100644 --- a/package.json +++ b/package.json @@ -25,8 +25,7 @@ "src/", "types/", "LICENSE", - "README.md", - "_manifest" + "README.md" ], "engines": { "node": ">=18.0"