Deploy to bintray from Cirrus CI, and remove Travis config.

This commit is contained in:
Qi Xiao 2020-04-03 23:23:06 +01:00
parent dbb74950a6
commit cc9d03588c
5 changed files with 41 additions and 65 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

25
tools/cirrus-deploy.sh Executable file
View File

@ -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