-
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.
Lint Configuration, Danger and CI Pipeline and more... (#1)
* lint * pipeline * pipeline danger CI * Update code-review-pipelines.yml for Azure Pipelines * fix pipeline danger CI * check input * fix * try * openapi.json * fix * fix
- Loading branch information
1 parent
804c71f
commit f989e3d
Showing
44 changed files
with
5,888 additions
and
11,531 deletions.
There are no files selected for viewing
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,131 @@ | ||
# Azure DevOps pipeline to build, check source codes and run tests. | ||
# | ||
# To make Danger JS run on a pull request you need to add the following pipeline | ||
# variable and set it with a GitHub access token (scope public_repo); otherwise | ||
# set its value to 'skip' without marking it secret: | ||
# - DANGER_GITHUB_API_TOKEN | ||
# | ||
|
||
# Automatically triggered on PR | ||
# https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=azure-devops&tabs=schema%2Cparameter-schema#pr-trigger | ||
trigger: none | ||
|
||
|
||
variables: | ||
NODE_VERSION: '14.19.0' | ||
YARN_CACHE_FOLDER: $(Pipeline.Workspace)/.yarn | ||
|
||
|
||
# Execute agents (jobs) on latest Ubuntu version. | ||
# To change OS for a specific, override "pool" attribute inside the job definition | ||
pool: | ||
vmImage: 'ubuntu-latest' | ||
|
||
resources: | ||
repositories: | ||
- repository: pagopaCommons | ||
type: github | ||
name: pagopa/azure-pipeline-templates | ||
ref: refs/tags/v15 | ||
endpoint: 'io-azure-devops-github-ro' | ||
|
||
|
||
stages: | ||
- stage: Build | ||
dependsOn: [] | ||
jobs: | ||
- job: make_build | ||
steps: | ||
- template: templates/node-job-setup/template.yaml@pagopaCommons | ||
- script: | | ||
yarn build | ||
displayName: 'Build' | ||
- stage: Static_analysis | ||
dependsOn: [] | ||
jobs: | ||
- job: lint | ||
steps: | ||
- template: templates/node-job-setup/template.yaml@pagopaCommons | ||
- script: | | ||
yarn lint | ||
displayName: 'Lint' | ||
- job: danger | ||
condition: | ||
and( | ||
succeeded(), | ||
ne(variables['DANGER_GITHUB_API_TOKEN'], 'skip') | ||
) | ||
steps: | ||
- template: templates/node-job-setup/template.yaml@pagopaCommons | ||
|
||
- bash: | | ||
yarn danger ci | ||
env: | ||
DANGER_GITHUB_API_TOKEN: '$(DANGER_GITHUB_API_TOKEN)' | ||
displayName: 'Danger CI' | ||
# B) Run unit tests if there is a push or pull request on any branch. | ||
- stage: Test | ||
dependsOn: [] | ||
jobs: | ||
- job: unit_tests | ||
steps: | ||
- template: templates/node-job-setup/template.yaml@pagopaCommons | ||
|
||
- script: | | ||
yarn test:coverage | ||
displayName: 'Unit tests exec' | ||
- stage: Sonarcloud | ||
dependsOn: [] | ||
jobs: | ||
- job: sonarcloud_analysis | ||
steps: | ||
- template: templates/node-job-setup/template.yaml@pagopaCommons | ||
|
||
- script: git branch | ||
displayName: 'Branch identification' | ||
|
||
- task: SonarCloudPrepare@1 | ||
displayName: 'Prepare SonarCloud analysis configuration' | ||
inputs: | ||
SonarCloud: '$(SONARCLOUD_SERVICE_CONN)' | ||
organization: '$(SONARCLOUD_ORG)' | ||
scannerMode: Other | ||
projectKey: $(SONARCLOUD_PROJECT_KEY) | ||
projectName: $(SONARCLOUD_PROJECT_NAME) | ||
# scannerMode: CLI | ||
# configMode: manual | ||
# cliProjectKey: $(SONARCLOUD_PROJECT_KEY) | ||
# cliProjectName: $(SONARCLOUD_PROJECT_NAME) | ||
# cliSources: $(Build.Repository.LocalPath) | ||
extraProperties: | | ||
sonar.javascript.file.suffixes=.js,.jsx | ||
sonar.typescript.file.suffixes=.ts,.tsx | ||
sonar.sources=. | ||
sonar.exclusions=src/__tests__/** | ||
sonar.tests=src/__tests__ | ||
sonar.test.inclusions=src/__tests__/**/*.test.tsx | ||
sonar.testExecutionReportPaths=test-report.xml | ||
sonar.sourceEncoding=UTF-8 | ||
sonar.verbose=true | ||
sonar.javascript.lcov.reportPaths=coverage/lcov.info | ||
sonar.typescript.tsconfigPath=tsconfig.json | ||
sonar.eslint.reportPaths=eslint-report.json | ||
- script: yarn test | ||
displayName: 'Unit tests execution' | ||
|
||
- script: yarn lint | ||
displayName: 'Lint execution' | ||
|
||
- task: SonarCloudAnalyze@1 | ||
|
||
- task: SonarCloudPublish@1 | ||
inputs: | ||
pollingTimeoutSec: '300' | ||
displayName: 'Publish SonarCloud results on build summary' | ||
|
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,6 @@ | ||
locales/locales.ts | ||
ts/utils/__tests__/xss.test.ts | ||
definitions/* | ||
Dangerfile.ts | ||
generated | ||
jest.config.js |
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,24 @@ | ||
module.exports = { | ||
env: { | ||
es6: true, | ||
node: true | ||
}, | ||
ignorePatterns: [ | ||
"node_modules", | ||
"generated", | ||
"**/__tests__/*", | ||
"**/__mocks__/*", | ||
"*.d.ts", | ||
"*.js", | ||
"Dangerfile.ts", | ||
], | ||
parser: "@typescript-eslint/parser", | ||
parserOptions: { | ||
project: "./tsconfig.json", | ||
sourceType: "module" | ||
}, | ||
extends: [ | ||
"@pagopa/eslint-config/strong", | ||
], | ||
rules: {} | ||
}; |
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,7 @@ | ||
*.js.map | ||
*.ts | ||
.git* | ||
.vscode | ||
local.settings.json | ||
test | ||
getting_started.md |
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,36 @@ | ||
<!--- Please always add a PR description as if nobody knows anything about the context these changes come from. --> | ||
<!--- Even if we are all from our internal team, we may not be on the same page. --> | ||
<!--- Write this PR as you were contributing to a public OSS project, where nobody knows you and you have to earn their trust. --> | ||
<!--- This will improve our projects in the long run! Thanks. --> | ||
|
||
#### List of Changes | ||
|
||
<!--- Describe your changes in detail --> | ||
|
||
#### Motivation and Context | ||
|
||
<!--- Why is this change required? What problem does it solve? --> | ||
|
||
#### How Has This Been Tested? | ||
|
||
<!--- Please describe in detail how you tested your changes. --> | ||
<!--- Include details of your testing environment, tests ran to see how --> | ||
<!--- your change affects other areas of the code, etc. --> | ||
|
||
#### Screenshots (if appropriate): | ||
|
||
#### Types of changes | ||
|
||
<!--- What types of changes does your code introduce? Put an `x` in all the boxes that apply: --> | ||
|
||
- [ ] Bug fix (non-breaking change which fixes an issue) | ||
- [ ] New feature (non-breaking change which adds functionality) | ||
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) | ||
|
||
#### Checklist: | ||
|
||
<!--- Go over all the following points, and put an `x` in all the boxes that apply. --> | ||
<!--- If you're unsure about any of these, don't hesitate to ask. We're here to help! --> | ||
|
||
- [ ] My change requires a change to the documentation. | ||
- [ ] I have updated the documentation accordingly. |
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,3 @@ | ||
addAssignees: author | ||
|
||
runOnDraft: true |
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,18 @@ | ||
# release.yml | ||
|
||
changelog: | ||
exclude: | ||
labels: | ||
- ignore-for-release | ||
authors: | ||
- pagopa-github-bot | ||
categories: | ||
- title: Breaking Changes 🛠 | ||
labels: | ||
- breaking-change | ||
- title: Exciting New Features 🎉 | ||
labels: | ||
- enhancement | ||
- title: Other Changes | ||
labels: | ||
- "*" |
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,26 @@ | ||
name: Auto Assign | ||
|
||
# Controls when the workflow will run | ||
on: | ||
# Triggers the workflow on push or pull request events but only for the main branch | ||
pull_request_target: | ||
branches: | ||
- main | ||
types: [ opened, reopened ] | ||
|
||
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
|
||
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | ||
jobs: | ||
build: | ||
# The type of runner that the job will run on | ||
runs-on: ubuntu-latest | ||
|
||
# Steps represent a sequence of tasks that will be executed as part of the job | ||
steps: | ||
- name: Assign Me | ||
# You may pin to the exact commit or the version. | ||
uses: kentaro-m/auto-assign-action@v1.2.1 | ||
with: | ||
configuration-path: '.github/auto_assign.yml' |
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,35 @@ | ||
name: Check PR | ||
|
||
# Controls when the workflow will run | ||
on: | ||
pull_request_target: | ||
branches: | ||
- main | ||
types: [ opened, labeled, unlabeled, reopened ] | ||
|
||
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
|
||
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | ||
jobs: | ||
build: | ||
name: Check Labels | ||
# The type of runner that the job will run on | ||
runs-on: ubuntu-latest | ||
|
||
# Steps represent a sequence of tasks that will be executed as part of the job | ||
steps: | ||
|
||
- name: Verify PR Labels | ||
uses: jesusvasquez333/verify-pr-label-action@v1.4.0 | ||
with: | ||
github-token: '${{ secrets.GITHUB_TOKEN }}' | ||
valid-labels: 'bug, enhancement, breaking-change, ignore-for-release' | ||
pull-request-number: '${{ github.event.pull_request.number }}' | ||
|
||
- name: Label Check | ||
if: ${{ !contains(github.event.pull_request.labels.*.name, 'breaking-change') && !contains(github.event.pull_request.labels.*.name, 'enhancement') && !contains(github.event.pull_request.labels.*.name, 'bug') && !contains(github.event.pull_request.labels.*.name, 'ignore-for-release') }} | ||
uses: actions/github-script@v3 | ||
with: | ||
script: | | ||
core.setFailed('Missing required labels') |
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,58 @@ | ||
name: Auto Deploy | ||
|
||
# Controls when the workflow will run | ||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
types: [ closed ] | ||
|
||
|
||
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
|
||
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | ||
jobs: | ||
build: | ||
if: ${{ github.event.pull_request.merged }} | ||
name: Call Azure Build Pipeline | ||
# The type of runner that the job will run on | ||
runs-on: ubuntu-latest | ||
|
||
# Steps represent a sequence of tasks that will be executed as part of the job | ||
steps: | ||
|
||
# default skip bump versioning | ||
- name: Set as default skip bump versioning | ||
run: | | ||
echo "SEMVER=skip" >> $GITHUB_ENV | ||
- name: Set major | ||
run: | | ||
echo "SEMVER=major" >> $GITHUB_ENV | ||
if: ${{ contains(github.event.pull_request.labels.*.name, 'breaking-change') }} | ||
|
||
- name: Set minor | ||
run: | | ||
echo "SEMVER=minor" >> $GITHUB_ENV | ||
if: ${{ contains(github.event.pull_request.labels.*.name, 'enhancement') }} | ||
|
||
- name: Set patch | ||
run: | | ||
echo "SEMVER=patch" >> $GITHUB_ENV | ||
if: ${{ contains(github.event.pull_request.labels.*.name, 'bug') }} | ||
|
||
- name: Set skip | ||
run: | | ||
echo "SEMVER=skip" >> $GITHUB_ENV | ||
if: ${{ contains(github.event.pull_request.labels.*.name, 'ignore-for-release') }} | ||
|
||
- name: Azure Pipelines Action - Jversion | ||
uses: jacopocarlini/azure-pipelines@v1.3 | ||
with: | ||
azure-devops-project-url: https://dev.azure.com/pagopaspa/pagoPA-projects | ||
azure-pipeline-name: 'pagopa-gps-donation-service.deploy' | ||
azure-devops-token: ${{ secrets.AZURE_DEVOPS_TOKEN }} | ||
azure-template-parameters: '{"ENV": "dev", "SEMVER": "${{env.SEMVER}}", "TEST": "true"}' | ||
azure-pipeline-variables: '{"system.debug": "true"}' | ||
|
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,28 @@ | ||
name: Sonar Analysis | ||
|
||
# Controls when the workflow will run | ||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
|
||
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | ||
jobs: | ||
build: | ||
name: Call Azure Build Pipeline | ||
# The type of runner that the job will run on | ||
runs-on: ubuntu-latest | ||
|
||
# Steps represent a sequence of tasks that will be executed as part of the job | ||
steps: | ||
- name: Azure Pipelines Action - Jversion | ||
uses: jacopocarlini/azure-pipelines@v1.3 | ||
with: | ||
azure-devops-project-url: https://dev.azure.com/pagopaspa/pagoPA-projects | ||
azure-pipeline-name: 'pagopa-gps-donation-service.code-review' | ||
azure-devops-token: ${{ secrets.AZURE_DEVOPS_TOKEN }} | ||
azure-pipeline-variables: '{"system.debug": "true"}' | ||
|
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.