mirror of
https://github.com/semaphoreui/semaphore.git
synced 2024-11-23 12:30:41 +01:00
change to task instead of bash script for building
This commit is contained in:
parent
5ac47b38fb
commit
647ec115a1
@ -13,10 +13,10 @@ When creating a pull-request you should:
|
||||
- Install MySQL / MariaDB
|
||||
- Install node.js
|
||||
|
||||
1) Set up GOPATH, GOBIN and Workspace
|
||||
|
||||
1) Set up GOPATH, GOBIN and Workspace.
|
||||
```
|
||||
cd {WORKING_DIRECTORY}
|
||||
# Exports only needed pre Go 1.8 or for custom GOPATH location
|
||||
export GOPATH=`pwd`
|
||||
export GOBIN=$GOPATH/bin
|
||||
export PATH=$PATH:$GOBIN
|
||||
@ -33,9 +33,9 @@ git clone --recursive git@github.com:ansible-semaphore/semaphore.git && cd semap
|
||||
3) Install dev dependencies
|
||||
|
||||
```
|
||||
go get ./... github.com/cespare/reflex github.com/gobuffalo/packr/... github.com/mitchellh/gox
|
||||
npm install async
|
||||
npm install -g nodemon pug-cli less
|
||||
go get ./...
|
||||
go get -u github.com/go-task/task/cmd/task
|
||||
task deps
|
||||
```
|
||||
|
||||
4) Set up config, database & run migrations
|
||||
@ -54,11 +54,11 @@ cat <<EOT >> config.json
|
||||
EOT
|
||||
|
||||
echo "create database semaphore;" | mysql -uroot -p
|
||||
go-bindata -debug -o util/bindata.go -pkg util config.json db/migrations/ $(find public/* -type d -print)
|
||||
task compile
|
||||
go run cli/main.go -config ./config.json -migrate
|
||||
```
|
||||
|
||||
Now it's ready to start.. Run `./make.sh watch`
|
||||
Now it's ready to start.. Run `task watch`
|
||||
|
||||
- Watches js files in `public/js/*` and compiles into a bundle
|
||||
- Watches css files in `public/css/*` and compiles into css code
|
||||
@ -66,4 +66,5 @@ Now it's ready to start.. Run `./make.sh watch`
|
||||
- Watches go files and recompiles the binary
|
||||
- Open [localhost:3000](http://localhost:3000)
|
||||
|
||||
Note: for Windows, you may need [Cygwin](https://www.cygwin.com/) to run certain commands. And because the [reflex](github.com/cespare/reflex) package probably doesn't work on Windows, you may encounter issues when running `./make.sh watch`, but running `./make.sh` will still be OK.
|
||||
Note: for Windows, you may need [Cygwin](https://www.cygwin.com/) to run certain commands because the [reflex](github.com/cespare/reflex) package probably doesn't work on Windows.
|
||||
You may encounter issues when running `task watch`, but running `task build` etc... will still be OK.
|
||||
|
41
Taskfile.yml
41
Taskfile.yml
@ -1,3 +1,17 @@
|
||||
# Semaphore Tasks
|
||||
# These tasks should be used to build and develop Semaphore
|
||||
#
|
||||
# Tasks without a `desc:` field are intended mainly to be called
|
||||
# internally by other tasks and therefore are not listed when running `task` or `task -l`
|
||||
|
||||
all:
|
||||
desc: Install, Compile, Test and Build Semaphore for local architecture
|
||||
cmds:
|
||||
- deps
|
||||
- compile
|
||||
- test
|
||||
- build:local
|
||||
|
||||
deps:
|
||||
desc: Install all dependencies
|
||||
cmds:
|
||||
@ -12,16 +26,16 @@ deps:be:
|
||||
- go get github.com/mitchellh/gox
|
||||
|
||||
deps:fe:
|
||||
dir: public
|
||||
desc: Installs npm requirements for front end from package.json
|
||||
dir: public
|
||||
cmds:
|
||||
- git submodule update --init --recursive
|
||||
- npm i -g less pug-cli
|
||||
- npm i async
|
||||
|
||||
deps:watch:
|
||||
desc: Installs tools needed for watch commands
|
||||
dir: public
|
||||
desc: installs tools needed for watch commands
|
||||
cmds:
|
||||
- npm install -g nodemon
|
||||
- go get github.com/cespare/reflex
|
||||
@ -35,6 +49,15 @@ compile:
|
||||
compile:fe:
|
||||
desc: Runs less, pug and node
|
||||
dir: public
|
||||
sources:
|
||||
- css/semaphore.less
|
||||
- html/*.pug
|
||||
- html/**/*.pug
|
||||
generates:
|
||||
- css/semaphore.css
|
||||
- html/*.html
|
||||
- html/**/*.html
|
||||
- js/bundle.json
|
||||
cmds:
|
||||
- lessc css/semaphore.less > css/semaphore.css
|
||||
- pug $(find ./html/ -name "*.pug")
|
||||
@ -52,8 +75,8 @@ compile:be:
|
||||
- packr
|
||||
|
||||
watch:
|
||||
dir: public
|
||||
desc: Watch fe and be file changes and rebuild
|
||||
dir: public
|
||||
deps: ['deps:watch']
|
||||
cmds:
|
||||
- task: watch:fe
|
||||
@ -61,8 +84,7 @@ watch:
|
||||
|
||||
watch:be:
|
||||
cmds:
|
||||
- |
|
||||
reflex -r '\.go$' -R '^public/vendor/' -R '^node_modules/' -s -d none -- sh -c 'go build -i -o /tmp/semaphore_bin cli/main.go && /tmp/semaphore_bin -config $(pwd)/config.json'
|
||||
- reflex -r '\.go$' -R '^public/vendor/' -R '^node_modules/' -s -d none -- sh -c 'go build -i -o /tmp/semaphore_bin cli/main.go && /tmp/semaphore_bin -config $(pwd)/config.json'
|
||||
|
||||
watch:fe:
|
||||
dir: public
|
||||
@ -72,27 +94,26 @@ watch:fe:
|
||||
- pug -w -P --doctype html $(find ./html/ -name "*.pug") &
|
||||
|
||||
build:
|
||||
desc: Build a full set of release binaries
|
||||
dir: cli
|
||||
cmds:
|
||||
- gox -output="../bin/semaphore_{{"{{"}}.OS{{"}}"}}_{{"{{"}}.Arch{{"}}"}}" ./...
|
||||
|
||||
build:local:
|
||||
desc: Build a binary for the current architecture
|
||||
dir: cli
|
||||
cmds:
|
||||
- go build -o ../bin/semaphore
|
||||
|
||||
test:
|
||||
desc: Run go code tests
|
||||
cmds:
|
||||
- go vet ./...
|
||||
- go test ./...
|
||||
|
||||
ci:artifacts:
|
||||
cmds:
|
||||
- |
|
||||
if [ "$CIRCLE_ARTIFACTS" != "" ]; then
|
||||
rsync -a bin/semaphore_* $CIRCLE_ARTIFACTS/
|
||||
exit 0
|
||||
fi
|
||||
- rsync -a bin/semaphore_* $CIRCLE_ARTIFACTS/
|
||||
|
||||
release:
|
||||
cmds:
|
||||
|
16
circle.yml
16
circle.yml
@ -1,22 +1,26 @@
|
||||
machine:
|
||||
environment:
|
||||
CPATH: "/home/ubuntu/.go_workspace/src/github.com/ansible-semaphore/semaphore/"
|
||||
CPATH: "${HOME}/.go_workspace/src/github.com/${CIRCLE_PROJECT_USERNAME}"
|
||||
node:
|
||||
version: 8.2.0
|
||||
|
||||
|
||||
dependencies:
|
||||
pre:
|
||||
- rm -rf ${CPATH} && mkdir -p ${CPATH}
|
||||
- ln -sfn ${HOME}/${CIRCLE_PROJECT_REPONAME} ${CPATH}
|
||||
- sudo rm -rf /usr/local/go
|
||||
- sudo curl -L https://storage.googleapis.com/golang/go1.10.linux-amd64.tar.gz > /tmp/go.tar.gz
|
||||
- sudo tar -C /usr/local -xzf /tmp/go.tar.gz
|
||||
- go get -u -v github.com/go-task/task/cmd/task
|
||||
- task deps
|
||||
override:
|
||||
- mkdir -p $CPATH
|
||||
- rsync -azC --delete ./ $CPATH
|
||||
- task compile
|
||||
- task compile
|
||||
|
||||
test:
|
||||
pre:
|
||||
- | cat > config.json <<EOF
|
||||
- |
|
||||
cat > config.json <<EOF
|
||||
{
|
||||
"mysql": {
|
||||
"host": "127.0.0.1:3306",
|
||||
@ -29,7 +33,7 @@ test:
|
||||
"email_alert": false
|
||||
}
|
||||
EOF
|
||||
- cd $CPATH && go run cli/main.go --migrate -config config.json
|
||||
- go run cli/main.go --migrate -config config.json
|
||||
override:
|
||||
- task test
|
||||
- task build
|
||||
|
Loading…
Reference in New Issue
Block a user