2019-11-15 20:20:52 +00:00
|
|
|
on: [push, pull_request, create]
|
2019-10-02 05:07:33 +00:00
|
|
|
|
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
|
2020-04-15 02:20:27 +00:00
|
|
|
uses: actions/setup-go@v2-beta
|
2019-10-01 15:58:22 +00:00
|
|
|
with:
|
|
|
|
go-version: ${{ matrix.go-version }}
|
|
|
|
- name: Checkout code
|
2020-04-15 02:20:27 +00:00
|
|
|
uses: actions/checkout@v2
|
2019-10-01 15:58:22 +00:00
|
|
|
- name: Test code
|
|
|
|
env:
|
|
|
|
GO111MODULE: on
|
|
|
|
run: |
|
|
|
|
go test ./pkg/...
|
|
|
|
go vet ./pkg/...
|
|
|
|
build:
|
|
|
|
runs-on: ubuntu-latest
|
2019-11-18 07:18:14 +00:00
|
|
|
if: github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/')
|
2019-10-01 15:58:22 +00:00
|
|
|
steps:
|
|
|
|
- name: Install Go 1.13.1
|
2020-04-15 02:20:27 +00:00
|
|
|
uses: actions/setup-go@v2-beta
|
2019-10-01 15:58:22 +00:00
|
|
|
with:
|
|
|
|
go-version: '1.13.1'
|
|
|
|
- name: Checkout code
|
2020-04-15 02:20:27 +00:00
|
|
|
uses: actions/checkout@v2
|
2019-10-01 15:58:22 +00:00
|
|
|
- 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 }}
|
2020-09-11 13:20:18 +00:00
|
|
|
- name: Deploy to heroku
|
|
|
|
uses: akhileshns/heroku-deploy@v3.4.6
|
|
|
|
with:
|
|
|
|
heroku_api_key: ${{secrets.HEROKU_API_KEY}}
|
|
|
|
heroku_app_name: ${{secrets.HEROKU_APP_NAME}}
|
|
|
|
heroku_email: ${{secrets.HEROKU_USER_EMAIL}}
|
2020-04-15 02:18:18 +00:00
|
|
|
- uses: azure/docker-login@v1
|
2019-10-01 15:58:22 +00:00
|
|
|
with:
|
|
|
|
username: ${{ secrets.DOCKER_USERNAME }}
|
|
|
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
|
|
- name: Build and push docker image
|
|
|
|
run: |
|
|
|
|
docker build -t tusproject/tusd:$GITHUB_SHA .
|
2020-09-11 18:47:45 +00:00
|
|
|
docker push tusproject/tusd:$GITHUB_SHA
|