chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Chicken-users] A poor man's continuous integration server with awful+sp


From: Ivan Raikov
Subject: [Chicken-users] A poor man's continuous integration server with awful+spiffy
Date: Mon, 5 Nov 2012 09:49:36 +0900

Hi all,

    I recently had the need to automatically produce native binaries for nemo, one of my applications written in Scheme. So I decided to try using awful to construct a simple server script that can fetch the latest version of nemo from svn, compile nemo and its dependencies, make a release tarball, and allow clients to download the latest tarball. With Mario's help, it all worked quite well, so I am attaching the resulting script for posterity.

   The only difficulty I had was creating a download page that can return one of two types of content: 1) .tar.gz file with correct MIME type and disposition or 2) an HTML page informing the client that a build is currently in progress. The download page specification in awful ended up as follows:

(define-page "/nemo-download"
  (lambda ()
    (let ((version.path (update-nemo-build)))

      ;; check if the build lock file exists, meaning a build is currently
      ;; in progress
      (if (file-exists? (build-lock-path (car version.path)))

          `(html (body (p "Build in progress, try again later.")))

          ;; otherwise return the .tar.gz file
          (lambda ()
            (let ((rel-path (release-file-path (car version.path))))
              (parameterize ((root-path (pathname-directory rel-path)))
                (send-file (pathname-strip-directory rel-path))))))))

  no-template: #t)

The send-file procedure is based on send-static-file from spiffy, and its implementation can be seen in the attached file. I hope this is useful for some.

   -Ivan
   


Attachment: nemo-ci.scm
Description: Binary data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]