Skip to content

Commit 50bd3a3

Browse files
committed
MPAE-7470 added CI support and readme
1 parent 1290bd7 commit 50bd3a3

File tree

7 files changed

+334
-0
lines changed

7 files changed

+334
-0
lines changed

.citd/Jenkinsfilek8s

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

.citd/cloudprovider.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
apiVersion: v1
2+
kind: Pod
3+
metadata:
4+
name: xc8-mplabx
5+
spec:
6+
containers:
7+
- name: xc8-mplabx
8+
image: artifacts.microchip.com:7999/microchip/citd/bundles/xc8-mplabx:latest
9+
imagePullPolicy: Always
10+
command: ['cat']
11+
tty: true
12+
resources:
13+
requests:
14+
cpu: 1
15+
memory: 4Gi
16+
limits:
17+
cpu: 2
18+
memory: 8Gi

.gitignore

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Untracked files in MPLABX projects
2+
/**/build/*
3+
/**/nbproject/*
4+
!/**/nbproject/*.xml
5+
/**/[Ff]ree/production/*
6+
/**/[Pp]ro/production/*
7+
8+
# Uncomment these to include hex/elf files
9+
#!/**/[Ff]ree/production/*.hex
10+
#!/**/[Ff]ree/production/*.elf
11+
#!/**/[Pp]ro/production/*.hex
12+
#!/**/[Pp]ro/production/*.elf

.main-meta/main.json

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
{
2+
"metaDataVersion": "1.0.0",
3+
"category": "com.microchip.ide.project",
4+
"content": {
5+
"metaDataVersion": "1.1.0",
6+
"name": "com.microchip.mcu8.mplabx.project.",
7+
"version": " ",
8+
"displayName": " ",
9+
"projectName": "",
10+
"shortDescription": "",
11+
"ide": {
12+
"name": "",
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+
[
43+
"Peripherals", ""
44+
],
45+
[
46+
"Peripherals", ""
47+
]
48+
],
49+
"peripherals": [
50+
"",""
51+
],
52+
"keywords": [
53+
"",
54+
""
55+
],
56+
"additionalData": {
57+
"longDescription": {
58+
"metaDataVersion": "1.0.0",
59+
"category": "com.microchip.portal.fileRef",
60+
"content": {
61+
"metaDataVersion": "1.0.0",
62+
"fileName": "./README.md",
63+
"mimeType": "text/markdown"
64+
}
65+
}
66+
}
67+
}
68+
}

LICENSE.txt

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
(c) 2020 Microchip Technology Inc. and its subsidiaries. You may use this
2+
software and any derivatives exclusively with Microchip products.
3+
4+
5+
6+
THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES, WHETHER
7+
EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE, INCLUDING ANY IMPLIED
8+
WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS FOR A
9+
PARTICULAR PURPOSE, OR ITS INTERACTION WITH MICROCHIP PRODUCTS, COMBINATION
10+
WITH ANY OTHER PRODUCTS, OR USE IN ANY APPLICATION.
11+
12+
13+
14+
IN NO EVENT WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE,
15+
INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND
16+
WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP HAS
17+
BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO THE
18+
FULLEST EXTENT ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL CLAIMS IN
19+
ANY WAY RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT OF FEES, IF ANY,
20+
THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS SOFTWARE.
21+
22+
23+
24+
MICROCHIP PROVIDES THIS SOFTWARE CONDITIONALLY UPON YOUR ACCEPTANCE OF THESE
25+
TERMS.

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 pic18f47q10-adc-computation-modes-mplab 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)