metabase / toucan

A classy high-level Clojure library for defining application models and retrieving them from a DB
Eclipse Public License 1.0
570 stars 49 forks source link

Update Circle CI #44

Closed ElizabethForest closed 5 years ago

ElizabethForest commented 5 years ago

I have updated the project so that it will work with Circle CI 2.1 and so that deploys are automated.

When a branch isn't master it will deploy a snapshot to clojars with the version of [version]-[branch-name]-SNAPSHOT. Otherwise, when on the master branch, it will be released with the version number. To update the version just update the VERSION file.

Since the updates use Circle CI 2.1 Enable build processing needs to be turned in the Toucan Circle CI Settings under Advanced Settings. For the deploys to work a context needs to be added to Circle CI with the name of clojars with the environment variables CLOJARS_USERNAME and CLOJARS_PASSWORD.

Here is in action! https://circleci.com/gh/jesims/workflows/toucan

@camsaul

camsaul commented 5 years ago

Cool. Looks good. A couple requests:

Instead of having to maintain a separate VERSION file, I think it makes sense just to keep the version in project.clj as the source of truth. Most other projects keep the version something like <next-version>-SNAPSHOT so for Toucan right now it could be 1.10-SNAPSHOT. Then when the time comes to do a new release I can do that manually

Second, in my experience CircleCI 2.0 Docker images work 1000x better than machine, which seems almost practically unsupported. Instead something like this should do the trick:

jobs:
  test:
    working_directory: /home/circleci/metabase/toucan
    docker:
      - image: circleci/clojure:lein-2.8.1
      - image: circleci/postgres:9.6-alpine
        environment:
          POSTGRES_USER: toucan_test
          POSTGRES_DB: toucan_test
    steps:
      - checkout
      - run:
          name: Run tests
          environment:
            TOUCAN_TEST_DB_USER: toucan_test
          command: lein test
          no_output_timeout: 5m
      - run:
          name: Run linters
          command: lein lint
          no_output_timeout: 5m
camsaul commented 5 years ago

I want to merge some changes to Toucan this afternoon so I'll go ahead and merge this and tweak things a little bit myself.

Thanks for the contribution!

camsaul commented 5 years ago

Massive success @ElizabethForest

https://clojars.org/toucan/versions/1.10.0-SNAPSHOT