Skip to content

Commit bb03b27

Browse files
authored
Merge pull request #25 from datopian/fix/local-docker-launchers
Fix/local docker launchers
2 parents 7b2c880 + 8c322ea commit bb03b27

6 files changed

Lines changed: 38 additions & 33 deletions

File tree

CONTRIBUTING.md

Lines changed: 0 additions & 29 deletions
This file was deleted.

README.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,3 +75,33 @@ We can make different queries:
7575
#### Query Table with Limit and Offset (pagination)
7676

7777
![Query Table Limit Offset](documentation/query-table-limit-offset.png)
78+
79+
## Contributing
80+
81+
### Local development environment
82+
83+
1. launch bg services (postgres + hasura) (`bash run-mock-environment.sh`)
84+
2. `cp .env.example .env`
85+
3. `yarn`
86+
4. `yarn start` to launch server / `yarn test` to run tests
87+
5. install and use prettier to format code - https://prettier.io/docs/en/install.html (otherwise new builds will likely fail)
88+
89+
Please don't forget to add new variables to `.env.example` - they also will be used in ci tests.
90+
91+
### CI
92+
93+
#### Tests
94+
95+
Tests and formating check and run automatically on every push and pull request to master. They run on Docker hub. See documentation here https://docs.docker.com/docker-hub/builds/automated-testing/
96+
97+
To simulate tests as running on dockerhub you can run `bash run-tests-in-docker.sh` file.
98+
99+
If a pull request has failed checks it shows an error message in GitHub. The link to DockerHub does not work though.
100+
You will need to navigate there:
101+
102+
- Docker repository is here https://hub.docker.com/repository/docker/datopian/data-api
103+
- To see build jobs go to builds https://hub.docker.com/repository/docker/datopian/data-api/builds and find your build/test
104+
105+
#### Docker image builds
106+
107+
After every push to master and successful tests there is a new docker image built here https://hub.docker.com/repository/docker/datopian/data-api/builds

run-docker-compose.sh

Lines changed: 0 additions & 2 deletions
This file was deleted.

run-mock-environment.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/bash
2+
3+
# Launches mock postgres and hasura from `environment` directory
4+
# Useful for development locally
5+
6+
docker-compose up --build && docker-compose rm -fsv

run-single-test.sh

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@
33
# This script imitates how the tests will be run on dockerhub
44
# you can run to see the test execution in docker container locally
55

6-
docker-compose -f docker-compose.test.yml -p datopian-data-api-test up --exit-code-from sut --renew-anon-volumes --build
6+
docker-compose -f docker-compose.test.yml -p datopian-data-api-test up --exit-code-from sut --renew-anon-volumes --build && \
7+
docker-compose -f docker-compose.test.yml -p datopian-data-api-test rm -fsv

0 commit comments

Comments
 (0)