Skip to content

Commit 7ae1ab4

Browse files
committed
MPAE-4746 added CI support and readme
1 parent 41b7938 commit 7ae1ab4

File tree

5 files changed

+183
-0
lines changed

5 files changed

+183
-0
lines changed

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/*/dist/
2+
/*/build/
3+
/*/nbproject/private/
4+
/*/nbproject/*.properties
5+
/*/nbproject/*.mk
6+
/*/nbproject/*.bash

Jenkinsfilek8s

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
pipeline {
2+
agent {
3+
kubernetes {
4+
label 'atmega4809-adc-basics-mplab'
5+
defaultContainer 'xc8-mplabx'
6+
yamlFile 'cloudprovider.yml'
7+
}
8+
}
9+
10+
parameters {
11+
string( name: 'NOTIFICATION_EMAIL',
12+
defaultValue: 'PICAVR_Examples_GateKeepers@microchip.com',
13+
description: "Email to send build failure and fixed notifications.")
14+
}
15+
16+
environment {
17+
GITHUB_URL ='https://github.com/microchip-pic-avr-examples/atmega4809-adc-basics-mplab.git'
18+
BITBUCKET_URL = 'https://bitbucket.microchip.com/scm/ebe/atmega4809-adc-basics-mplab.git'
19+
DEPLOY_TOOL_URL = 'https://bitbucket.microchip.com/scm/citd/tool-github-deploy.git'
20+
DEPLOY_SCRIPT_DIR = 'tool-github-deploy'
21+
DEPLOY_SCRIPT_FILE = 'deploy-source-as-is.sh'
22+
}
23+
24+
options {
25+
timestamps()
26+
timeout(time: 20, unit: 'MINUTES')
27+
}
28+
29+
stages {
30+
stage('Checkout') {
31+
steps {
32+
checkout scm
33+
}
34+
}
35+
36+
stage('Pre-build') {
37+
steps {
38+
script {
39+
MPLABX_PATH= sh (script: 'update-alternatives --list MPLABX_PATH',returnStdout: true).trim()
40+
COMPILER_PATH= sh (script: 'update-alternatives --list XC8_PATH',returnStdout: true).trim()
41+
def pDir = "${MPLABX_PATH}/packs"
42+
def ver = COMPILER_PATH.split('/')[4].substring(1)
43+
44+
execute("git clone https://bitbucket.microchip.com/scm/citd/tool-mplabx-c-project-generator.git")
45+
execute("cd tool-mplabx-c-project-generator && node configGenerator.js sp=../ v8=${ver} packs=${pDir}")
46+
}
47+
}
48+
}
49+
50+
stage('Build') {
51+
steps {
52+
script {
53+
execute("git clone https://bitbucket.microchip.com/scm/citd/tool-mplabx-c-build.git")
54+
execute("cd tool-mplabx-c-build && node buildLauncher.js sp=../ rp=./output genMK=true")
55+
}
56+
}
57+
}
58+
59+
stage('Deploy') {
60+
when {
61+
not {
62+
changeRequest()
63+
}
64+
anyOf {
65+
tag ''
66+
}
67+
}
68+
steps {
69+
script {
70+
execute("git clone ${env.DEPLOY_TOOL_URL}")
71+
72+
withCredentials([usernamePassword(credentialsId: '8bit-examples.github.com', usernameVariable: 'USER_NAME', passwordVariable:'USER_PASS' )]) {
73+
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}'")
74+
}
75+
76+
sendSuccessfulGithubDeploymentEmail()
77+
}
78+
}
79+
}
80+
}
81+
82+
post {
83+
failure {
84+
script {
85+
sendPipelineFailureEmail()
86+
}
87+
}
88+
always {
89+
archiveArtifacts artifacts: "tool-mplabx-c-build/output/**", allowEmptyArchive: true, fingerprint: true
90+
}
91+
}
92+
}
93+
94+
def execute(String cmd) {
95+
if(isUnix()) {
96+
sh cmd
97+
} else {
98+
bat cmd
99+
}
100+
}
101+
102+
def sendPipelineFailureEmail () {
103+
if (!"${env.CHANGE_AUTHOR_EMAIL}".equalsIgnoreCase("null")) {
104+
mail to: "${env.CHANGE_AUTHOR_EMAIL}, ${params.NOTIFICATION_EMAIL}",
105+
subject: "Failed Pipeline: ${currentBuild.fullDisplayName}",
106+
body: "Pipeline failure. ${env.BUILD_URL}"
107+
} else {
108+
mail to: "${params.NOTIFICATION_EMAIL}",
109+
subject: "Failed Pipeline: ${currentBuild.fullDisplayName}",
110+
body: "Pipeline failure. ${env.BUILD_URL}"
111+
}
112+
}
113+
114+
def sendSuccessfulGithubDeploymentEmail () {
115+
mail to: "${params.NOTIFICATION_EMAIL}",
116+
subject: "Successful Deployment: ${currentBuild.fullDisplayName}",
117+
body: "The changes have been successfully deployed to GitHub. ${env.GITHUB_URL}"
118+
}

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 html logo with link -->
2+
<a href="https://www.microchip.com" rel="nofollow"><img src="images/microchip.png" alt="MCHP" width="300"/></a>
3+
4+
# Update the title for atmega4809-adc-basics-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 -->

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:2.10-5.35
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

images/microchip.png

37.2 KB
Loading

0 commit comments

Comments
 (0)