Skip to content

Commit

Permalink
Add support for bitbucket pipelines
Browse files Browse the repository at this point in the history
  • Loading branch information
neil-lindquist committed Aug 10, 2019
1 parent 76a89af commit 7cc74ad
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,4 @@ Finally, if the `COVERALLS` environmental variable is set, then `:COVERALLS` is
| Circle CI | `:CIRCLE-CI` |
| Appveyor | `:APPVEYOR` |
| GitLab CI | `:GITLAB-CI` |
| Bitbucket Pipelines | `:bitbucket-pipelines` |
9 changes: 9 additions & 0 deletions bitbucket-pipelines.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
pipelines:
default:
- step:
name: Build and test
script:
- PATH=~/.roswell/bin:$PATH
- curl -L https://raw.githubusercontent.com/roswell/roswell/release/scripts/install-for-ci.sh | bash
- echo "(:tree \"$BITBUCKET_CLONE_DIR/\")" > "$HOME/.config/common-lisp/source-registry.conf.d/ci.conf"
- roswell/run-fiveam.ros -l ci-utils/test :bitbucket-pipelines-tests :noncoveralls-tests :base-tests
5 changes: 5 additions & 0 deletions src/ci-utils.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#+circleci :circleci
#+appveyor :appveyor
#+gitlab-ci :gitlab-ci
#+bitbucket-pipelines :bitbucket-pipelines
#+unknown-ci :unknown-ci
#-ci nil)

Expand All @@ -29,6 +30,7 @@
#+circleci (uiop:getenv "CIRCLE_WORKING_DIRECTORY")
#+appveyor (string-upcase (uiop:getenv "APPVEYOR_BUILD_FOLDER") :end 1)
#+gitlab-ci (uiop:getenv "CI_PROJECT_DIR")
#+bitbucket-pipelines (uiop:getenv "BITBUCKET_CLONE_DIR")
#+(or (not ci) unknown-ci) (uiop:getcwd))


Expand All @@ -39,6 +41,7 @@
#+circleci (not (null (uiop:getenvp "CIRCLE_PULL_REQUESTS")))
#+appveyor (not (null (uiop:getenvp "APPVEYOR_PULL_REQUEST_NUMBER")))
#+gitlab-ci (not (null (uiop:getenvp "CI_MERGE_REQUEST_ID")))
#+bitbucket-pipelines (not (null (uiop:getenvp "BITBUCKET_PR_ID")))
#+(or (not ci) unknown-ci) nil)

(defun branch ()
Expand All @@ -48,4 +51,6 @@
#+circleci (uiop:getenvp "CIRCLE_BRANCH")
#+appveyor (uiop:getenvp "APPVEYOR_REPO_BRANCH")
#+gitlab-ci (uiop:getenvp "CI_COMMIT_REF_NAME")
#+bitbucket-pipelines (or (uiop:getenvp "BITBUCKET_BRANCH")
(uiop:getenvp "BITBUCKET_TAG"))
#+(or (not ci) unknown-ci) nil)
1 change: 1 addition & 0 deletions src/features.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
((uiop:getenvp "CIRCLECI") :circleci)
((uiop:getenvp "APPVEYOR") :appveyor)
((uiop:getenvp "GITLAB_CI") :gitlab-ci)
((uiop:getenvp "BITBUCKET_BUILD_NUMBER") :bitbucket-pipelines)
(t :unknown-ci))
*features*))

Expand Down
8 changes: 8 additions & 0 deletions t/tests.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,14 @@
(is (eq (not (null (uiop:getenvp "CI_MERGE_REQUEST_ID")))
(pull-request-p))))

(test :bitbucket-pipelines-tests
(is-true (member :bitbucket-pipelines *features*))
(is-false (member :circleci *features*))
(is (eq :bitbucket-pipelines (platform)))
(is (string= (uiop:getenv "BITBUCKET_BRANCH") (branch)))
(is (eq (not (null (uiop:getenvp "BITBUCKET_PR_ID")))
(pull-request-p))))


(test :base-tests
(is-true (member :ci *features*))
Expand Down

0 comments on commit 7cc74ad

Please sign in to comment.