blob: 5900fbd4aae3a36af8268d2705c4d66ba0098f5f [file] [log] [blame]
Harrison Mutai8e08e582024-07-30 13:24:24 +00001pipeline {
2 agent {
3 label 'docker-amd64-tf-a-jammy'
4 }
5
6 parameters {
7 string(name: 'TF_GERRIT_URL',
8 description: 'Git repository URL.',
9 defaultValue: 'https://review.trustedfirmware.org/TF-A/trusted-firmware-a')
10
11 string(name: 'USER_REFSPEC',
12 defaultValue: '+refs/heads/master:refs/remotes/origin/master',
13 description: 'Trusted Firmware-A refspec to use (default is master).')
14
15 string(name: 'USER_REFNAME',
16 defaultValue: 'origin/master',
17 description: 'Trusted Firmware-A refname to use (default is origin/master).')
18 }
19
20 stages {
21 stage('Checkout') {
22 steps {
23 script {
24 def refspec = params.GERRIT_REFSPEC ?: params.USER_REFSPEC
25 def refname = params.GERRIT_PATCHSET_REVISION ?: params.USER_REFNAME
26
27 checkout([
28 $class: 'GitSCM',
29 branches: [[ name: refname ]],
30 userRemoteConfigs: [
31 [ url: params.TF_GERRIT_URL, refspec: refspec]
32 ]
33 ])
34 }
35 }
36 }
37
38 stage('Install') {
39 steps {
40 dir('tools/tlc') {
41 sh 'poetry install'
42 }
43 }
44 }
45
46 stage('Codestyle') {
47 parallel {
48 stage('Style') {
49 steps {
50 dir('tools/tlc') {
51 sh 'poetry run isort --diff --check-only --settings-path pyproject.toml ./'
52 sh 'poetry run black --diff --check --config pyproject.toml ./'
53 sh 'poetry run darglint --verbosity 2 tlc tests'
54 }
55 }
56 }
57
58 stage('Static Checks') {
59 steps {
60 dir('tools/tlc') {
61 sh 'poetry run mypy --config-file pyproject.toml ./'
62 }
63 }
64 }
65 }
66 }
67
68 stage('Test') {
69 steps {
70 dir('tools/tlc') {
71 sh "poetry run pytest -c pyproject.toml --cov-report=xml --cov=tlc tests/"
72
73 recordCoverage(
74 tools: [[parser: 'COBERTURA', pattern: "coverage.xml"]],
75 id: 'cobertura', name: 'Code Coverage',
76 sourceCodeRetention: 'EVERY_BUILD',
77 )
78 }
79 }
80 }
81
82 stage('Build') {
83 steps {
84 dir('tools/tlc') {
85 sh 'poetry build'
86 archiveArtifacts artifacts: 'dist/**', fingerprint: true
87 }
88 }
89 }
90 }
91}