Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,18 +99,19 @@ jobs:
-v $TRAVIS_BUILD_DIR:/work -w /work
sqlflow:ci scripts/test/workflow.sh
- stage: Deploy
env: DESC="Deploy server Docker image"
script:
- $TRAVIS_BUILD_DIR/scripts/travis/deploy_server.sh
- env: DESC="Deploy macOS client"
env: DESC="Deploy macOS client"
os: osx
script:
- $TRAVIS_BUILD_DIR/scripts/travis/deploy_client.sh
- env: DESC="Deploy Linux client"
os: linux
dist: bionic
script:
- $TRAVIS_BUILD_DIR/scripts/travis/deploy_client.sh
- env: DESC="Deploy Windows client"
os: windows
script:
- $TRAVIS_BUILD_DIR/scripts/travis/deploy_client.sh
- env: DESC="Deploy server Docker image"
script:
- $TRAVIS_BUILD_DIR/scripts/travis/deploy_server.sh
9 changes: 7 additions & 2 deletions cmd/sqlflow/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ import (
"os"
"path/filepath"
"strings"
"syscall"

"github.com/joho/godotenv"
"golang.org/x/crypto/ssh/terminal"
Expand Down Expand Up @@ -349,7 +348,13 @@ func main() {
log.Fatalf("error SQLFLOW_DATASOURCE: %v", err)
}

isTerminal := !flagPassed("execute", "e", "file", "f") && terminal.IsTerminal(syscall.Stdin)
// You might want to use syscall.Stdin instead of 0; however,
// unfortunately, we cannot. the syscall standard package has
// a special implementation for Windows, where the type of
// syscall.Stdin is not int as in Linux and macOS, but
// uintptr.
isTerminal := !flagPassed("execute", "e", "file", "f") &&
terminal.IsTerminal(0)
sqlFile := os.Stdin

if flagPassed("file", "f") && *sqlFileName != "-" {
Expand Down
42 changes: 20 additions & 22 deletions scripts/travis/deploy_client.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ if [[ "$TRAVIS_PULL_REQUEST" != "false" ]]; then
exit 0
fi


# Figure out the tag to push sqlflow:ci.
if [[ "$TRAVIS_BRANCH" == "develop" ]]; then
if [[ "$TRAVIS_EVENT_TYPE" == "cron" ]]; then
Expand All @@ -38,18 +39,14 @@ else
fi


echo "Verify Go is installed ..."
go env


echo "Install axel ..."
echo "Install download tools ..."
case "$TRAVIS_OS_NAME" in
linux)
sudo apt-get -qq update > /dev/null
sudo apt-get -qq install -y axel > /dev/null
sudo apt-get -qq install -y axel unzip > /dev/null
;;
windows) choco install axel ;;
osx) brew install axel ;;
osx) brew install axel > /dev/null ;;
esac


Expand All @@ -58,11 +55,9 @@ case "$TRAVIS_OS_NAME" in
linux)
# The following code snippet comes from docker/dev/install.sh
echo "Install protoc ..."
PROTOC_SITE="https://github.com/protocolbuffers/protobuf/releases"
axel --quiet --output "p.zip" \
$PROTOC_SITE"/download/v3.7.1/protoc-3.7.1-linux-x86_64.zip"
sudo unzip -qq p.zip -d /usr/local
rm p.zip
PROTOC_SITE="https://github.com/protocolbuffers/protobuf/releases/"
axel --quiet $PROTOC_SITE"download/v3.7.1/protoc-3.7.1-linux-x86_64.zip"
sudo unzip -qq protoc-3.7.1-linux-x86_64.zip -d /usr/local
;;
windows) choco install protoc ;;
esac
Expand All @@ -72,14 +67,16 @@ protoc --version
echo "Install goyacc and protoc-gen-go ..."
go get \
github.com/golang/protobuf/protoc-gen-go@v1.3.3 \
golang.org/x/tools/cmd/goyacc
sudo cp $GOPATH/bin/* /usr/local/bin/
golang.org/x/tools/cmd/goyacc \
> /dev/null
export PATH=$GOPATH/bin:$PATH


echo "Build cmd/sqlflow into /tmp ..."
cd $TRAVIS_BUILD_DIR
go generate ./...
GOBIN=/tmp go install ./cmd/sqlflow
cd "$TRAVIS_BUILD_DIR"
go generate ./... > /dev/null
mkdir "$PWD"/build
GOBIN="$PWD"/build go install ./cmd/sqlflow > /dev/null


echo "Install Qiniu client for $TRAVIS_OS_NAME ..."
Expand All @@ -90,11 +87,12 @@ case "$TRAVIS_OS_NAME" in
esac
axel --quiet http://devtools.qiniu.com/$F.zip
unzip $F.zip
sudo mv $F /usr/local/bin/qshell
export PATH=$PWD:$PATH


echo "Publish /tmp/sqlflow to Qiniu Object Storage ..."
qshell account "$QINIU_AK" "$QINIU_SK" "wu"
qshell rput sqlflow-release \
$RELEASE_TAG/$TRAVIS_OS_NAME/sqlflow \
/tmp/sqlflow
$F account "$QINIU_AK" "$QINIU_SK" "wu"
$F rput --overwrite \
sqlflow-release \
"$RELEASE_TAG/$TRAVIS_OS_NAME/sqlflow" \
"$PWD"/build/sqlflow* # Need * because for Windows it is sqlflow.exe