From 52e17ff06e7aa1b60ccf7d147e990bbbdea8b3af Mon Sep 17 00:00:00 2001 From: retropikzel Date: Sun, 8 Jun 2025 11:16:23 +0300 Subject: [PATCH] Adding tests to Jenkins --- Dockerfile | 15 ++- Dockerfile.jenkins | 14 ++- Jenkinsfile | 237 +++++---------------------------------------- Makefile | 14 +++ README.md | 14 ++- compile-r7rs.scm | 76 +++++++++------ 6 files changed, 126 insertions(+), 244 deletions(-) diff --git a/Dockerfile b/Dockerfile index 8043993..5eb0719 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,9 +3,22 @@ FROM debian:bookworm AS build RUN apt-get update && apt-get install -y build-essential wget make cmake libgc-dev zlib1g-dev libffi-dev libssl-dev RUN wget https://bitbucket.org/ktakashi/sagittarius-scheme/downloads/sagittarius-0.9.12.tar.gz && tar -xf sagittarius-0.9.12.tar.gz RUN cd sagittarius-0.9.12 && mkdir build && cd build && cmake -DCMAKE_INSTALL_PREFIX=/usr/local-other .. && make && make install +WORKDIR /workdir +COPY Makefile . +COPY compile-r7rs.scm . +COPY snow/ snow/ +COPY libs/ libs/ +RUN ls -1 +RUN make && make install PREFIX=/usr/local-other FROM schemers/${COMPILE_R7RS} -RUN apt-get update && apt-get install -y make libffi8 libgc1 libssl3 libuv1 +RUN apt-get update && apt-get install -y \ + build-essential \ + make \ + libffi8 \ + libgc1 \ + libssl3 \ + libuv1 COPY --from=build /usr/local-other/ /usr/local-other/ ENV PATH=${PATH}:/usr/local-other/bin ARG COMPILE_R7RS=chibi diff --git a/Dockerfile.jenkins b/Dockerfile.jenkins index a9e404d..8f170ae 100644 --- a/Dockerfile.jenkins +++ b/Dockerfile.jenkins @@ -1,2 +1,12 @@ -FROM debian:bookworm -RUN apt-get update && apt-get install -y make docker +FROM schemers/sagittarius +RUN apt-get update && apt-get install -y \ + build-essential wget make cmake libgc-dev zlib1g-dev libffi-dev \ + libssl-dev docker.io +WORKDIR /builddir +COPY Makefile . +COPY compile-r7rs.scm . +COPY snow/ snow/ +COPY libs/ libs/ +RUN ls -1 +RUN make && make install +WORKDIR /workdir diff --git a/Jenkinsfile b/Jenkinsfile index fba5b8a..73c5d00 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,224 +1,37 @@ pipeline { - agent any + agent { + dockerfile { + filename 'Dockerfile.jenkins' + args '--user=root -v /var/run/docker.sock:/var/run/docker.sock' + } + } options { disableConcurrentBuilds() - buildDiscarder(logRotator(numToKeepStr: '10', artifactNumToKeepStr: '10')) + buildDiscarder(logRotator(numToKeepStr: '10', artifactNumToKeepStr: '10')) } stages { - stage("Build") { - agent { dockerfile { filename 'Dockerfile'; args '--user=root'; additionalBuildArgs '--build-arg COMPILE_R7RS=sagittarius' } } + + stage("Get implementation lists") { steps { - sh 'make' - sh 'make install' - sh 'make test-r6rs' - sh 'make test-r7rs' - } - } - stage("chez r6rs") { - agent { dockerfile { filename 'Dockerfile'; args '--user=root'; additionalBuildArgs '--build-arg COMPILE_R7RS=chezscheme' } } - steps { - catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') { - sh 'make && make install' - sh 'make test-r6rs' + script { + r6rs_implementations = sh 'sash -L ./snow -L . compile-r7rs.scm --list-r6rs-schemes' + r7rs_implementations = sh 'sash -L ./snow -L . compile-r7rs.scm --list-r7rs-schemes' } } } - stage("chibi r7rs") { - agent { dockerfile { filename 'Dockerfile'; args '--user=root'; additionalBuildArgs '--build-arg COMPILE_R7RS=chibi' } } - steps { - catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') { - sh 'make && make install' - sh 'make test-r7rs' - } - } - } - stage("cyclone r7rs") { - agent { dockerfile { filename 'Dockerfile'; args '--user=root'; additionalBuildArgs '--build-arg COMPILE_R7RS=cyclone' } } - steps { - catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') { - sh 'make && make install' - sh 'make test-r7rs' - } - } - } - stage("foment r7rs") { - agent { dockerfile { filename 'Dockerfile'; args '--user=root'; additionalBuildArgs '--build-arg COMPILE_R7RS=foment' } } - steps { - catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') { - sh 'make && make install' - sh 'make test-r7rs' - } - } - } - stage("gauche r7rs") { - agent { dockerfile { filename 'Dockerfile'; args '--user=root'; additionalBuildArgs '--build-arg COMPILE_R7RS=gauche' } } - steps { - catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') { - sh 'make && make install' - sh 'make test-r7rs' - } - } - } - stage("guile r6rs") { - agent { dockerfile { filename 'Dockerfile'; args '--user=root'; additionalBuildArgs '--build-arg COMPILE_R7RS=guile' } } - steps { - catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') { - sh 'make && make install' - sh 'make test-r6rs' - } - } - } - stage("guile r7rs") { - agent { dockerfile { filename 'Dockerfile'; args '--user=root'; additionalBuildArgs '--build-arg COMPILE_R7RS=guile' } } - steps { - catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') { - sh 'make && make install' - sh 'make test-r7rs' - } - } - } - stage("ikarus r6rs") { - agent { dockerfile { filename 'Dockerfile'; args '--user=root'; additionalBuildArgs '--build-arg COMPILE_R7RS=ikarus' } } - steps { - catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') { - sh 'make && make install' - sh 'make test-r6rs' - } - } - } - stage("ironscheme r6rs") { - agent { dockerfile { filename 'Dockerfile'; args '--user=root'; additionalBuildArgs '--build-arg COMPILE_R7RS=ironscheme' } } - steps { - catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') { - sh 'make && make install' - sh 'make test-r6rs' - } - } - } - stage("kawa r7rs") { - agent { dockerfile { filename 'Dockerfile'; args '--user=root'; additionalBuildArgs '--build-arg COMPILE_R7RS=kawa' } } - steps { - catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') { - sh 'make && make install' - sh 'make test-r7rs' - } - } - } - stage("larceny r6rs") { - agent { dockerfile { filename 'Dockerfile'; args '--user=root'; additionalBuildArgs '--build-arg COMPILE_R7RS=larceny' } } - steps { - catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') { - sh 'make && make install' - sh 'make test-r6rs' - } - } - } - stage("larceny r7rs") { - agent { dockerfile { filename 'Dockerfile'; args '--user=root'; additionalBuildArgs '--build-arg COMPILE_R7RS=larceny' } } - steps { - catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') { - sh 'make && make install' - sh 'make test-r7rs' - } - } - } - stage("loko r6rs") { - agent { dockerfile { filename 'Dockerfile'; args '--user=root'; additionalBuildArgs '--build-arg COMPILE_R7RS=loko' } } - steps { - catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') { - sh 'make && make install' - sh 'make test-r6rs' - } - } - } - stage("loko r7rs") { - agent { dockerfile { filename 'Dockerfile'; args '--user=root'; additionalBuildArgs '--build-arg COMPILE_R7RS=loko' } } - steps { - catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') { - sh 'make && make install' - sh 'make test-r7rs' - } - } - } - stage("mit-scheme r7rs") { - agent { dockerfile { filename 'Dockerfile'; args '--user=root'; additionalBuildArgs '--build-arg COMPILE_R7RS=mit-scheme' } } - steps { - catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') { - sh 'make && make install' - sh 'make test-r7rs' - } - } - } - stage("mosh r6rs") { - agent { dockerfile { filename 'Dockerfile'; args '--user=root'; additionalBuildArgs '--build-arg COMPILE_R7RS=mosh' } } - steps { - catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') { - sh 'make && make install' - sh 'make test-r6rs' - } - } - } - stage("mosh r7rs") { - agent { dockerfile { filename 'Dockerfile'; args '--user=root'; additionalBuildArgs '--build-arg COMPILE_R7RS=mosh' } } - steps { - catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') { - sh 'make && make install' - sh 'make test-r7rs' - } - } - } - stage("sagittarius r6rs") { - agent { dockerfile { filename 'Dockerfile'; args '--user=root'; additionalBuildArgs '--build-arg COMPILE_R7RS=sagittarius' } } - steps { - catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') { - sh 'apt-get update && apt-get install -y make libuv1' - sh 'make && make install' - sh 'make test-r6rs' - } - } - } - stage("sagittarius r7rs") { - agent { dockerfile { filename 'Dockerfile'; args '--user=root'; additionalBuildArgs '--build-arg COMPILE_R7RS=sagittarius' } } - steps { - catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') { - sh 'make && make install' - sh 'make test-r7rs' - } - } - } - stage("skint r7rs") { - agent { dockerfile { filename 'Dockerfile'; args '--user=root'; additionalBuildArgs '--build-arg COMPILE_R7RS=skint' } } - steps { - catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') { - sh 'make && make install' - sh 'make test-r7rs' - } - } - } - stage("tr7 r7rs") { - agent { dockerfile { filename 'Dockerfile'; args '--user=root'; additionalBuildArgs '--build-arg COMPILE_R7RS=tr7' } } - steps { - catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') { - sh 'make && make install' - sh 'make test-r7rs' - } - } - } - stage("ypsilon r6rs") { - agent { dockerfile { filename 'Dockerfile'; args '--user=root'; additionalBuildArgs '--build-arg COMPILE_R7RS=ypsilon' } } - steps { - catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') { - sh 'make && make install' - sh 'make test-r6rs' - } - } - } - stage("ypsilon r7rs") { - agent { dockerfile { filename 'Dockerfile'; args '--user=root'; additionalBuildArgs '--build-arg COMPILE_R7RS=ypsilon' } } - steps { - catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') { - sh 'make && make install' - sh 'make test-r7rs' + + stages { + stage('Test R6RS implementations') { + steps { + script { + r6rs_implementations.each { implementation-> + stage("${implementation} ${test}") { + catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') { + sh "make test-r6rs COMPILE_R7RS=${implementation}" + } + } + } + } } } } diff --git a/Makefile b/Makefile index 74ae54e..3fa1fc0 100644 --- a/Makefile +++ b/Makefile @@ -3,6 +3,20 @@ PREFIX=/usr/local build: printf "#!/bin/sh\nsash --disable-cache -r7 -L ${PREFIX}/lib/compile-r7rs/snow ${PREFIX}/lib/compile-r7rs/main.scm \"\$$@\"\n" > compile-r7rs +build-docker-images: + for implementation in $(shell sash -L ./snow -L . compile-r7rs.scm --list-schemes); \ + do \ + docker build . --build-arg COMPILE_R7RS=$${implementation} --tag=retropikzel1/compile-r7rs:$${implementation}; \ + done + +#for implementation in $(shell sash -L ./snow -L . compile-r7rs.scm --list-schemes); + +push-docker-images: + for implementation in chibi chicken sagittarius; \ + do \ + docker push compile-r7rs:$${implementation}; \ + done + snow: mkdir -p snow cp -r ../foreign-c/foreign snow/ diff --git a/README.md b/README.md index 7d1e814..5cf048e 100644 --- a/README.md +++ b/README.md @@ -232,7 +232,15 @@ The environment variable COMPILE\_R7RS must be set to the **name** of the implementation as specified in the support list. **This differs from the SRFI** as the SRFI excepts a path. -To get the list of supported implementations run: +To get the list of supported R6RS implementations run: + + compile-r7rs --list-r6rs-schemes + +To get the list of supported R7RS implementations run: + + compile-r7rs --list-r7rs-schemes + +To get the list of all supported implementations run: compile-r7rs --list-schemes @@ -314,6 +322,10 @@ tried to compile them in wrong order you would run: ## Usage with Docker +You can compile the docker images with: + + make build-docker-images + Here is a sample Dockerfile to get you started. ARG COMPILE_R7RS=chibi diff --git a/compile-r7rs.scm b/compile-r7rs.scm index 3e91c29..e3b550c 100644 --- a/compile-r7rs.scm +++ b/compile-r7rs.scm @@ -9,39 +9,59 @@ (libs library-util) (srfi 170)) +(define r6rs-schemes '(chezscheme + guile + ikarus + ironscheme + larceny + loko + mosh + racket + sagittarius + ypsilon)) +(define r7rs-schemes '(chibi + chicken + cyclone + gambit + foment + gauche + guile + kawa + larceny + loko + mit-scheme + mosh + racket + sagittarius + skint + stklos + tr7 + ypsilon)) + +(define all-schemes (append r6rs-schemes r7rs-schemes)) + +(when (member "--list-r6rs-schemes" (command-line)) + (for-each + (lambda (scheme) + (display scheme) + (newline)) + r6rs-schemes) + (exit 0)) + +(when (member "--list-r7rs-schemes" (command-line)) + (for-each + (lambda (scheme) + (display scheme) + (newline)) + r7rs-schemes) + (exit 0)) + (when (member "--list-schemes" (command-line)) (for-each (lambda (scheme) (display scheme) (newline)) - '(chezscheme - chibi - chicken - cyclone - gambit - foment - gauche - ;gerbil - guile - ;husk - ikarus - ironscheme - kawa - larceny - loko - ;meevax - mit-scheme - mosh - racket - ;picrin - ;scheme-rs - ;stak - sagittarius - skint - stklos - tr7 - ;vicare - ypsilon)) + all-schemes) (exit 0)) (define scheme (if (get-environment-variable "COMPILE_R7RS")