Azure DevOps Continuous Integration (CI) For SharePoint .

3y ago
27 Views
3 Downloads
1.08 MB
13 Pages
Last View : 6d ago
Last Download : 3m ago
Upload by : Macey Ridenour
Transcription

Azure DevOps – Continuous Integration (CI) for SharePoint DevelopmentSep 2019

Revision HistoryVersionNameRevision descriptionDate1.0Manjunath PoolaFinal Version10/09/20192019 Sogeti. All rights reserved.Azure DevOps for SPFx2

Table of Contents1.Introduction . 4Continuous Integration (CI) . 42.Conclusion . 113.References . 122019 Sogeti. All rights reserved.Azure DevOps for SPFx3

1. IntroductionAzure DevOps (Visual Studio Team Services/Team Foundation Server) can be implemented fordevelopment projects where SharePoint Framework is used on O365.Azure DevOps consists of tools that help developers to implement Continuous Integration, ContinuousDevelopment methodologies in their projects.This article provides details to setup Azure DevOps with Continuous Integration (CI) to automateSharePoint Framework builds, unit testing and implementation.Continuous Integration (CI)Developers can integrate code into a shared repository by automatically verifying the build, unit tests and package the solution using Continuous Integration(CI), whenever there arenew updates to code is submitted to repository.Continuous Integration using DevOps.The steps involved to setup Azure DevOps for SharePoint Framework development are :1. Build Definition Creation2. Installing NodeJS and dependencies.3. Execution Unit Test4. Import Test results5. Import code coverage information6. Bundle the solution7. Package the solution8. Prepare the artifacts9. Publish the artifacts2019 Sogeti. All rights reserved.Azure DevOps for SPFx4

Build Definition Creation:Build definitions can be defined as a process template.It is a set of configured tasks thatneed to be executed in a sequential manner on the source code every time a build istriggered.Tasks can be grouped in phases, by default a build definition contains at least onephase.we can add new tasks to the phase by clicking on the big plus sign next to the phasename.The repository can be in GitHub, and the files needs to be visible in Repos. The belowscreenshot provides snapshot of a sample Repos.2019 Sogeti. All rights reserved.Azure DevOps for SPFx5

We can start Continuous Integration by creating new build definition and linking the sameto repository.We can select Azure Repos Git option from the above screenshot, and link the repos to thePipeline,Installing NodeJS and dependencies.Once the Build Definition has been created, we need to install NodeJS and related dependencies. Weneed to ensure to install version 10, as SharePoint Framework depends on it.2019 Sogeti. All rights reserved.Azure DevOps for SPFx6

Once the installation is completed, the results are displayed as per the below screenshot.Executing Test Cases:The SharePoint Framework (Ver 1.8.0) doesn’t provide a testing framework by default. Wecan leverage JEST# for creating Unit test cases. It is highly recommended at a minimum totest the business logic of the code to get feedback on any potential issues or regressions assoon as possible.2019 Sogeti. All rights reserved.Azure DevOps for SPFx7

To have Azure DevOps execute your unit tests, add a npm task. Setthe command to custom and custom command field, enter test. Then set the WorkingDirectory option to (Build.SourcesDirectory).# Jest is an open JavaScript testing library from Facebook. Its slogan is "Delightful JavaScript Testing". Jest can be used totest any JavaScript library especially with React and React NativeConfiguring JestBy default SharePoint Framework projects does not include a testing Framework. We canleverage Jest in this sample.Install Jest by executing the below command npm i chai@4.X jest jest-junit @voitanos/jest-preset-spfx-react16 -DTo configure Jest, create a file config/jest.config.json and add the following content.{"preset": "@voitanos/jest-preset-spfx-react16","rootDir": "./src","coverageReporters": "reporters": ["default","jest-junit"]}We need to configure the project to leverage jest when typing commands.To configure we need to edit the package.json file and add/replace these two scripts withthe following values:"test": "./node modules/.bin/jest --config ./config/jest.config.json","test:watch": "./node modules/.bin/jest --config ./config/jest.config.json --watchAll"We need to modify package.json to configure the Reporter.Reporters are plugins that provide new export formats for test results to test runners. Todo so edit package.json and add these lines after the scripts property."jest-junit": {"output": "temp/test/junit/junit.xml","usePathForSuiteName": "true"}2019 Sogeti. All rights reserved.Azure DevOps for SPFx8

Writing a unit testFor creating the first unit test, create a new file:src/webparts/ webPartName /tests/ webPartName.spec.ts and add the following content:/// reference types "mocha" / import {assert, expect} from 'chai';describe("webPartName", () {it("execute something", () {assert.ok(true, 'should be true');});it("should add numbers Sync fluent", () {const result:number 1 3;expect(result).to.eq(4); // fluent API});});Importing test resultsIn order to get test results information attached with the build results, we need to importthese test results from the test runner into Azure DevOps.The following steps needs to be configured: Add a new Publish Test Results task. Set the Test results files field to temp/test/junit/junit.xml Set the Searchfolder to (Build.SourcesDirectory).Importing code coverage informationTo get code coverage reported with the build status we need to add a task to import codecoverage details. To configure the code coverage information, add the task - publish codecoverage results. Ensure that we set the tool to: Cobertura, Summary files to age.xmlReport Directory to (Build.SourcesDirectory)/temp/test.Bundling the solutionWe need to bundle the solution to get static assets that can be understood by a webbrowser.Add another gulp task, set the gulpfile path, set the Gulp Tasks field to bundle and add -ship in the Arguments.2019 Sogeti. All rights reserved.Azure DevOps for SPFx9

Packaging the solutionNow we have the static assets, the next step is to combine the assets into a packageSharePoint will be able to deploy.Add another gulp task, set the gulpfile path, set the Gulp Tasks field to package-solution andadd --ship in the Arguments.Preparing the artifactsBy default, an Azure DevOps build doesn’t retain any files. To ensure that the required filesneeded for the release are retained, we need to explicitly indicate which files should beretained.Add a Copy Files task and set the Contents to **\*.sppkg (the SharePoint Package created with theprevious task) and the target folder to (build.artifactstagingdirectory)/drop.Publishing the artifactsWe have now collected all the files needed for deployment in a special artifacts folder, westill need to instruct Azure DevOps to keep these files after the execution of the build.To do so add a Publish artifacts task and set thePath to publish to (build.artifactstagingdirectory)/drop and Artifact name to drop.2019 Sogeti. All rights reserved.Azure DevOps for SPFx10

2. ConclusionBuilding and Testing are the main activities of the continuous integration task. ContinuousIntegration helps to automate the build process when development of a solution by theproject team, and when development cycles are undergoing continuous changes. AzureDevOps helps to automate the development builds of SPFx solution.Some of the technical benefits of CI are : Helps to execute the test cases using the central code repository, and this helps to spotany integration issues.Better code control, and code management2019 Sogeti. All rights reserved.Azure DevOps for SPFx11

3. ReferencesS.No.1.ReferenceAzureDevOps for CI/CD Implementation2019 Sogeti. All rights reserved.Azure DevOps for SPFx12

About SogetiSogeti is a leading provider of technology and engineering services.Sogeti delivers solutions that enable digital transformation andoffers cutting-edge expertise in Cloud, Cybersecurity, DigitalManufacturing, Digital Assurance & Testing, and emergingtechnologies. Sogeti combines agility and speed of implementationwith strong technology supplier partnerships, world classmethodologies and its global delivery model, Rightshore . Sogetibrings together more than 25,000 professionals in 15 countries,based in over 100 locations in Europe, USA and India. Sogeti is awholly-owned subsidiary of Capgemini SE, listed on the Paris StockExchange.Learn more about us at www.sogeti.comThis document contains information that may be privileged orconfidential and is the property of the Sogeti Group.Copyright 2019 Sogeti.

# Jest is an open JavaScript testing library from Facebook. Its slogan is "Delightful JavaScript Testing". Jest can be used to test any JavaScript library especially with React and React Native Configuring Jest By default SharePoint Framework projects does not include a testing Framework. We can leverage Jest in this sample.

Related Documents:

Understand the basics of the DevOps cycle Become familiar with the terms and concepts of DevOps Comprehend the beginning of the DevOps cycle . DevOps and Software Development Life Cycle 3. DevOps main objectives 4. Prerequisites for DevOps 5. Continuous Testing and Integration 6. Continuous Release and Deployment 7. Continuous Application .

Azure DevOps used to be named Visual Studio Team Services (VSTS) and Visual Studio Online (VSO), and is the cloud successor of Microsoft Team Foundation Server (TFS), now named Azure DevOps Server. Azure DevOps helps teams by implementing the technical side of DevOps. In this chapter we're going to explore DevOps, what it is, and how it can help

the data migration tool for Azure DevOps is now available. This Migration Guide will walk through the different steps along the way. We have organized the guide into six phases of the migration timeline. The goal of the migration is to move your team from on-premises Azure DevOps Server to Azure DevOps Services in the cloud. After

schema, ML model life cycle management and the creation of a collaborative workspace for data scientists. Easy migration and integration: Migrate existing DevOps tools such as legacy Team Foundation Service deployment to Azure DevOps; integrate Azure DevOps with third-party tools to enhance capabilities.

DevOps Roadmap DevOps Journey DevOps Process. Adoção do DevOps O enfoque incremental concentra-se na ideia de minimizar o risco e o custo de uma adoção de DevOps, ao mesmo tempo em que . O blog a seguir explica como o DevOps pode melhorar o processo de negócios.

DEVOPS INNOVATION Gordon Haff @ghaff William Henry @ipbabble Cloud & DevOps Product Strategy, Red Hat 17 August 2015. What is DevOps? Source: DevOps Days DC 2015 word cloud from Open Spaces. DevOps applies open source principles and practices with. DEVOPS: THE WHAT & THE WHY TOOLS drawing . Linux Collaboration Summit: Linux Foundation .

International DevOps Certification Academy aims to remove these barriers set in front of the DevOps Professionals in developed and emerging markets by saving them from paying unreason-able fees for DevOps Classroom Trainings and DevOps Certification Examinations before they certify their knowhow in DevOps.

Azure Active Directory (AD) can be configured as the identity provider for GitHub 8. GitHub Commit tracked by Azure Board 9. Azure Pipelines integrates with the Terraform tool which can managing cloud infrastructure as code 10. Azure Pipelines enable Continuous Delivery (CD) to Azure Kubernetes Service