-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor azure pipeline configuration (#76)
* Refactor Azure pipeline config files - add template for steps in common - remove test/lint from merge pipeline * Improve display names * Restore original file name for Azure Github app compatibility
- Loading branch information
1 parent
711570e
commit 44471ed
Showing
4 changed files
with
66 additions
and
78 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
parameters: | ||
clientFolder: 'client' | ||
|
||
steps: | ||
- task: NodeTool@0 | ||
inputs: | ||
versionSpec: '10.x' | ||
displayName: 'Install Node.js' | ||
|
||
- script: | | ||
yarn install | ||
workingDirectory: ${{ parameters.clientFolder }} | ||
displayName: 'Install dependencies' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
variables: | ||
clientFolder: client | ||
|
||
trigger: | ||
branches: | ||
include: | ||
- 'master' | ||
|
||
pr: | ||
branches: | ||
exclude: | ||
- '*' | ||
|
||
jobs: | ||
- job: merge_pipeline | ||
displayName: Client app production build & deploy | ||
pool: | ||
vmImage: 'ubuntu-latest' | ||
steps: | ||
- template: install-steps.yml | ||
parameters: | ||
clientFolder: $(clientFolder) | ||
|
||
- script: yarn build | ||
workingDirectory: $(clientFolder) | ||
displayName: 'Build project' | ||
|
||
- task: ArchiveFiles@2 | ||
inputs: | ||
rootFolderOrFile: '$(clientFolder)/build' | ||
archiveType: 'zip' | ||
archiveFile: '$(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip' | ||
replaceExistingArchive: true | ||
displayName: 'Create zip archive' | ||
|
||
- script: >- | ||
curl | ||
-H 'Authorization: Bearer $(netlifyAccessToken)' | ||
-H 'Content-Type: application/zip' | ||
--data-binary '@$(Build.BuildId).zip' | ||
https://api.netlify.com/api/v1/sites/$(netlifySiteId)/deploys | ||
workingDirectory: '$(Build.ArtifactStagingDirectory)' | ||
displayName: 'Upload to Netlify' | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,57 +1,52 @@ | ||
# Node.js with React | ||
# Build a Node.js project that uses React. | ||
# Add steps that analyze code, save build artifacts, deploy, and more: | ||
# https://docs.microsoft.com/azure/devops/pipelines/languages/javascript | ||
# PR pipeline, needs to be in a file named azure-pipelines.yml, located at the root of the projet.. | ||
|
||
variables: | ||
clientFolder: client | ||
|
||
# Disabled CI on every branches... | ||
trigger: | ||
branches: | ||
exclude: | ||
- '*' | ||
|
||
# ...but enable CI on every PRs | ||
pr: | ||
branches: | ||
include: | ||
- '*' | ||
|
||
jobs: | ||
- job: client_testing | ||
displayName: Client App Testing | ||
displayName: Client app testing | ||
pool: | ||
vmImage: 'ubuntu-latest' | ||
steps: | ||
- task: NodeTool@0 | ||
inputs: | ||
versionSpec: '10.x' | ||
displayName: 'Install Node.js' | ||
- template: /.azure/install-steps.yml | ||
parameters: | ||
clientFolder: $(clientFolder) | ||
|
||
- script: | | ||
yarn install | ||
yarn add -D jest-junit | ||
workingDirectory: $(clientFolder) | ||
displayName: 'Install dependencies' | ||
displayName: 'Install test reporter' | ||
- script : | | ||
yarn lint | ||
yarn lint:style | ||
workingDirectory: $(clientFolder) | ||
displayName: 'Lint code' | ||
displayName: 'Lint code and styles' | ||
- script: CI=true yarn test --reporters=default --reporters=jest-junit --coverage --coverageReporters=cobertura | ||
workingDirectory: $(clientFolder) | ||
displayName: 'Run tests' | ||
|
||
- task: PublishTestResults@2 | ||
displayName: 'Publish test results' | ||
condition: succeededOrFailed() | ||
inputs: | ||
testRunner: JUnit | ||
testResultsFiles: '$(clientFolder)/junit.xml' | ||
|
||
- task: PublishCodeCoverageResults@1 | ||
displayName: 'Publish code coverage results' | ||
inputs: | ||
codeCoverageTool: Cobertura | ||
summaryFileLocation: '$(clientFolder)/coverage/*coverage.xml' |