1+ # Licensed to the Apache Software Foundation (ASF) under one
2+ # or more contributor license agreements. See the NOTICE file
3+ # distributed with this work for additional information
4+ # regarding copyright ownership. The ASF licenses this file
5+ # to you under the Apache License, Version 2.0 (the
6+ # "License"); you may not use this file except in compliance
7+ # with the License. You may obtain a copy of the License at
8+ #
9+ # http://www.apache.org/licenses/LICENSE-2.0
10+ #
11+ # Unless required by applicable law or agreed to in writing,
12+ # software distributed under the License is distributed on an
13+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+ # KIND, either express or implied. See the License for the
15+ # specific language governing permissions and limitations
16+ # under the License.
17+
18+ name : MADlib CI Checks
19+
20+ on :
21+ push :
22+ branches : [ madlib2-master, github-actions ]
23+ pull_request :
24+ branches : [ madlib2-master, github-actions ]
25+ # Allow manual triggers for testing
26+ workflow_dispatch :
27+
28+ permissions :
29+ contents : read
30+ actions : read
31+ checks : write
32+
33+ jobs :
34+ build-and-test :
35+ name : Build and Test MADlib
36+ runs-on : ubuntu-latest
37+
38+ container :
39+ image : madlib/postgres_15:jenkins
40+ options : >-
41+ --ulimit core=-1
42+ --privileged
43+
44+ steps :
45+ - uses : actions/checkout@v4
46+ with :
47+ fetch-depth : 0
48+ persist-credentials : false
49+ set-safe-directory : true
50+
51+ - name : Configure PostgreSQL
52+ run : |
53+ cp tool/pg_hba.conf.postgres /etc/postgresql/15/main/pg_hba.conf
54+ echo " * soft nproc unlimited" > /etc/security/limits.d/postgres-limits.conf
55+ service postgresql start
56+ sleep 5
57+ # Verify PostgreSQL started successfully and show version
58+ echo "PostgreSQL version:" && su -s /bin/bash - postgres -c 'psql -c "SELECT version()"' || exit 1
59+
60+ - name : Install Dependencies
61+ run : |
62+ # Fix PostgreSQL APT repository issue (focal-pgdg is no longer available)
63+ rm -f /etc/apt/sources.list.d/pgdg.list || true
64+
65+ apt-get update
66+ apt-get install -y python3-pip openjdk-11-jre-headless
67+ # Install Python packages (pypmml requires Java to be installed first)
68+ pip install mock pandas numpy xgboost scikit-learn pyyaml pyxb-x pypmml
69+
70+ - name : Build MADlib
71+ run : |
72+ mkdir -p logs
73+ rm -rf build && mkdir -p build
74+ cd build
75+ echo "---------- CMake Configuration -----------"
76+ cmake .. 2>&1 | tee ../logs/madlib_compile.log
77+ echo "---------- Make Clean -----------"
78+ make clean 2>&1 | tee -a ../logs/madlib_compile.log
79+ echo "---------- Make Build (first pass) -----------"
80+ make -j$(nproc) 2>&1 | tee -a ../logs/madlib_compile.log
81+ echo "---------- Make Build (second pass) -----------"
82+ make -j$(nproc) 2>&1 | tee -a ../logs/madlib_compile.log
83+ echo "---------- Make Install -----------"
84+ make install 2>&1 | tee -a ../logs/madlib_compile.log
85+ echo "---------- Make Package -----------"
86+ make package 2>&1 | tee -a ../logs/madlib_compile.log
87+ chown -R postgres:postgres . || true
88+
89+ - name : Run Tests
90+ run : |
91+ export PATH=$PATH:/usr/lib/postgresql/15/bin/
92+ WORKSPACE=$(pwd)
93+
94+ echo "---------- Installing MADlib -----------"
95+ # Install MADlib as postgres user
96+ # Note: Use absolute path because 'su -' resets working directory
97+ su -s /bin/bash - postgres -c "export PATH=\$PATH:/usr/lib/postgresql/15/bin/; cd $WORKSPACE/build; $WORKSPACE/build/src/bin/madpack -s mad -p postgres -c postgres/postgres@localhost:5432/postgres install" 2>&1 | tee $WORKSPACE/logs/madlib_install.log
98+
99+ mkdir -p /tmp
100+
101+ echo "---------- Removing known problematic test files -----------"
102+ # Remove known problematic test files from BUILD directory (as done in jenkins_build.sh)
103+ # These tests are known to fail in the Docker environment
104+ rm -rf $WORKSPACE/build/src/ports/postgres/modules/deep_learning/test || true
105+ rm -rf $WORKSPACE/build/src/ports/postgres/15/modules/deep_learning/test || true
106+ rm -rf $WORKSPACE/build/src/ports/postgres/modules/linalg/test/linalg.sql_in || true
107+ rm -rf $WORKSPACE/build/src/ports/postgres/modules/prob/test/prob.sql_in || true
108+ rm -rf $WORKSPACE/build/src/ports/postgres/modules/stats/test/cox_prop_hazards.sql_in || true
109+ rm -rf $WORKSPACE/build/src/ports/postgres/modules/utilities/test/path.sql_in || true
110+ rm -rf $WORKSPACE/build/src/ports/postgres/modules/mxgboost/test/madlib_xgboost.sql_in || true
111+ rm -rf $WORKSPACE/build/src/ports/postgres/modules/kmeans/test/kmeans.sql_in || true
112+
113+ echo "---------- Running dev-check -----------"
114+ # Run dev-check and unit tests as postgres user
115+ # Note: These commands will fail the workflow if tests fail (no || true)
116+ su -s /bin/bash - postgres -c "cd $WORKSPACE/build; $WORKSPACE/build/src/bin/madpack -s mad -p postgres -c postgres/postgres@localhost:5432/postgres -d /tmp dev-check" 2>&1 | tee $WORKSPACE/logs/madlib_dev_check.log
117+
118+ echo "---------- Running unit tests -----------"
119+ su -s /bin/bash - postgres -c "cd $WORKSPACE/build; $WORKSPACE/build/src/bin/madpack -s mad -p postgres -c postgres/postgres@localhost:5432/postgres -d /tmp unit-test" 2>&1 | tee -a $WORKSPACE/logs/madlib_dev_check.log
120+
121+ - name : Process Test Results
122+ if : always()
123+ run : |
124+ echo "---------- Converting test results to JUnit format -----------"
125+ WORKSPACE=$(pwd)
126+ python3 tool/jenkins/junit_export.py . $WORKSPACE/logs/madlib_dev_check.log $WORKSPACE/logs/madlib_dev_check.xml
127+
128+ - name : Publish Test Results
129+ uses : EnricoMi/publish-unit-test-result-action@v2
130+ if : always()
131+ with :
132+ files : ' ${{ github.workspace }}/logs/madlib_dev_check.xml'
133+ check_name : ' 🧪 MADlib Test Results'
134+ comment_mode : ' always'
135+
136+ - name : Upload Build Artifacts
137+ if : always()
138+ uses : actions/upload-artifact@v4
139+ with :
140+ name : madlib-packages
141+ path : build/*.deb
142+ if-no-files-found : warn
143+
144+ - name : Upload Build Logs
145+ if : always()
146+ uses : actions/upload-artifact@v4
147+ with :
148+ name : madlib-build-logs
149+ path : logs/
150+ if-no-files-found : warn
0 commit comments