2019-10-02 05:07:33 +00:00
|
|
|
on: [push, pull_request]
|
|
|
|
|
2019-10-01 15:58:22 +00:00
|
|
|
name: Test
|
2019-10-02 05:18:58 +00:00
|
|
|
|
2019-10-01 15:58:22 +00:00
|
|
|
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
|
2019-10-02 05:01:42 +00:00
|
|
|
if: startsWith(github.ref, 'refs/tags/')
|
2019-10-01 15:58:22 +00:00
|
|
|
env:
|
|
|
|
GO111MODULE: on
|
|
|
|
run: ./scripts/build_all.sh
|
2019-10-02 05:01:42 +00:00
|
|
|
- name: Release
|
|
|
|
uses: softprops/action-gh-release@v1
|
|
|
|
if: startsWith(github.ref, 'refs/tags/')
|
|
|
|
with:
|
|
|
|
files: tusd_*.*
|
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GH_RELEASE_TOKEN }}
|
2019-10-01 15:58:22 +00:00
|
|
|
- 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
|