gitlab-org--gitlab-foss/doc/ci/examples/test-clojure-application.md

1.7 KiB

stage group info type
Verify Continuous Integration To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments tutorial

NOTE: This document has not been updated recently and could be out of date. For the latest documentation, see the GitLab CI/CD page and the GitLab CI/CD Pipeline Configuration Reference.

Test a Clojure application with GitLab CI/CD

This example will guide you how to run tests on your Clojure application.

You can view or fork the example source and view the logs of its past CI jobs.

Configure the project

This is what the .gitlab-ci.yml file looks like for this project:

variables:
  POSTGRES_DB: sample-test
  DATABASE_URL: "postgresql://postgres@postgres:5432/sample-test"

before_script:
  - apt-get update -y
  - apt-get install default-jre postgresql-client -y
  - wget https://raw.githubusercontent.com/technomancy/leiningen/stable/bin/lein
  - chmod a+x lein
  - export LEIN_ROOT=1
  - PATH=$PATH:.
  - lein deps
  - lein migratus migrate

test:
  script:
    - lein test

In before_script, we install JRE and Leiningen.

The sample project uses the migratus library to manage database migrations, and we have added a database migration as the last step of before_script.

You can use public runners available on gitlab.com for testing your application with this configuration.