Skip to content

Commit 4a14993

Browse files
committed
MPAE-8144 added CI support and readme
1 parent 499b866 commit 4a14993

File tree

6 files changed

+284
-0
lines changed

6 files changed

+284
-0
lines changed

.citd/Jenkinsfile

Lines changed: 154 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
1+
// Jenkinsfile v1.2.0
2+
3+
pipeline {
4+
agent {
5+
label 'windows'
6+
}
7+
8+
parameters {
9+
string( name: 'NOTIFICATION_EMAIL',
10+
defaultValue: 'PICAVR_Examples_GateKeepers@microchip.com',
11+
description: "Email to send build failure, fixed and successful deployment notifications.")
12+
}
13+
14+
environment {
15+
GITHUB_OWNER = 'microchip-pic-avr-examples'
16+
GITHUB_URL ='https://github.com/microchip-pic-avr-examples/atmega4809-getting-started-with-usart-studio.git'
17+
BITBUCKET_URL = 'https://bitbucket.microchip.com/scm/ebe/atmega4809-getting-started-with-usart-studio.git'
18+
DEPLOY_TOOL_URL = 'https://bitbucket.microchip.com/scm/citd/tool-github-deploy.git'
19+
DEPLOY_SCRIPT_DIR = 'tool-github-deploy'
20+
DEPLOY_SCRIPT_FILE = 'deploy-source-as-is.sh'
21+
}
22+
23+
options {
24+
timestamps()
25+
timeout(time: 30, unit: 'MINUTES')
26+
}
27+
28+
stages {
29+
stage('Checkout') {
30+
steps {
31+
checkout scm
32+
}
33+
}
34+
35+
stage('metadata') {
36+
steps {
37+
script {
38+
execute("pip install jsonschema")
39+
execute("git clone https://bitbucket.microchip.com/scm/citd/metadata-schema.git")
40+
execute("git clone https://bitbucket.microchip.com/scm/citd/tool-metadata-validator.git")
41+
execute("cd tool-metadata-validator && python metadata-validator.py -data ../.main-meta/main.json -schema ../metadata-schema/main-schema.json")
42+
}
43+
}
44+
}
45+
46+
stage('Build') {
47+
steps {
48+
script {
49+
execute("git clone https://bitbucket.microchip.com/scm/citd/tool-studio-c-build.git")
50+
execute("cd tool-studio-c-build && python studiobuildtool.py")
51+
52+
}
53+
}
54+
}
55+
56+
stage('GitHub-Deploy') {
57+
when {
58+
not {
59+
changeRequest()
60+
}
61+
anyOf {
62+
tag ''
63+
}
64+
}
65+
steps {
66+
script {
67+
execute("git clone ${env.DEPLOY_TOOL_URL}")
68+
69+
withCredentials([usernamePassword(credentialsId: '8bit-examples.github.com', usernameVariable: 'USER_NAME', passwordVariable:'USER_PASS' )]) {
70+
execute("cd ${env.DEPLOY_SCRIPT_DIR} && sh ${env.DEPLOY_SCRIPT_FILE} ${env.BITBUCKET_URL} ${env.GITHUB_URL} ${USER_NAME} ${USER_PASS} '--tag ${env.TAG_NAME}'")
71+
}
72+
73+
sendSuccessfulGithubDeploymentEmail()
74+
}
75+
}
76+
}
77+
78+
stage('Portal-Deploy') {
79+
when {
80+
not {
81+
changeRequest()
82+
}
83+
tag ''
84+
}
85+
steps {
86+
script {
87+
def metadata = readJSON file:".main-meta/main.json"
88+
def version = metadata.content.version
89+
def project = metadata.content.projectName
90+
91+
if(version == env.TAG_NAME) {
92+
def cmdArgs = "'{\"repoOwnerName\":\"$env.GITHUB_OWNER\",\"repoName\":\"$project\",\"tagName\":\"$version\"}'"
93+
cmdArgs = cmdArgs.replaceAll("\"","\\\\\"")
94+
95+
execute("git clone https://bitbucket.microchip.com/scm/portal/bundles.git")
96+
execute("git clone https://bitbucket.microchip.com/scm/citd/tool-portal-client-launcher.git")
97+
execute("cd tool-portal-client-launcher && node portalLauncher.js -app=../bundles/portal-client-cli-win.exe -cmd=\"uploadGitHub ${cmdArgs}\"")
98+
sendSuccessfulPortalDeploymentEmail()
99+
} else {
100+
echo "Tag name is not equal to metadata content version."
101+
execute("exit 1")
102+
}
103+
104+
}
105+
}
106+
}
107+
}
108+
109+
post {
110+
failure {
111+
script {
112+
sendPipelineFailureEmail()
113+
}
114+
}
115+
always {
116+
archiveArtifacts artifacts: "tool-studio-c-build/output/**", allowEmptyArchive: true, fingerprint: true
117+
script{
118+
cleanWs()
119+
}
120+
}
121+
}
122+
}
123+
124+
def execute(String cmd) {
125+
if(isUnix()) {
126+
sh cmd
127+
} else {
128+
bat cmd
129+
}
130+
}
131+
132+
def sendPipelineFailureEmail () {
133+
if (!"${env.CHANGE_AUTHOR_EMAIL}".equalsIgnoreCase("null")) {
134+
mail to: "${env.CHANGE_AUTHOR_EMAIL}, ${params.NOTIFICATION_EMAIL}",
135+
subject: "Failed Pipeline: ${currentBuild.fullDisplayName}",
136+
body: "Pipeline failure. ${env.BUILD_URL}"
137+
} else {
138+
mail to: "${params.NOTIFICATION_EMAIL}",
139+
subject: "Failed Pipeline: ${currentBuild.fullDisplayName}",
140+
body: "Pipeline failure. ${env.BUILD_URL}"
141+
}
142+
}
143+
144+
def sendSuccessfulGithubDeploymentEmail () {
145+
mail to: "${params.NOTIFICATION_EMAIL}",
146+
subject: "Successful Github Deployment: ${currentBuild.fullDisplayName}",
147+
body: "The changes have been successfully deployed to GitHub. ${env.GITHUB_URL}"
148+
}
149+
150+
def sendSuccessfulPortalDeploymentEmail () {
151+
mail to: "${params.NOTIFICATION_EMAIL}",
152+
subject: "Successful Portal Deployment: ${currentBuild.fullDisplayName}",
153+
body: "The changes have been successfully deployed to Discover Portal."
154+
}

.gitignore

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Untracked files in Studio projects
2+
/**/.vs
3+
/**/*.atsuo
4+
/**/[Dd]ebug/*
5+
/**/[Rr]elease/*
6+
7+
# Uncomment these to include hex/elf files
8+
#!/**/[Dd]ebug/*.hex
9+
#!/**/[Dd]ebug/*.elf
10+
#!/**/[Rr]elease/*.hex
11+
#!/**/[Rr]elease/*.elf

.main-meta/main.json

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
{
2+
"metaDataVersion": "1.0.0",
3+
"category": "com.microchip.ide.project",
4+
"content": {
5+
"metaDataVersion": "1.1.0",
6+
"name": "com.microchip.mcu8.studio.project.atmega4809-getting-started-with-usart-studio",
7+
"version": "1.0.0",
8+
"displayName": " ",
9+
"projectName": "atmega4809-getting-started-with-usart-studio",
10+
"shortDescription": "",
11+
"ide": {
12+
"name": "STUDIO",
13+
"semverRange": ""
14+
},
15+
"compiler": [
16+
{
17+
"name": "",
18+
"semverRange": ""
19+
}
20+
],
21+
"dfp": {
22+
"name": "",
23+
"semverRange": ""
24+
},
25+
"configurator": {
26+
"name": "",
27+
"semverRange": ""
28+
},
29+
"device": {
30+
"metaDataVersion": "1.0.0",
31+
"category": "com.microchip.portal.contentRef",
32+
"content": {
33+
"metaDataVersion": "1.0.0",
34+
"category": "com.microchip.device",
35+
"name": "",
36+
"versionRange": "*"
37+
}
38+
},
39+
"author": "",
40+
"subcategories": [
41+
],
42+
"peripherals": [
43+
],
44+
"keywords": [
45+
],
46+
"additionalData": {
47+
"longDescription": {
48+
"metaDataVersion": "1.0.0",
49+
"category": "com.microchip.portal.fileRef",
50+
"content": {
51+
"metaDataVersion": "1.0.0",
52+
"fileName": "./README.md",
53+
"mimeType": "text/markdown"
54+
}
55+
}
56+
}
57+
}
58+
}

LICENSE.txt

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
(c) 2020 Microchip Technology Inc. and its subsidiaries.
2+
3+
Subject to your compliance with these terms, you may use Microchip software
4+
and any derivatives exclusively with Microchip products. You're responsible
5+
for complying with 3rd party license terms applicable to your use of 3rd
6+
party software (including open source software) that may accompany Microchip
7+
software.
8+
9+
SOFTWARE IS "AS IS." NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY,
10+
APPLY TO THIS SOFTWARE, INCLUDING ANY IMPLIED WARRANTIES OF NON-INFRINGEMENT,
11+
MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
12+
13+
IN NO EVENT WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE,
14+
INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND
15+
WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP
16+
HAS BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO
17+
THE FULLEST EXTENT ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL
18+
CLAIMS RELATED TO THE SOFTWARE WILL NOT EXCEED AMOUNT OF FEES, IF ANY,
19+
YOU PAID DIRECTLY TO MICROCHIP FOR THIS SOFTWARE.
20+

README.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<!-- Please do not change this logo with link -->
2+
[![MCHP](images/microchip.png)](https://www.microchip.com)
3+
4+
# Update the title for atmega4809-getting-started-with-usart-studio here
5+
6+
<!-- This is where the introduction to the example goes, including mentioning the peripherals used -->
7+
8+
## Related Documentation
9+
10+
<!-- Any information about an application note or tech brief can be linked here. Use unbreakable links!
11+
In addition a link to the device family landing page and relevant peripheral pages as well:
12+
- [AN3381 - Brushless DC Fan Speed Control Using Temperature Input and Tachometer Feedback](https://microchip.com/00003381/)
13+
- [PIC18F-Q10 Family Product Page](https://www.microchip.com/design-centers/8-bit/pic-mcus/device-selection/pic18f-q10-product-family) -->
14+
15+
## Software Used
16+
17+
<!-- All software used in this example must be listed here. Use unbreakable links!
18+
- MPLAB® X IDE 5.30 or newer [(microchip.com/mplab/mplab-x-ide)](http://www.microchip.com/mplab/mplab-x-ide)
19+
- MPLAB® XC8 2.10 or a newer compiler [(microchip.com/mplab/compilers)](http://www.microchip.com/mplab/compilers)
20+
- MPLAB® Code Configurator (MCC) 3.95.0 or newer [(microchip.com/mplab/mplab-code-configurator)](https://www.microchip.com/mplab/mplab-code-configurator)
21+
- MPLAB® Code Configurator (MCC) Device Libraries PIC10 / PIC12 / PIC16 / PIC18 MCUs [(microchip.com/mplab/mplab-code-configurator)](https://www.microchip.com/mplab/mplab-code-configurator)
22+
- Microchip PIC18F-Q Series Device Support (1.4.109) or newer [(packs.download.microchip.com/)](https://packs.download.microchip.com/) -->
23+
24+
## Hardware Used
25+
26+
<!-- All hardware used in this example must be listed here. Use unbreakable links!
27+
- PIC18F47Q10 Curiosity Nano [(DM182029)](https://www.microchip.com/Developmenttools/ProductDetails/DM182029)
28+
- Curiosity Nano Base for Click boards™ [(AC164162)](https://www.microchip.com/Developmenttools/ProductDetails/AC164162)
29+
- POT Click board™ [(MIKROE-3402)](https://www.mikroe.com/pot-click) -->
30+
31+
## Setup
32+
33+
<!-- Explain how to connect hardware and set up software. Depending on complexity, step-by-step instructions and/or tables and/or images can be used -->
34+
35+
## Operation
36+
37+
<!-- Explain how to operate the example. Depending on complexity, step-by-step instructions and/or tables and/or images can be used -->
38+
39+
## Summary
40+
41+
<!-- Summarize what the example has shown -->

images/microchip.png

5.47 KB
Loading

0 commit comments

Comments
 (0)