Skip to content

armgit / fider

Public Imported from GitHub
0

Open platform to collect and prioritize feedback

add travis.yml (#189)

Guilherme Oenning7748608bb9c9
diff --git a/.ci.env b/.ci.env
index ad0e4d588..0033a2737 100644
--- a/.ci.env
+++ b/.ci.env
@@ -1,6 +1,6 @@
GO_ENV=test
HOST_MODE=multi
-DATABASE_URL=postgres://fider_test:fider_test-pw@postgres:5432/fider_test?sslmode=disable
+DATABASE_URL=postgres://fider_ci:fider_ci_pw@localhost:5432/fider_ci?sslmode=disable
AUTH_ENDPOINT=http://login.test.fider.io:3000
JWT_SECRET=SOME_RANDOM_TOKEN_JUST_FOR_TESTING
diff --git a/.dockerignore b/.dockerignore
new file mode 100644
index 000000000..1337e9cc0
--- /dev/null
+++ b/.dockerignore
@@ -0,0 +1,8 @@
+node_modules/
+vendor/
+app/
+public/
+tests/
+data/
+output/
+gin-bin
\ No newline at end of file
diff --git a/.goreleaser.yml b/.goreleaser.yml
new file mode 100644
index 000000000..ef8548d8c
--- /dev/null
+++ b/.goreleaser.yml
@@ -0,0 +1,35 @@
+# NOT USED YET
+
+# TODO:
+# Add GITHUB_TOKEN to Travis
+# Add https://goreleaser.com/#continous_integration
+
+builds:
+ -
+ binary: fider
+ ldflags: -s -w -X main.version={{.Version}} -X main.buildtime={{.Date}}
+ env:
+ - CGO_ENABLED=0
+ goos:
+ - windows
+ - darwin
+ - linux
+ goarch:
+ - amd64
+
+archive:
+ format: tar.gz
+ format_overrides:
+ - goos: windows
+ format: zip
+ replacements:
+ darwin: macOS
+ files:
+ - LICENSE
+ - favicon.ico
+ - migrations/*
+ - views/*
+# - dist/* -> Rename output?
+
+release:
+ name_template: "{{.Version}}"
\ No newline at end of file
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 000000000..691ea3a7f
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,40 @@
+language: go
+
+sudo: false
+dist: trusty
+
+go: 1.9.x
+
+addons:
+ postgresql: "9.6"
+
+install:
+ - go get -u github.com/joho/godotenv/cmd/godotenv
+ - go get -u github.com/dave/courtney
+ - nvm install 8
+
+before_script:
+ - psql -c 'create database fider_ci;' -U postgres
+ - psql -c "CREATE USER fider_ci WITH PASSWORD 'fider_ci_pw';" -U postgres
+
+script:
+ - npm install
+ - npm run lint
+ - npm run build
+ - make coverage
+ - CGO_ENABLED=0 GOOS=linux GOARCH=amd64 make build
+ - docker build -t getfider/fider .
+ - docker login -u "$DOCKER_USERNAME" -p "$DOCKER_PASSWORD"
+ - |
+ if [ $TRAVIS_BRANCH == "master" ] && [ $TRAVIS_PULL_REQUEST == "false" ]; then
+ docker tag getfider/fider getfider/fider:master
+ docker push getfider/fider:master
+ fi
+ - |
+ if [ $TRAVIS_PULL_REQUEST != "false" ]; then
+ docker tag getfider/fider getfider/fider:PR_$TRAVIS_PULL_REQUEST
+ docker push getfider/fider:PR_$TRAVIS_PULL_REQUEST
+ fi
+
+after_success:
+ - bash <(curl -s https://codecov.io/bash)
\ No newline at end of file
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 000000000..2234280ee
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,15 @@
+FROM alpine:3.6
+RUN apk update && apk add ca-certificates
+
+RUN mkdir /app
+WORKDIR /app
+
+COPY favicon.ico /app
+COPY migrations /app/migrations
+COPY views /app/views
+COPY dist /app/dist
+COPY fider /app
+
+EXPOSE 8080
+
+CMD [ "./fider" ]
\ No newline at end of file
diff --git a/Makefile b/Makefile
index 2f12bd78f..17a4408a3 100644
--- a/Makefile
+++ b/Makefile
@@ -1,9 +1,9 @@
BUILD_TIME=$(shell date +"%Y.%m.%d.%H%M%S")
-ifeq ($(WERCKER), true)
-ENV_FILE=.ci.env
-else
ENV_FILE=.test.env
+
+ifeq ($(TRAVIS), true)
+ENV_FILE=.ci.env
endif
test:
diff --git a/wercker.yml b/wercker.yml
deleted file mode 100644
index 4e8f6549e..000000000
--- a/wercker.yml
+++ /dev/null
@@ -1,119 +0,0 @@
-services:
- - id: postgres
- tag: 9.6
- env:
- POSTGRES_USER: fider_test
- POSTGRES_PASSWORD: fider_test-pw
-
-build-assets:
- box: node:8.6
- steps:
- - npm-install
-
- # Lint
- - script:
- name: lint
- code: |
- npm run lint
-
- # Build
- - script:
- name: build
- code: |
- npm run build
-
-test:
- box: golang:1.9
- base-path: /go/src/github.com/getfider/fider
- steps:
- # Get dependencies
- - script:
- name: get dependencies
- code: |
- go get github.com/joho/godotenv/cmd/godotenv
-
- # Test the project
- - script:
- name: run test
- code: |
- make test
-
- # Build the project
- - script:
- name: run build
- code: |
- CGO_ENABLED=0 GOOS=linux GOARCH=amd64 make build
-
-coverage:
- box: golang:1.9
- base-path: /go/src/github.com/getfider/fider
- steps:
- # Get dependencies
- - script:
- name: get dependencies
- code: |
- go get github.com/joho/godotenv/cmd/godotenv
- go get -u github.com/dave/courtney
-
- # Publish to codecov.io
- - script:
- name: run coverage
- code: |
- make coverage
- bash <(curl -s https://codecov.io/bash) -t $CODECOV_TOKEN
-
-dockerize:
- box:
- id: alpine
- cmd: /bin/sh
- steps:
- - script:
- name: install apk packages
- code: |
- apk update && apk add ca-certificates
-
- # Prepare output
- - script:
- name: prepare output
- code: |
- mkdir /app
- cp fider /app
- cp favicon.ico /app
- cp -R migrations/ /app/migrations
- cp -R views/ /app/views
- cp -R dist/ /app/dist
- rm -rf /pipeline/cache/*
- rm -rf /pipeline/source/*
- rm -rf /pipeline/source/.git
- rm -rf /pipeline/output/*
- mv /app /pipeline/output
-
- - internal/docker-push:
- registry: https://registry.hub.docker.com/v2
- repository: getfider/fider
- username: $DOCKER_USER
- password: $DOCKER_PASS
- working-dir: /pipeline/output/app
- tag: latest
- ports: 8080
- cmd: ./fider
-
-deploy:
- box:
- id: alpine
- cmd: /bin/sh
- steps:
- - script:
- name: install packages
- code: |
- apk update && apk add openssh-client bash
- - add-to-known_hosts:
- hostname: fider.io
- fingerprint: SHA256:U27CmUMQry6uaq2anx445n88eZN7jgqy0K3Yei2Bou4
- type: rsa
- - add-ssh-key:
- keyname: CORE
- - script:
- name: restart
- code: |
- ssh [email protected] "/home/core/start-app.sh"
\ No newline at end of file