228.md 1.7 KB
Newer Older
Lab机器人's avatar
readme  
Lab机器人 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
# Test a Clojure application with GitLab CI/CD

> 原文:[https://docs.gitlab.com/ee/ci/examples/test-clojure-application.html](https://docs.gitlab.com/ee/ci/examples/test-clojure-application.html)

*   [Configure the project](#configure-the-project)

**注意:**本文档最近未更新,可能已过期. 有关最新文档,请参见[GitLab CI / CD](../README.html)页面和《 [GitLab CI / CD 管道配置参考》](../yaml/README.html) .

# Test a Clojure application with GitLab CI/CD[](#test-a-clojure-application-with-gitlab-cicd "Permalink")

本示例将指导您如何在 Clojure 应用程序上运行测试.

您可以查看或派生[示例源,](https://gitlab.com/dzaporozhets/clojure-web-application)并查看其过去的[CI 作业](https://gitlab.com/dzaporozhets/clojure-web-application/builds?scope=finished)的日志.

## Configure the project[](#configure-the-project "Permalink")

这是此项目的`.gitlab-ci.yml`文件的外观:

```
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 
```

`before_script` ,我们安装了 JRE 和[Leiningen](https://leiningen.org/) .

该示例项目使用[migratus](https://github.com/yogthos/migratus)库管理数据库迁移,并且在`before_script`的最后一步中添加了数据库迁移.

您可以使用`gitlab.com`可用的公共`gitlab.com`程序来使用此配置测试您的应用程序.