From cc9d03588c6c1dd028983e1a623c2db125db17eb Mon Sep 17 00:00:00 2001 From: Qi Xiao Date: Fri, 3 Apr 2020 23:23:06 +0100 Subject: [PATCH] Deploy to bintray from Cirrus CI, and remove Travis config. --- .cirrus.yml | 18 +++++++++++++++--- .travis.yml | 19 ------------------- Makefile | 19 +------------------ tools/binaries-travis.sh | 25 ------------------------- tools/cirrus-deploy.sh | 25 +++++++++++++++++++++++++ 5 files changed, 41 insertions(+), 65 deletions(-) delete mode 100644 .travis.yml delete mode 100755 tools/binaries-travis.sh create mode 100755 tools/cirrus-deploy.sh diff --git a/.cirrus.yml b/.cirrus.yml index 57732d89..649fdc6c 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -1,7 +1,7 @@ -env: - ELVISH_TEST_TIME_SCALE: 10 - CODECOV_TOKEN: ENCRYPTED[832ae776d0809c879cb08b78d8ac3cc89cbff90688beafc329661fb42d06d3bc5feef31da156d78fb442e3491468ef6d] test_task: + env: + ELVISH_TEST_TIME_SCALE: 10 + CODECOV_TOKEN: ENCRYPTED[832ae776d0809c879cb08b78d8ac3cc89cbff90688beafc329661fb42d06d3bc5feef31da156d78fb442e3491468ef6d] go_modules_cache: fingerprint_script: cat go.sum folder: $GOPATH/pkg/mod @@ -29,3 +29,15 @@ test_task: upload_coverage_script: - go test -coverprofile=coverage -covermode=set ./... - curl -s https://codecov.io/bash -o codecov && bash codecov -f coverage -t $CODECOV_TOKEN + +deploy_task: + name: Build binaries and deploy to bintray + env: + BINTRAY_TOKEN: ENCRYPTED[dad59874551bbb71e478101191cc13943d9aff033082bdf76e24812aaf49238780907a031e25e0271fa5fd9b71b8c808] + go_modules_cache: + fingerprint_script: cat go.sum + folder: $GOPATH/pkg/mod + container: + image: golang:latest + go_version_script: go version + deploy_script: ./tools/cirrus-deploy.sh diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index b0b6d635..00000000 --- a/.travis.yml +++ /dev/null @@ -1,19 +0,0 @@ -language: go -os: - - linux - - osx -sudo: false -go: - - 1.14.x - - 1.13.x -env: - global: - - CGO_ENABLED=0 - - ELVISH_TEST_TIME_SCALE=10 -jobs: - include: - - stage: deploy - name: Build and upload binaries to bintray - script: make binaries-travis - if: type = push -script: make test diff --git a/Makefile b/Makefile index cbc49d93..d1c01662 100644 --- a/Makefile +++ b/Makefile @@ -10,8 +10,6 @@ ifneq ($(OS),Windows_NT) TEST_FLAGS := -race endif -GOVERALLS := github.com/mattn/goveralls - default: test get get: @@ -19,9 +17,6 @@ get: "-X github.com/elves/elvish/pkg/buildinfo.Version=$(VERSION) \ -X github.com/elves/elvish/pkg/buildinfo.Reproducible=true" . -buildall: - ./tools/buildall.sh - generate: go generate ./... @@ -40,16 +35,4 @@ cover/all: $(PKG_COVERS) echo mode: $(COVER_MODE) > $@ for f in $(PKG_COVERS); do test -f $$f && sed 1d $$f >> $@ || true; done -upload-coverage-codecov: cover/all - curl -s https://codecov.io/bash -o codecov.bash && \ - bash codecov.bash -f $< || \ - true - -upload-coverage-coveralls: cover/all - go get $(GOVERALLS) - goveralls -coverprofile $< - -binaries-travis: - ./tools/binaries-travis.sh - -.PHONY: default get buildall generate test style upload-coverage-codecov upload-coverage-coveralls binaries-travis +.PHONY: default get generate test style diff --git a/tools/binaries-travis.sh b/tools/binaries-travis.sh deleted file mode 100755 index fd8ccc67..00000000 --- a/tools/binaries-travis.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/sh -e - -# Should be invoked from repo root. Required environment variables: -# $TRAVIS_BRANCH $BINTRAY_CREDENTIAL - -# Manipulate the GOROOT so that it does not contain the Go version number -ln -s `go env GOROOT` $TRAVIS_HOME/goroot -export GOROOT=$TRAVIS_HOME/goroot - -if [ "$TRAVIS_BRANCH" = master ]; then - export VERSION=HEAD -else - export VERSION=$TRAVIS_BRANCH -fi -MANIFEST=_bin/manifest ./tools/buildall.sh - -echo "Deleting old HEAD" -curl -X DELETE -u$BINTRAY_CREDENTIAL \ - https://api.bintray.com/packages/elves/elvish/elvish/versions/$VERSION - -cat _bin/manifest | while read f; do - echo "Deploying $f" - curl -T _bin/$f -u$BINTRAY_CREDENTIAL \ - https://api.bintray.com/content/elves/elvish/elvish/$VERSION/$f'?publish=1&override=1' -done diff --git a/tools/cirrus-deploy.sh b/tools/cirrus-deploy.sh new file mode 100755 index 00000000..e65c0a12 --- /dev/null +++ b/tools/cirrus-deploy.sh @@ -0,0 +1,25 @@ +#!/bin/sh -e + +# Should be invoked from repo root. +# +# Environment variables used by this script: +# $CIRRUS_BRANCH $CIRRUS_TAG $BINTRAY_TOKEN + +if [ "$CIRRUS_BRANCH" = master ]; then + export VERSION=HEAD +elif [ "$CIRRUS_TAG " ]; then + export VERSION=$CIRRUS_TAG +else + export VERSION=$CIRRUS_BRANCH +fi +MANIFEST=_bin/manifest ./tools/buildall.sh + +echo "Deleting old HEAD" +curl -X DELETE -u$BINTRAY_TOKEN \ + https://api.bintray.com/packages/elves/elvish/elvish/versions/$VERSION + +cat _bin/manifest | while read f; do + echo "Deploying $f" + curl -T _bin/$f -u$BINTRAY_TOKEN \ + https://api.bintray.com/content/elves/elvish/elvish/$VERSION/$f'?publish=1&override=1' +done