diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..9bf20a3 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,23 @@ +dist: xenial +matrix: + include: + - language: go + go: "1.11" + before_install: + - cd api + install: + - go get -d -v ./... + before_script: + - mkdir -p ${UNPROCESSED_IMAGES} + script: + - go tool vet . + - go test ./... + env: GO111MODULE=on + services: mongodb + - language: node_js + node_js: "node" + before_install: + - cd client + script: + - yarn lint && yarn test && yarn build + cache: yarn \ No newline at end of file diff --git a/README.md b/README.md index f2acb94..e65271e 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ ## Tagallery +[![Build Status](https://travis-ci.org/catyphram/tagallery.svg?branch=master)](https://travis-ci.org/catyphram/tagallery) + Tagallery is an automated image tagging gallery where one can categorize images. To speed up this handy work, a neural network will try to figure out the categories of an image by comparing it with already categorized ones and proposes these cateogries for validation. **This project is Work In Progress.** @@ -29,7 +31,7 @@ The config params can also be set via environment variables. Go into the `api/` folder and run `go get -d ./...` to download the dependencies, followed by `go build` to compile the executable. This project is using [Go Modules](https://github.com/golang/go/wiki/Modules), which were introduced with Go v1.11. So, make sure that the project code is outside your `$GOPATH/src`, or set the environment variable `GO111MODULE=on` when running `go get|build|...`. -#### Running +#### Execution Once built the executable can be started with `./api -c=/path/to/config.json`, or, if using env variables, `UNPROCESSED_IMAGES=/path/to/image/dir PORT=3333 DATABASE=tagallery DATABASE_HOST=localhost:27017 ./api`. diff --git a/api/test/integration_test.go b/api/test/integration_test.go index 9c2d3e7..4348acb 100644 --- a/api/test/integration_test.go +++ b/api/test/integration_test.go @@ -1,6 +1,7 @@ package test import ( + "time" "encoding/json" "fmt" "io/ioutil" @@ -72,7 +73,13 @@ func startAPI() error { if err != nil { return err } + go http.ListenAndServe(fmt.Sprintf(":%v", config.GetConfig().Port), router.CreateRouter()) + + // Wait 100 milliseconds to ensure that the http server has started + // before the integration tests are run. A race condition may otherwise occur. + time.Sleep(100 * time.Millisecond) + return nil } diff --git a/client/package.json b/client/package.json index fe2d708..a602330 100644 --- a/client/package.json +++ b/client/package.json @@ -6,6 +6,7 @@ "serve": "vue-cli-service serve", "build": "vue-cli-service build", "lint": "vue-cli-service lint", + "test": "yarn test:unit", "test:e2e": "vue-cli-service test:e2e", "test:unit": "vue-cli-service test:unit" },