From c7ad384d9cb4f9966319e03153d73561680ea5a0 Mon Sep 17 00:00:00 2001 From: Eric Timmons Date: Fri, 16 Oct 2020 18:40:25 +0000 Subject: [PATCH] Add Gitlab CI jobs for testing on a variety of Lisps The jobs that use the Makefile based test harness are created unconditionally. There are additionally jobs that use the Lisp scripting based harness which are added only if the CI environment variable USE_ASDF_TOOLS is set. --- README.md | 31 +++++ gitlab-ci.yml | 208 ++++++++++++++++++++++++++++++ test/run-tests.sh | 18 ++- test/test-run-program-unix.script | 8 +- 4 files changed, 258 insertions(+), 7 deletions(-) create mode 100644 gitlab-ci.yml diff --git a/README.md b/README.md index dd91edda..f0091062 100644 --- a/README.md +++ b/README.md @@ -144,6 +144,34 @@ indeed, a developer may not only make mistakes, but may deliberately introduce or re-introduce bugs at some place to test code in another place. +Contributing to ASDF +-------------------- + +Bugs can be filled on ASDF by reporting them on the [Gitlab issue +tracker](https://gitlab.common-lisp.net/asdf/asdf/-/issues) or sending them to +the [asdf-devel mailing list](https://mailman.common-lisp.net/listinfo/asdf-devel). + +You can contribute code to ASDF development by forking the +[repository](https://gitlab.common-lisp.net/asdf/asdf) and sending a merge +request or sending a patch to the asdf-devel mailing list. + +If you fork the repository on Gitlab, note that Gitlab CI is enabled to help in +automated testing. While not exhaustive, this can help make sure you don't +inadvertantly break anything with your patch! The tests will be run any time +you submit a merge request or manually trigger a run using Gitlab's UI. In +order for the tests to run properly (namely the ASDF upgrade tests), you must +ensure your fork contains the tags for every released version of ASDF. If your +fork is freshly created, this will happen automatically. However, if there has +been a release since you forked, you need to update your tags. Assuming that +your fork is the `origin` remote and upstream is the `upstream` remote, you can +do this by running: + + git fetch upstream --tags + git push origin --tags + +If you would like to enable test jobs that use the Lisp scripting test harness, +set the variable `ENABLE_ASDF_TOOLS` on a pipeline. + Debugging ASDF -------------- @@ -297,3 +325,6 @@ How do I navigate this source tree? * [TODO](TODO) * Plenty of ideas for how to further improve ASDF (not all of them guaranteed good ideas.) + +* [gitlab-ci.yml](gitlab-ci.yml) + * A YAML file describing jobs for Gitlab CI to run. diff --git a/gitlab-ci.yml b/gitlab-ci.yml new file mode 100644 index 00000000..3b9bd7d2 --- /dev/null +++ b/gitlab-ci.yml @@ -0,0 +1,208 @@ +############################################################################### +# Global configuration +############################################################################### + +variables: + # Just let the runner fetch and update the submodules for us. + GIT_SUBMODULE_STRATEGY: normal + + +# This causes pipelines to be created only on the default branch, tags, merge +# requests, and when triggered via the web interface. +workflow: + rules: + - if: $CI_MERGE_REQUEST_IID + - if: $CI_COMMIT_TAG + - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH + - if: $CI_PIPELINE_SOURCE == "web" + +# Split regression testing into a separate stage than upgrade tests. The +# upgrade tests tend to run slower and are generally less important than +# regression tests for most changes. +stages: + - build + - regression + - upgrade + +############################################################################### +# Build jobs +############################################################################### + +Build ASDF: + stage: build + image: debian:latest + script: + - apt-get update + - apt-get install -y --no-install-recommends git make + - make + artifacts: + paths: + - build/asdf.lisp + +Build docs: + stage: build + image: debian:latest + script: + - apt-get update + - apt-get install -y --no-install-recommends git make texinfo texlive + - make -C doc + artifacts: + paths: + - doc/asdf.html + - doc/asdf.info + - doc/asdf.pdf + +Build asdf-tools: + stage: build + image: mitmers/sbcl:latest + script: + - apt-get update + - apt-get install -y --no-install-recommends git make + - make -f Makefile-lisp-scripting build-asdf-tools + artifacts: + paths: + - build/asdf-tools + rules: + - if: $ENABLE_ASDF_TOOLS + +############################################################################### +# Testing Templates +############################################################################### + +.Regression tests: + stage: regression + image: mitmers/$l:$TAG + variables: + TAG: latest + script: + - apt-get update + - apt-get install -y --no-install-recommends git make + - make + - make test + artifacts: + paths: + - build/results/$l-test.text + needs: [] + +.Upgrade tests: + stage: upgrade + image: mitmers/$l:$TAG + variables: + TAG: latest + script: + - apt-get update + - apt-get install -y --no-install-recommends git make + - make + - make test-upgrade + artifacts: + paths: + - build/results/$l-upgrade.text + needs: [] + allow_failure: true + +.Scripting regression tests: + extends: .Regression tests + before_script: + - ln -s Makefile-lisp-scripting GNUmakefile + needs: + - Build asdf-tools + rules: + - if: $ENABLE_ASDF_TOOLS + +.Scripting upgrade tests: + extends: .Upgrade tests + before_script: + - ln -s Makefile-lisp-scripting GNUmakefile + needs: + - Build asdf-tools + rules: + - if: $ENABLE_ASDF_TOOLS + +############################################################################### +# Actual test jobs - Makefile based harness +############################################################################### + +ABCL regression tests: + extends: .Regression tests + variables: + l: abcl + +ABCL upgrade tests: + extends: .Upgrade tests + variables: + l: abcl + +CCL regression tests: + extends: .Regression tests + variables: + l: ccl + +CCL upgrade tests: + extends: .Upgrade tests + variables: + l: ccl + +ECL regression tests: + extends: .Regression tests + variables: + l: ecl + +ECL upgrade tests: + extends: .Upgrade tests + variables: + l: ecl + +SBCL regression tests: + extends: .Regression tests + variables: + l: sbcl + +SBCL upgrade tests: + extends: .Upgrade tests + variables: + l: sbcl + + +############################################################################### +# Actual test jobs - lisp scripting based harness +############################################################################### + +ABCL scripting regression tests: + extends: .Scripting regression tests + variables: + l: abcl + +ABCL scripting upgrade tests: + extends: .Scripting upgrade tests + variables: + l: abcl + +CCL scripting regression tests: + extends: .Scripting regression tests + variables: + l: ccl + +CCL scripting upgrade tests: + extends: .Scripting upgrade tests + variables: + l: ccl + +ECL scripting regression tests: + extends: .Scripting regression tests + variables: + l: ecl + +ECL scripting upgrade tests: + extends: .Scripting upgrade tests + variables: + l: ecl + +SBCL scripting regression tests: + extends: .Scripting regression tests + variables: + l: sbcl + +SBCL scripting upgrade tests: + extends: .Scripting upgrade tests + variables: + l: sbcl diff --git a/test/run-tests.sh b/test/run-tests.sh index 4a8ca294..34a3a409 100755 --- a/test/run-tests.sh +++ b/test/run-tests.sh @@ -476,6 +476,7 @@ run_upgrade_tests () { su=test/script-support.lisp tags="`upgrade_tags`" methods="`upgrade_methods`" + echo success > build/results/${lisp}-upgrade.status { for tag in $tags ; do for method in $methods ; do @@ -491,10 +492,21 @@ run_upgrade_tests () { echo "$icmd" echo "then copy/paste:" echo "(load \"$su\") (asdf-test::da) (test-upgrade $method \"$tag\")" - exit 1 ;} - fi ; done ; done - echo "Upgrade test succeeded for ${lisp}" + echo "failure" > "build/results/${lisp}-upgrade.status" ;} + fi ; done ; done ; + read status < "build/results/${lisp}-upgrade.status" + if [ "$status" = "success" ]; then + echo "Upgrade test succeeded for ${lisp}" + else + echo "Upgrade test failed for ${lisp}" + fi ; } 2>&1 | tee build/results/${lisp}-upgrade.text + # We need to reread the status because the piping to tee causes everything + # in the block above to be run in a subshell. + read status < "build/results/${lisp}-upgrade.status" + if [ "$status" = "failure" ]; then + exit 1 + fi } run_tests () { create_config diff --git a/test/test-run-program-unix.script b/test/test-run-program-unix.script index 15114142..b261b453 100644 --- a/test/test-run-program-unix.script +++ b/test/test-run-program-unix.script @@ -480,7 +480,7 @@ (let ((process-info (launch-program "./sleeper.sh 12 1"))) (handle-result "alive?" (process-alive-p process-info)) - (sleep 2) + (sleep 5) (handle-result "dead?" (not (process-alive-p process-info))) (wait-process process-info))) @@ -552,7 +552,7 @@ (let* ((process-info (launch-program "./sleeper.sh 12 1")) (status (process-status process-info))) (handle-result "running?" (equal :running status)) - (sleep 2) + (sleep 5) (multiple-value-bind (status exit-code) (process-status process-info) (handle-result "exited?" (equal :exited status)) @@ -568,7 +568,7 @@ #+(and lispworks (not lispworks7+)) (skip-test "Known to fail") (let* ((process-info (launch-program "./killer.sh"))) - (sleep 1) + (sleep 5) (multiple-value-bind (status code) (process-status process-info) (handle-result "exited or signaled?" @@ -588,7 +588,7 @@ (define-test ":exited (it exited >128; repeated query)" (let* ((process-info (launch-program "./killercontainer.sh"))) - (sleep 1) + (sleep 5) (multiple-value-bind (status code) (process-status process-info) (handle-result "exited?" (eq status :exited)) -- GitLab