Skip to content

Commit

Permalink
Merge pull request #51 from open-dynaMIX/test-commit-hook
Browse files Browse the repository at this point in the history
feat(semantic-releases): use semantic releases
  • Loading branch information
open-dynaMIX authored May 15, 2019
2 parents f6f2346 + 1e18308 commit 5ee4f5f
Show file tree
Hide file tree
Showing 7 changed files with 90 additions and 22 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,7 @@ target/

# IDE specific configurations
.idea/

# npm
node_modules/
package-lock.json
11 changes: 11 additions & 0 deletions .releaserc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"branch": "release",
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
["@semantic-release/changelog", {
"changelogFile": "CHANGELOG.md"
}],
"@semantic-release/github"
]
}
58 changes: 37 additions & 21 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,42 @@ env:
global:
- DOCKER_COMPOSE_VERSION=1.23.1

before_install:
# install newer compose version
- sudo rm /usr/local/bin/docker-compose
- curl -L https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-`uname -s`-`uname -m` > docker-compose
- chmod +x docker-compose
- sudo mv docker-compose /usr/local/bin
jobs:
include:
- stage: tests
name: "Tests"
before_install:
# install newer compose version
- sudo rm /usr/local/bin/docker-compose
- curl -L https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-`uname -s`-`uname -m` > docker-compose
- chmod +x docker-compose
- sudo mv docker-compose /usr/local/bin

# Workaround for https://github.com/travis-ci/travis-ci/issues/4842
# Let's stop postgresql
- sudo service postgresql stop
# wait for postgresql to shutdown
- while sudo lsof -Pi :5432 -sTCP:LISTEN -t; do sleep 1; done
# Workaround for https://github.com/travis-ci/travis-ci/issues/4842
# Let's stop postgresql
- sudo service postgresql stop
# wait for postgresql to shutdown
- while sudo lsof -Pi :5432 -sTCP:LISTEN -t; do sleep 1; done
install:
- docker-compose up -d --build
- npm install @commitlint/{config-conventional,travis-cli}
script:
- docker-compose up -d db caluma
- docker-compose run --rm interval black --check .
- docker-compose run --rm interval flake8
- ./node_modules/.bin/commitlint-travis
- docker-compose run --rm interval wait-for-it.sh db:5432
- docker-compose run --rm interval wait-for-it.sh caluma:8000
- docker-compose run --rm interval pytest --no-cov-on-fail --cov

install:
- docker-compose up -d --build

script:
- docker-compose up -d db caluma
- docker-compose run --rm interval black --check .
- docker-compose run --rm interval flake8
- docker-compose run --rm interval wait-for-it.sh db:5432
- docker-compose run --rm interval wait-for-it.sh caluma:8000
- docker-compose run --rm interval pytest --no-cov-on-fail --cov
- stage: release
if: branch = release and type = push
script: skip
deploy:
provider: script
skip_cleanup: true
on:
branch: release
script:
- nvm install lts/*
- npx semantic-release
28 changes: 28 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -225,3 +225,31 @@ interval:
depends_on:
- caluma
```

## Contribution
We use following tools in order to standardize development and releases:

* flake8
* black
* isort
* commitlint

### pre-commit hooks

Pre commit hooks is an additional option instead of executing checks in your editor of choice.

First create a virtualenv with the tool of your choice before running below commands:

```bash
pip install pre-commit
pip install -r requirements-dev.txt -U
pre-commit install
```

### commit-msg hook
If you want to have your commit message automatically linted, execute below commands:

```bash
npm install @commitlint/{config-conventional,cli}
ln -s "$(pwd)/commit-msg" .git/hooks/commit-msg
```
8 changes: 8 additions & 0 deletions commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/sh
#
# Called by "git commit" with one argument, the name of the file
# that has the commit message. The hook should exit with non-zero
# status after issuing an appropriate message if it wants to stop the
# commit. The hook is allowed to edit the commit message file.

cat "$1" | ./node_modules/.bin/commitlint
1 change: 1 addition & 0 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = {extends: ['@commitlint/config-conventional']};
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

setup(
name="caluma_interval",
version="0.0.1",
version="0.0.0",
description="Caluma companion app for periodic usage of forms",
url="https://projectcaluma.github.io/",
license="MIT",
Expand Down

0 comments on commit 5ee4f5f

Please sign in to comment.