aboutsummaryrefslogtreecommitdiff
path: root/Jenkinsfile
blob: a646d22786eadabc22cc9c7733662a4de762529b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
pipeline {
    agent any

    triggers {
        cron('H */12 * * *')
        pollSCM('H */6 * * *')
    }

    options {
        skipDefaultCheckout()
    }

    environment {
        VENV = "${env.WORKSPACE}/generalresearch-venv"
    }

    stages {

        stage('Checkout') {
            steps {
                checkout scmGit(
                    branches: [[name: "*/${env.BRANCH_NAME}"]],
                    extensions: [ cloneOption(shallow: true) ],
                    userRemoteConfigs: [
                        [credentialsId: 'abdeb570-b708-44f3-b857-8a6b06ed9822',
                         url: 'ssh://code.g-r-l.com:6611/generalresearch']
                    ],
                )
                stash name: 'source', useDefaultExcludes: false
            }
        }

        stage('Python Versions') {
            matrix {
                axes {
                    axis {
                        name 'VER'
                        values 'python3.14', 'python3.13', 'python3.12'
                    }
                }

                stages {
                    stage('Setup') {
                        steps {
                            dir("generalresearch-${VER}") {
                                deleteDir()
                                unstash 'source'

                                withCredentials([file(
                                    credentialsId: '971e1f48-09ce-4446-9155-a52c1adb6249',
                                    variable: 'ENV_TEST_FILE')]) {
                                    sh 'cp $ENV_TEST_FILE .env.test'
                                }
                                sh "/usr/local/bin/${VER} -m venv ${VENV}-${VER}"
                                sh "${VENV}-${VER}/bin/pip install -U setuptools wheel pip"
                                sh "${VENV}-${VER}/bin/pip install '.'"
                                sh "${VENV}-${VER}/bin/pip install '.[django,dask]'"
                            }
                        }
                    }

                    stage('base') {
                        steps {
                            dir("generalresearch-${VER}") {
                                sh "${VENV}-${VER}/bin/pytest tests/test_postgres.py -vs"
                            }
                        }
                    }

                    stage('models') {
                        steps {
                            dir("generalresearch-${VER}") {
                                sh "${VENV}-${VER}/bin/pytest tests/models/gr/test_base.py -vs"
                            }
                        }
                    }

                    stage('managers') {
                        steps {
                            dir("generalresearch-${VER}") {
                                sh "${VENV}-${VER}/bin/pytest tests/managers/gr/ -vs"
                            }
                        }
                    }

                }
            }
        }
    }

    post {
        always {
            echo 'One way or another, I have finished'
            deleteDir()
        }
    }
}