Merge branch 'master' of github.com:tus/tusd

This commit is contained in:
Marius 2019-10-07 11:28:27 +02:00
commit 5414e88fbb
5 changed files with 61 additions and 109 deletions

61
.github/workflows/main.yml vendored Normal file
View File

@ -0,0 +1,61 @@
on: [push, pull_request]
name: Test
jobs:
test:
strategy:
matrix:
go-version: [1.12.x, 1.13.x]
platform: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.platform }}
steps:
- name: Install Matrix Go
uses: actions/setup-go@v1
with:
go-version: ${{ matrix.go-version }}
- name: Checkout code
uses: actions/checkout@v1
- name: Test code
env:
GO111MODULE: on
run: |
go test ./pkg/...
go vet ./pkg/...
build:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master'
steps:
- name: Install Go 1.13.1
uses: actions/setup-go@v1
with:
go-version: '1.13.1'
- name: Checkout code
uses: actions/checkout@v1
- name: Build TUSD
if: startsWith(github.ref, 'refs/tags/')
env:
GO111MODULE: on
run: ./scripts/build_all.sh
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: tusd_*.*
env:
GITHUB_TOKEN: ${{ secrets.GH_RELEASE_TOKEN }}
- uses: azure/container-actions/docker-login@master
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push docker image
run: |
docker build -t tusproject/tusd:$GITHUB_SHA .
docker push tusproject/tusd:$GITHUB_SHA
- name: Deploy to cluster
uses: steebchen/kubectl@master
env:
KUBE_CONFIG_DATA: |
${{ secrets.KUBECONFIG }}
with:
args: set image --record deployment/tusd tusd=tusproject/tusd:$GITHUB_SHA -n tus

View File

@ -1,44 +0,0 @@
language: go
go:
- 1.12
- 1.13
env:
- GO111MODULE=on
os:
- linux
- windows
sudo: required
addons:
apt:
packages:
- docker-ce
cache:
apt: true
directories:
- $HOME/.gimme
- "$HOME/google-cloud-sdk/"
install:
- true
script:
- ./scripts/test_all.sh
before_deploy:
- if [[ "$TRAVIS_TAG" != "" ]]; then ./scripts/build_all.sh; fi
deploy:
- provider: releases
api_key:
secure: dV3wr9ebEps3YrzIoqmkYc7fw0IECz7QLPRENPSxTJyd5TTYXGsnTS26cMe2LdGwYrXw0njt2GGovMyBZFTtxyYI3mMO4AZRwvZfx/yGzPWJBbVi6NjZVRg/bpyK+mQJ5BUlkPAYJmRpdc6qD+nvCGakBOxoByC5XDK+yM+bKFs=
file_glob: true
file: tusd_*.*
skip_cleanup: true
on:
tags: true
go: 1.13
repo: tus/tusd
condition: $TRAVIS_OS_NAME = linux
- provider: script
script: scripts/deploy_kube.sh
on:
branch: master
go: 1.13
repo: tus/tusd
condition: $TRAVIS_OS_NAME = linux

View File

@ -1,14 +0,0 @@
clone_folder: c:\projects\go\src\github.com\tus\tusd
environment:
GOPATH: c:\projects\go
GO111MODULE: on
build_script:
- set PATH=%GOPATH%\bin;%PATH%
- go env
- go version
test_script:
- go test ./pkg/...
- go vet ./pkg/...

View File

@ -1,45 +0,0 @@
#!/usr/bin/env bash
set -o pipefail
set -o errexit
set -o nounset
# set -o xtrace
# Set magic variables for current FILE & DIR
__dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
__root="$(cd "$(dirname "${__dir}")" && pwd)"
curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl
chmod +x ./kubectl
sudo mv ./kubectl /usr/local/bin/kubectl
#Store the new image in docker hub
docker build --quiet -t tusproject/tusd:latest -t tusproject/tusd:$TRAVIS_COMMIT ${__root};
docker login -u "$DOCKER_USERNAME" -p "$DOCKER_PASSWORD";
docker push tusproject/tusd:$TRAVIS_COMMIT;
docker push tusproject/tusd:latest;
echo "Create directory..."
mkdir ${HOME}/.kube
echo "Writing KUBECONFIG to file..."
echo $KUBECONFIGVAR | python -m base64 -d > ${HOME}/.kube/config
echo "KUBECONFIG file written"
sleep 10s # This cost me some precious debugging time.
kubectl apply -f "${__root}/infra/kube/tusd-kube.yaml"
kubectl set image deployment/tusd --namespace=tus tusd=docker.io/tusproject/tusd:$TRAVIS_COMMIT
kubectl get pods --namespace=tus
kubectl get service --namespace=tus
kubectl get deployment --namespace=tus
function cleanup {
printf "Cleaning up...\n"
rm -f ${HOME}/.kube/config
printf "Cleaning done."
}
trap cleanup EXIT

View File

@ -1,6 +0,0 @@
#!/usr/bin/env bash
set -e
go test ./pkg/...
go vet ./pkg/...