diff --git a/Dockerfile.base b/Dockerfile.base new file mode 100644 index 0000000..dc5df86 --- /dev/null +++ b/Dockerfile.base @@ -0,0 +1,2 @@ +FROM ubuntu:16.04 +RUN apt-get update diff --git a/Dockerfile.base b/Dockerfile.base new file mode 100644 index 0000000..dc5df86 --- /dev/null +++ b/Dockerfile.base @@ -0,0 +1,2 @@ +FROM ubuntu:16.04 +RUN apt-get update diff --git a/Dockerfile.build b/Dockerfile.build new file mode 100644 index 0000000..5f07058 --- /dev/null +++ b/Dockerfile.build @@ -0,0 +1,25 @@ +FROM ubuntu:16.04 +RUN apt-get update + +# Install Build Tools +RUN apt-get install -y g++ gcc gdb flex bison make +RUN apt-get install -y clang clang-tidy clang-format +RUN apt-get install -y mingw-w64-common mingw-w64-tools mingw-w64 mingw-w64-i686-dev mingw-w64-x86-64-dev +RUN apt-get install -y git curl wget cmake + +# Libraries +# RUN apt-get install -y libcppunit-1.12-1 libcppunit-doc +# RUN apt-get install libqt4-dev libqt4-core libqt4-gui libqt4-sql libqt4-webkit +# RUN apt-get install graphviz doxygen libqttestrunner1c2a qdevelop + + +# RUN mkdir -p /home/jenkins +# RUN mkdir -p /var/lib/jenkins +# RUN echo -e "\n192.168.1.116 jenkins.localdomain\n" > /etc/hosts +# ADD slave.py /var/lib/jenkins/slave.py +# WORKDIR /home/jenkins +# ENV JENKINS_URL "http://jenkins.localdomain" +# ENV JENKINS_SLAVE_ADDRESS "" +# ENV JENKINS_USER "jryland" +# CMD [ "python", "-u", "/var/lib/jenkins/slave.py" ] + diff --git a/Dockerfile.base b/Dockerfile.base new file mode 100644 index 0000000..dc5df86 --- /dev/null +++ b/Dockerfile.base @@ -0,0 +1,2 @@ +FROM ubuntu:16.04 +RUN apt-get update diff --git a/Dockerfile.build b/Dockerfile.build new file mode 100644 index 0000000..5f07058 --- /dev/null +++ b/Dockerfile.build @@ -0,0 +1,25 @@ +FROM ubuntu:16.04 +RUN apt-get update + +# Install Build Tools +RUN apt-get install -y g++ gcc gdb flex bison make +RUN apt-get install -y clang clang-tidy clang-format +RUN apt-get install -y mingw-w64-common mingw-w64-tools mingw-w64 mingw-w64-i686-dev mingw-w64-x86-64-dev +RUN apt-get install -y git curl wget cmake + +# Libraries +# RUN apt-get install -y libcppunit-1.12-1 libcppunit-doc +# RUN apt-get install libqt4-dev libqt4-core libqt4-gui libqt4-sql libqt4-webkit +# RUN apt-get install graphviz doxygen libqttestrunner1c2a qdevelop + + +# RUN mkdir -p /home/jenkins +# RUN mkdir -p /var/lib/jenkins +# RUN echo -e "\n192.168.1.116 jenkins.localdomain\n" > /etc/hosts +# ADD slave.py /var/lib/jenkins/slave.py +# WORKDIR /home/jenkins +# ENV JENKINS_URL "http://jenkins.localdomain" +# ENV JENKINS_SLAVE_ADDRESS "" +# ENV JENKINS_USER "jryland" +# CMD [ "python", "-u", "/var/lib/jenkins/slave.py" ] + diff --git a/Dockerfile.lint b/Dockerfile.lint new file mode 100644 index 0000000..ebe5235 --- /dev/null +++ b/Dockerfile.lint @@ -0,0 +1,6 @@ +FROM ubuntu:16.04 +RUN apt-get update + +# Install Linting Tools +RUN apt-get install -y clang clang-tidy clang-format make git python3 + diff --git a/Dockerfile.base b/Dockerfile.base new file mode 100644 index 0000000..dc5df86 --- /dev/null +++ b/Dockerfile.base @@ -0,0 +1,2 @@ +FROM ubuntu:16.04 +RUN apt-get update diff --git a/Dockerfile.build b/Dockerfile.build new file mode 100644 index 0000000..5f07058 --- /dev/null +++ b/Dockerfile.build @@ -0,0 +1,25 @@ +FROM ubuntu:16.04 +RUN apt-get update + +# Install Build Tools +RUN apt-get install -y g++ gcc gdb flex bison make +RUN apt-get install -y clang clang-tidy clang-format +RUN apt-get install -y mingw-w64-common mingw-w64-tools mingw-w64 mingw-w64-i686-dev mingw-w64-x86-64-dev +RUN apt-get install -y git curl wget cmake + +# Libraries +# RUN apt-get install -y libcppunit-1.12-1 libcppunit-doc +# RUN apt-get install libqt4-dev libqt4-core libqt4-gui libqt4-sql libqt4-webkit +# RUN apt-get install graphviz doxygen libqttestrunner1c2a qdevelop + + +# RUN mkdir -p /home/jenkins +# RUN mkdir -p /var/lib/jenkins +# RUN echo -e "\n192.168.1.116 jenkins.localdomain\n" > /etc/hosts +# ADD slave.py /var/lib/jenkins/slave.py +# WORKDIR /home/jenkins +# ENV JENKINS_URL "http://jenkins.localdomain" +# ENV JENKINS_SLAVE_ADDRESS "" +# ENV JENKINS_USER "jryland" +# CMD [ "python", "-u", "/var/lib/jenkins/slave.py" ] + diff --git a/Dockerfile.lint b/Dockerfile.lint new file mode 100644 index 0000000..ebe5235 --- /dev/null +++ b/Dockerfile.lint @@ -0,0 +1,6 @@ +FROM ubuntu:16.04 +RUN apt-get update + +# Install Linting Tools +RUN apt-get install -y clang clang-tidy clang-format make git python3 + diff --git a/Jenkinsfile b/Jenkinsfile index 350189c..01f62d9 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,30 +1,59 @@ pipeline { - agent any + agent none stages { stage('Build') { - steps { - echo 'Building..' - sh './build.sh' - archiveArtifacts artifacts: 'build/hello*', fingerprint: true - } - } - stage('Tidy') { - steps { - echo 'Tidy..' - sh 'make tidy || true' - junit 'build/*.xml' - } + parallel { + stage('Linux Build') { + agent { docker 'linux-build-agent:latest' } + steps { + echo 'Building..' + sh 'make build/hello-linux-64' + archiveArtifacts artifacts: 'build/hello-linux-64', fingerprint: true + } + } + stage('Windows Build') { + agent { docker 'windows-build-agent:latest' } + steps { + // echo 'Preparing..' + // cleanWs() + echo 'Building..' + sh 'make build/hello-win64.exe' + archiveArtifacts artifacts: 'build/hello-win64.exe', fingerprint: true + // echo 'Cleaning..' + // cleanWs cleanWhenFailure: false, cleanWhenNotBuilt: false, cleanWhenUnstable: false + } + } + stage('MacOSX Build') { + agent { docker 'macosx-build-agent:latest' } + steps { + echo 'Building..' + sh 'make build/hello-macosx.bin' + archiveArtifacts artifacts: 'build/hello-macosx.bin', fingerprint: true + } + } + stage('Linting') { + agent { docker 'lint-agent:latest' } + steps { + echo 'Linting..' + sh 'make tidy || true' + // junit allowEmptyResults: true, healthScaleFactor: 0.0, testResults: 'build/tidy.xml' + sh 'true' + } + } + } } stage('Test') { + agent { docker 'linux-build-agent:latest' } steps { echo 'Testing..' sh 'make test || true' - junit 'build/*.xml' + junit allowEmptyResults: true, healthScaleFactor: 0.0, testResults: 'build/tests.xml' } } stage('Deploy') { + agent { docker 'linux-build-agent:latest' } when { expression { currentBuild.result == null || currentBuild.result == 'SUCCESS' diff --git a/Dockerfile.base b/Dockerfile.base new file mode 100644 index 0000000..dc5df86 --- /dev/null +++ b/Dockerfile.base @@ -0,0 +1,2 @@ +FROM ubuntu:16.04 +RUN apt-get update diff --git a/Dockerfile.build b/Dockerfile.build new file mode 100644 index 0000000..5f07058 --- /dev/null +++ b/Dockerfile.build @@ -0,0 +1,25 @@ +FROM ubuntu:16.04 +RUN apt-get update + +# Install Build Tools +RUN apt-get install -y g++ gcc gdb flex bison make +RUN apt-get install -y clang clang-tidy clang-format +RUN apt-get install -y mingw-w64-common mingw-w64-tools mingw-w64 mingw-w64-i686-dev mingw-w64-x86-64-dev +RUN apt-get install -y git curl wget cmake + +# Libraries +# RUN apt-get install -y libcppunit-1.12-1 libcppunit-doc +# RUN apt-get install libqt4-dev libqt4-core libqt4-gui libqt4-sql libqt4-webkit +# RUN apt-get install graphviz doxygen libqttestrunner1c2a qdevelop + + +# RUN mkdir -p /home/jenkins +# RUN mkdir -p /var/lib/jenkins +# RUN echo -e "\n192.168.1.116 jenkins.localdomain\n" > /etc/hosts +# ADD slave.py /var/lib/jenkins/slave.py +# WORKDIR /home/jenkins +# ENV JENKINS_URL "http://jenkins.localdomain" +# ENV JENKINS_SLAVE_ADDRESS "" +# ENV JENKINS_USER "jryland" +# CMD [ "python", "-u", "/var/lib/jenkins/slave.py" ] + diff --git a/Dockerfile.lint b/Dockerfile.lint new file mode 100644 index 0000000..ebe5235 --- /dev/null +++ b/Dockerfile.lint @@ -0,0 +1,6 @@ +FROM ubuntu:16.04 +RUN apt-get update + +# Install Linting Tools +RUN apt-get install -y clang clang-tidy clang-format make git python3 + diff --git a/Jenkinsfile b/Jenkinsfile index 350189c..01f62d9 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,30 +1,59 @@ pipeline { - agent any + agent none stages { stage('Build') { - steps { - echo 'Building..' - sh './build.sh' - archiveArtifacts artifacts: 'build/hello*', fingerprint: true - } - } - stage('Tidy') { - steps { - echo 'Tidy..' - sh 'make tidy || true' - junit 'build/*.xml' - } + parallel { + stage('Linux Build') { + agent { docker 'linux-build-agent:latest' } + steps { + echo 'Building..' + sh 'make build/hello-linux-64' + archiveArtifacts artifacts: 'build/hello-linux-64', fingerprint: true + } + } + stage('Windows Build') { + agent { docker 'windows-build-agent:latest' } + steps { + // echo 'Preparing..' + // cleanWs() + echo 'Building..' + sh 'make build/hello-win64.exe' + archiveArtifacts artifacts: 'build/hello-win64.exe', fingerprint: true + // echo 'Cleaning..' + // cleanWs cleanWhenFailure: false, cleanWhenNotBuilt: false, cleanWhenUnstable: false + } + } + stage('MacOSX Build') { + agent { docker 'macosx-build-agent:latest' } + steps { + echo 'Building..' + sh 'make build/hello-macosx.bin' + archiveArtifacts artifacts: 'build/hello-macosx.bin', fingerprint: true + } + } + stage('Linting') { + agent { docker 'lint-agent:latest' } + steps { + echo 'Linting..' + sh 'make tidy || true' + // junit allowEmptyResults: true, healthScaleFactor: 0.0, testResults: 'build/tidy.xml' + sh 'true' + } + } + } } stage('Test') { + agent { docker 'linux-build-agent:latest' } steps { echo 'Testing..' sh 'make test || true' - junit 'build/*.xml' + junit allowEmptyResults: true, healthScaleFactor: 0.0, testResults: 'build/tests.xml' } } stage('Deploy') { + agent { docker 'linux-build-agent:latest' } when { expression { currentBuild.result == null || currentBuild.result == 'SUCCESS' diff --git a/Makefile b/Makefile index 541ff31..11c1804 100644 --- a/Makefile +++ b/Makefile @@ -20,44 +20,47 @@ endif all: $(TARGETS) - echo "all..." - echo $(MAKE) - echo $(UNAME) + @echo "all..." + @echo $(UNAME) .PRECIOUS: $(BUILD_DIR)/ $(BUILD_DIR)%/ $(BUILD_DIR)/: - echo "dir1..." - mkdir -p $@ + @echo "dir1..." + @mkdir -p $@ $(BUILD_DIR)%/: - echo "dir2..." - mkdir -p $@ + @echo "dir2..." + @mkdir -p $@ .SECONDEXPANSION: $(BUILD_DIR)/hello-linux-64: | $$(@D)/. - x86_64-linux-gnu-g++ Test.cpp -o build/hello-linux-64 + @echo "Building Linux binary..." + @x86_64-linux-gnu-g++ Test.cpp -o build/hello-linux-64 $(BUILD_DIR)/hello-win64.exe: | $$(@D)/. - echo "Making..." - x86_64-w64-mingw32-g++ Test.cpp -o build/hello-win64.exe + @echo "Building Windows binary..." + @x86_64-w64-mingw32-g++ Test.cpp -o build/hello-win64.exe $(BUILD_DIR)/hello-macosx.bin: | $$(@D)/. - x86_64-apple-darwin19-c++ Test.cpp -o build/hello-macosx.bin + @echo "Building MacOSX binary..." + @x86_64-apple-darwin19-c++ Test.cpp -o build/hello-macosx.bin tidy: $(BUILD_DIR)/tidy.xml $(BUILD_DIR)/tidy.xml: | $$(@D)/. - chmod u+x ./clang-tidy-to-junit.py - clang-tidy -checks='c*,l*,m*' $(SOURCES) -- $(CXXFLAGS) | ./clang-tidy-to-junit.py $(PWD)/ > $@ + @chmod u+x ./clang-tidy-to-junit.py + @clang-tidy -checks='c*,l*,m*' $(SOURCES) -- $(CXXFLAGS) | ./clang-tidy-to-junit.py $(PWD)/ > $@ test: $(BUILD_DIR)/tests.xml $(BUILD_DIR)/tests.xml: | $$(@D)/. - echo "" > $@ + @echo '' > $@ + @echo '' >> $@ + @echo '' >> $@ publish: - echo "Publish..." + @echo "Publish..." diff --git a/Dockerfile.base b/Dockerfile.base new file mode 100644 index 0000000..dc5df86 --- /dev/null +++ b/Dockerfile.base @@ -0,0 +1,2 @@ +FROM ubuntu:16.04 +RUN apt-get update diff --git a/Dockerfile.build b/Dockerfile.build new file mode 100644 index 0000000..5f07058 --- /dev/null +++ b/Dockerfile.build @@ -0,0 +1,25 @@ +FROM ubuntu:16.04 +RUN apt-get update + +# Install Build Tools +RUN apt-get install -y g++ gcc gdb flex bison make +RUN apt-get install -y clang clang-tidy clang-format +RUN apt-get install -y mingw-w64-common mingw-w64-tools mingw-w64 mingw-w64-i686-dev mingw-w64-x86-64-dev +RUN apt-get install -y git curl wget cmake + +# Libraries +# RUN apt-get install -y libcppunit-1.12-1 libcppunit-doc +# RUN apt-get install libqt4-dev libqt4-core libqt4-gui libqt4-sql libqt4-webkit +# RUN apt-get install graphviz doxygen libqttestrunner1c2a qdevelop + + +# RUN mkdir -p /home/jenkins +# RUN mkdir -p /var/lib/jenkins +# RUN echo -e "\n192.168.1.116 jenkins.localdomain\n" > /etc/hosts +# ADD slave.py /var/lib/jenkins/slave.py +# WORKDIR /home/jenkins +# ENV JENKINS_URL "http://jenkins.localdomain" +# ENV JENKINS_SLAVE_ADDRESS "" +# ENV JENKINS_USER "jryland" +# CMD [ "python", "-u", "/var/lib/jenkins/slave.py" ] + diff --git a/Dockerfile.lint b/Dockerfile.lint new file mode 100644 index 0000000..ebe5235 --- /dev/null +++ b/Dockerfile.lint @@ -0,0 +1,6 @@ +FROM ubuntu:16.04 +RUN apt-get update + +# Install Linting Tools +RUN apt-get install -y clang clang-tidy clang-format make git python3 + diff --git a/Jenkinsfile b/Jenkinsfile index 350189c..01f62d9 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,30 +1,59 @@ pipeline { - agent any + agent none stages { stage('Build') { - steps { - echo 'Building..' - sh './build.sh' - archiveArtifacts artifacts: 'build/hello*', fingerprint: true - } - } - stage('Tidy') { - steps { - echo 'Tidy..' - sh 'make tidy || true' - junit 'build/*.xml' - } + parallel { + stage('Linux Build') { + agent { docker 'linux-build-agent:latest' } + steps { + echo 'Building..' + sh 'make build/hello-linux-64' + archiveArtifacts artifacts: 'build/hello-linux-64', fingerprint: true + } + } + stage('Windows Build') { + agent { docker 'windows-build-agent:latest' } + steps { + // echo 'Preparing..' + // cleanWs() + echo 'Building..' + sh 'make build/hello-win64.exe' + archiveArtifacts artifacts: 'build/hello-win64.exe', fingerprint: true + // echo 'Cleaning..' + // cleanWs cleanWhenFailure: false, cleanWhenNotBuilt: false, cleanWhenUnstable: false + } + } + stage('MacOSX Build') { + agent { docker 'macosx-build-agent:latest' } + steps { + echo 'Building..' + sh 'make build/hello-macosx.bin' + archiveArtifacts artifacts: 'build/hello-macosx.bin', fingerprint: true + } + } + stage('Linting') { + agent { docker 'lint-agent:latest' } + steps { + echo 'Linting..' + sh 'make tidy || true' + // junit allowEmptyResults: true, healthScaleFactor: 0.0, testResults: 'build/tidy.xml' + sh 'true' + } + } + } } stage('Test') { + agent { docker 'linux-build-agent:latest' } steps { echo 'Testing..' sh 'make test || true' - junit 'build/*.xml' + junit allowEmptyResults: true, healthScaleFactor: 0.0, testResults: 'build/tests.xml' } } stage('Deploy') { + agent { docker 'linux-build-agent:latest' } when { expression { currentBuild.result == null || currentBuild.result == 'SUCCESS' diff --git a/Makefile b/Makefile index 541ff31..11c1804 100644 --- a/Makefile +++ b/Makefile @@ -20,44 +20,47 @@ endif all: $(TARGETS) - echo "all..." - echo $(MAKE) - echo $(UNAME) + @echo "all..." + @echo $(UNAME) .PRECIOUS: $(BUILD_DIR)/ $(BUILD_DIR)%/ $(BUILD_DIR)/: - echo "dir1..." - mkdir -p $@ + @echo "dir1..." + @mkdir -p $@ $(BUILD_DIR)%/: - echo "dir2..." - mkdir -p $@ + @echo "dir2..." + @mkdir -p $@ .SECONDEXPANSION: $(BUILD_DIR)/hello-linux-64: | $$(@D)/. - x86_64-linux-gnu-g++ Test.cpp -o build/hello-linux-64 + @echo "Building Linux binary..." + @x86_64-linux-gnu-g++ Test.cpp -o build/hello-linux-64 $(BUILD_DIR)/hello-win64.exe: | $$(@D)/. - echo "Making..." - x86_64-w64-mingw32-g++ Test.cpp -o build/hello-win64.exe + @echo "Building Windows binary..." + @x86_64-w64-mingw32-g++ Test.cpp -o build/hello-win64.exe $(BUILD_DIR)/hello-macosx.bin: | $$(@D)/. - x86_64-apple-darwin19-c++ Test.cpp -o build/hello-macosx.bin + @echo "Building MacOSX binary..." + @x86_64-apple-darwin19-c++ Test.cpp -o build/hello-macosx.bin tidy: $(BUILD_DIR)/tidy.xml $(BUILD_DIR)/tidy.xml: | $$(@D)/. - chmod u+x ./clang-tidy-to-junit.py - clang-tidy -checks='c*,l*,m*' $(SOURCES) -- $(CXXFLAGS) | ./clang-tidy-to-junit.py $(PWD)/ > $@ + @chmod u+x ./clang-tidy-to-junit.py + @clang-tidy -checks='c*,l*,m*' $(SOURCES) -- $(CXXFLAGS) | ./clang-tidy-to-junit.py $(PWD)/ > $@ test: $(BUILD_DIR)/tests.xml $(BUILD_DIR)/tests.xml: | $$(@D)/. - echo "" > $@ + @echo '' > $@ + @echo '' >> $@ + @echo '' >> $@ publish: - echo "Publish..." + @echo "Publish..." diff --git a/Test.cpp b/Test.cpp index b7f4902..66b4f84 100644 --- a/Test.cpp +++ b/Test.cpp @@ -1,5 +1,7 @@ + #include + int main() { printf("hello\n"); diff --git a/Dockerfile.base b/Dockerfile.base new file mode 100644 index 0000000..dc5df86 --- /dev/null +++ b/Dockerfile.base @@ -0,0 +1,2 @@ +FROM ubuntu:16.04 +RUN apt-get update diff --git a/Dockerfile.build b/Dockerfile.build new file mode 100644 index 0000000..5f07058 --- /dev/null +++ b/Dockerfile.build @@ -0,0 +1,25 @@ +FROM ubuntu:16.04 +RUN apt-get update + +# Install Build Tools +RUN apt-get install -y g++ gcc gdb flex bison make +RUN apt-get install -y clang clang-tidy clang-format +RUN apt-get install -y mingw-w64-common mingw-w64-tools mingw-w64 mingw-w64-i686-dev mingw-w64-x86-64-dev +RUN apt-get install -y git curl wget cmake + +# Libraries +# RUN apt-get install -y libcppunit-1.12-1 libcppunit-doc +# RUN apt-get install libqt4-dev libqt4-core libqt4-gui libqt4-sql libqt4-webkit +# RUN apt-get install graphviz doxygen libqttestrunner1c2a qdevelop + + +# RUN mkdir -p /home/jenkins +# RUN mkdir -p /var/lib/jenkins +# RUN echo -e "\n192.168.1.116 jenkins.localdomain\n" > /etc/hosts +# ADD slave.py /var/lib/jenkins/slave.py +# WORKDIR /home/jenkins +# ENV JENKINS_URL "http://jenkins.localdomain" +# ENV JENKINS_SLAVE_ADDRESS "" +# ENV JENKINS_USER "jryland" +# CMD [ "python", "-u", "/var/lib/jenkins/slave.py" ] + diff --git a/Dockerfile.lint b/Dockerfile.lint new file mode 100644 index 0000000..ebe5235 --- /dev/null +++ b/Dockerfile.lint @@ -0,0 +1,6 @@ +FROM ubuntu:16.04 +RUN apt-get update + +# Install Linting Tools +RUN apt-get install -y clang clang-tidy clang-format make git python3 + diff --git a/Jenkinsfile b/Jenkinsfile index 350189c..01f62d9 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,30 +1,59 @@ pipeline { - agent any + agent none stages { stage('Build') { - steps { - echo 'Building..' - sh './build.sh' - archiveArtifacts artifacts: 'build/hello*', fingerprint: true - } - } - stage('Tidy') { - steps { - echo 'Tidy..' - sh 'make tidy || true' - junit 'build/*.xml' - } + parallel { + stage('Linux Build') { + agent { docker 'linux-build-agent:latest' } + steps { + echo 'Building..' + sh 'make build/hello-linux-64' + archiveArtifacts artifacts: 'build/hello-linux-64', fingerprint: true + } + } + stage('Windows Build') { + agent { docker 'windows-build-agent:latest' } + steps { + // echo 'Preparing..' + // cleanWs() + echo 'Building..' + sh 'make build/hello-win64.exe' + archiveArtifacts artifacts: 'build/hello-win64.exe', fingerprint: true + // echo 'Cleaning..' + // cleanWs cleanWhenFailure: false, cleanWhenNotBuilt: false, cleanWhenUnstable: false + } + } + stage('MacOSX Build') { + agent { docker 'macosx-build-agent:latest' } + steps { + echo 'Building..' + sh 'make build/hello-macosx.bin' + archiveArtifacts artifacts: 'build/hello-macosx.bin', fingerprint: true + } + } + stage('Linting') { + agent { docker 'lint-agent:latest' } + steps { + echo 'Linting..' + sh 'make tidy || true' + // junit allowEmptyResults: true, healthScaleFactor: 0.0, testResults: 'build/tidy.xml' + sh 'true' + } + } + } } stage('Test') { + agent { docker 'linux-build-agent:latest' } steps { echo 'Testing..' sh 'make test || true' - junit 'build/*.xml' + junit allowEmptyResults: true, healthScaleFactor: 0.0, testResults: 'build/tests.xml' } } stage('Deploy') { + agent { docker 'linux-build-agent:latest' } when { expression { currentBuild.result == null || currentBuild.result == 'SUCCESS' diff --git a/Makefile b/Makefile index 541ff31..11c1804 100644 --- a/Makefile +++ b/Makefile @@ -20,44 +20,47 @@ endif all: $(TARGETS) - echo "all..." - echo $(MAKE) - echo $(UNAME) + @echo "all..." + @echo $(UNAME) .PRECIOUS: $(BUILD_DIR)/ $(BUILD_DIR)%/ $(BUILD_DIR)/: - echo "dir1..." - mkdir -p $@ + @echo "dir1..." + @mkdir -p $@ $(BUILD_DIR)%/: - echo "dir2..." - mkdir -p $@ + @echo "dir2..." + @mkdir -p $@ .SECONDEXPANSION: $(BUILD_DIR)/hello-linux-64: | $$(@D)/. - x86_64-linux-gnu-g++ Test.cpp -o build/hello-linux-64 + @echo "Building Linux binary..." + @x86_64-linux-gnu-g++ Test.cpp -o build/hello-linux-64 $(BUILD_DIR)/hello-win64.exe: | $$(@D)/. - echo "Making..." - x86_64-w64-mingw32-g++ Test.cpp -o build/hello-win64.exe + @echo "Building Windows binary..." + @x86_64-w64-mingw32-g++ Test.cpp -o build/hello-win64.exe $(BUILD_DIR)/hello-macosx.bin: | $$(@D)/. - x86_64-apple-darwin19-c++ Test.cpp -o build/hello-macosx.bin + @echo "Building MacOSX binary..." + @x86_64-apple-darwin19-c++ Test.cpp -o build/hello-macosx.bin tidy: $(BUILD_DIR)/tidy.xml $(BUILD_DIR)/tidy.xml: | $$(@D)/. - chmod u+x ./clang-tidy-to-junit.py - clang-tidy -checks='c*,l*,m*' $(SOURCES) -- $(CXXFLAGS) | ./clang-tidy-to-junit.py $(PWD)/ > $@ + @chmod u+x ./clang-tidy-to-junit.py + @clang-tidy -checks='c*,l*,m*' $(SOURCES) -- $(CXXFLAGS) | ./clang-tidy-to-junit.py $(PWD)/ > $@ test: $(BUILD_DIR)/tests.xml $(BUILD_DIR)/tests.xml: | $$(@D)/. - echo "" > $@ + @echo '' > $@ + @echo '' >> $@ + @echo '' >> $@ publish: - echo "Publish..." + @echo "Publish..." diff --git a/Test.cpp b/Test.cpp index b7f4902..66b4f84 100644 --- a/Test.cpp +++ b/Test.cpp @@ -1,5 +1,7 @@ + #include + int main() { printf("hello\n"); diff --git a/build.sh b/build.sh deleted file mode 100755 index 13674d2..0000000 --- a/build.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash - -export PATH=/home/jryland/CrossCompilers/osxcross/target/bin:$PATH -make - diff --git a/Dockerfile.base b/Dockerfile.base new file mode 100644 index 0000000..dc5df86 --- /dev/null +++ b/Dockerfile.base @@ -0,0 +1,2 @@ +FROM ubuntu:16.04 +RUN apt-get update diff --git a/Dockerfile.build b/Dockerfile.build new file mode 100644 index 0000000..5f07058 --- /dev/null +++ b/Dockerfile.build @@ -0,0 +1,25 @@ +FROM ubuntu:16.04 +RUN apt-get update + +# Install Build Tools +RUN apt-get install -y g++ gcc gdb flex bison make +RUN apt-get install -y clang clang-tidy clang-format +RUN apt-get install -y mingw-w64-common mingw-w64-tools mingw-w64 mingw-w64-i686-dev mingw-w64-x86-64-dev +RUN apt-get install -y git curl wget cmake + +# Libraries +# RUN apt-get install -y libcppunit-1.12-1 libcppunit-doc +# RUN apt-get install libqt4-dev libqt4-core libqt4-gui libqt4-sql libqt4-webkit +# RUN apt-get install graphviz doxygen libqttestrunner1c2a qdevelop + + +# RUN mkdir -p /home/jenkins +# RUN mkdir -p /var/lib/jenkins +# RUN echo -e "\n192.168.1.116 jenkins.localdomain\n" > /etc/hosts +# ADD slave.py /var/lib/jenkins/slave.py +# WORKDIR /home/jenkins +# ENV JENKINS_URL "http://jenkins.localdomain" +# ENV JENKINS_SLAVE_ADDRESS "" +# ENV JENKINS_USER "jryland" +# CMD [ "python", "-u", "/var/lib/jenkins/slave.py" ] + diff --git a/Dockerfile.lint b/Dockerfile.lint new file mode 100644 index 0000000..ebe5235 --- /dev/null +++ b/Dockerfile.lint @@ -0,0 +1,6 @@ +FROM ubuntu:16.04 +RUN apt-get update + +# Install Linting Tools +RUN apt-get install -y clang clang-tidy clang-format make git python3 + diff --git a/Jenkinsfile b/Jenkinsfile index 350189c..01f62d9 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,30 +1,59 @@ pipeline { - agent any + agent none stages { stage('Build') { - steps { - echo 'Building..' - sh './build.sh' - archiveArtifacts artifacts: 'build/hello*', fingerprint: true - } - } - stage('Tidy') { - steps { - echo 'Tidy..' - sh 'make tidy || true' - junit 'build/*.xml' - } + parallel { + stage('Linux Build') { + agent { docker 'linux-build-agent:latest' } + steps { + echo 'Building..' + sh 'make build/hello-linux-64' + archiveArtifacts artifacts: 'build/hello-linux-64', fingerprint: true + } + } + stage('Windows Build') { + agent { docker 'windows-build-agent:latest' } + steps { + // echo 'Preparing..' + // cleanWs() + echo 'Building..' + sh 'make build/hello-win64.exe' + archiveArtifacts artifacts: 'build/hello-win64.exe', fingerprint: true + // echo 'Cleaning..' + // cleanWs cleanWhenFailure: false, cleanWhenNotBuilt: false, cleanWhenUnstable: false + } + } + stage('MacOSX Build') { + agent { docker 'macosx-build-agent:latest' } + steps { + echo 'Building..' + sh 'make build/hello-macosx.bin' + archiveArtifacts artifacts: 'build/hello-macosx.bin', fingerprint: true + } + } + stage('Linting') { + agent { docker 'lint-agent:latest' } + steps { + echo 'Linting..' + sh 'make tidy || true' + // junit allowEmptyResults: true, healthScaleFactor: 0.0, testResults: 'build/tidy.xml' + sh 'true' + } + } + } } stage('Test') { + agent { docker 'linux-build-agent:latest' } steps { echo 'Testing..' sh 'make test || true' - junit 'build/*.xml' + junit allowEmptyResults: true, healthScaleFactor: 0.0, testResults: 'build/tests.xml' } } stage('Deploy') { + agent { docker 'linux-build-agent:latest' } when { expression { currentBuild.result == null || currentBuild.result == 'SUCCESS' diff --git a/Makefile b/Makefile index 541ff31..11c1804 100644 --- a/Makefile +++ b/Makefile @@ -20,44 +20,47 @@ endif all: $(TARGETS) - echo "all..." - echo $(MAKE) - echo $(UNAME) + @echo "all..." + @echo $(UNAME) .PRECIOUS: $(BUILD_DIR)/ $(BUILD_DIR)%/ $(BUILD_DIR)/: - echo "dir1..." - mkdir -p $@ + @echo "dir1..." + @mkdir -p $@ $(BUILD_DIR)%/: - echo "dir2..." - mkdir -p $@ + @echo "dir2..." + @mkdir -p $@ .SECONDEXPANSION: $(BUILD_DIR)/hello-linux-64: | $$(@D)/. - x86_64-linux-gnu-g++ Test.cpp -o build/hello-linux-64 + @echo "Building Linux binary..." + @x86_64-linux-gnu-g++ Test.cpp -o build/hello-linux-64 $(BUILD_DIR)/hello-win64.exe: | $$(@D)/. - echo "Making..." - x86_64-w64-mingw32-g++ Test.cpp -o build/hello-win64.exe + @echo "Building Windows binary..." + @x86_64-w64-mingw32-g++ Test.cpp -o build/hello-win64.exe $(BUILD_DIR)/hello-macosx.bin: | $$(@D)/. - x86_64-apple-darwin19-c++ Test.cpp -o build/hello-macosx.bin + @echo "Building MacOSX binary..." + @x86_64-apple-darwin19-c++ Test.cpp -o build/hello-macosx.bin tidy: $(BUILD_DIR)/tidy.xml $(BUILD_DIR)/tidy.xml: | $$(@D)/. - chmod u+x ./clang-tidy-to-junit.py - clang-tidy -checks='c*,l*,m*' $(SOURCES) -- $(CXXFLAGS) | ./clang-tidy-to-junit.py $(PWD)/ > $@ + @chmod u+x ./clang-tidy-to-junit.py + @clang-tidy -checks='c*,l*,m*' $(SOURCES) -- $(CXXFLAGS) | ./clang-tidy-to-junit.py $(PWD)/ > $@ test: $(BUILD_DIR)/tests.xml $(BUILD_DIR)/tests.xml: | $$(@D)/. - echo "" > $@ + @echo '' > $@ + @echo '' >> $@ + @echo '' >> $@ publish: - echo "Publish..." + @echo "Publish..." diff --git a/Test.cpp b/Test.cpp index b7f4902..66b4f84 100644 --- a/Test.cpp +++ b/Test.cpp @@ -1,5 +1,7 @@ + #include + int main() { printf("hello\n"); diff --git a/build.sh b/build.sh deleted file mode 100755 index 13674d2..0000000 --- a/build.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash - -export PATH=/home/jryland/CrossCompilers/osxcross/target/bin:$PATH -make - diff --git a/clang-tidy-to-junit.py b/clang-tidy-to-junit.py old mode 100644 new mode 100755