59
.github/workflows/build.yml
vendored
Normal file
59
.github/workflows/build.yml
vendored
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
name: Go
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- 'master'
|
||||||
|
- 'dev'
|
||||||
|
tags:
|
||||||
|
- 'release-*'
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- 'master'
|
||||||
|
- 'dev'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
name: Build
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
env:
|
||||||
|
GO111MODULE: on
|
||||||
|
steps:
|
||||||
|
|
||||||
|
- name: Set up Go 1.13
|
||||||
|
uses: actions/setup-go@v1
|
||||||
|
with:
|
||||||
|
go-version: 1.13
|
||||||
|
id: go
|
||||||
|
|
||||||
|
- name: Check out code into the Go module directory
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Check pr is properly formatted
|
||||||
|
run: diff -u <(echo -n) <(gofmt -d ./pkg ./cmd ./tools ./test)
|
||||||
|
|
||||||
|
- name: Downloading go dependencies
|
||||||
|
run: go mod vendor
|
||||||
|
|
||||||
|
- name: Install kubebuilder
|
||||||
|
run: bash hack/install_kubebuilder.sh
|
||||||
|
|
||||||
|
- name: Build
|
||||||
|
run: make all
|
||||||
|
|
||||||
|
- name: Uploading code coverage
|
||||||
|
env:
|
||||||
|
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
||||||
|
run: bash <(curl -s https://codecov.io/bash)
|
||||||
|
|
||||||
|
- name: Get branch name
|
||||||
|
id: extract_branch
|
||||||
|
shell: bash
|
||||||
|
run: echo "##[set-output name=branch;]$(ehco ${GITHUB_REF#refs/heads/})"
|
||||||
|
|
||||||
|
- name: Build and push docker images
|
||||||
|
env:
|
||||||
|
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
|
||||||
|
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
|
||||||
|
if: github.event_name == 'push'
|
||||||
|
run: bash hack/docker_build.sh ${{ steps.extract_branch.outputs.branch }}
|
||||||
39
.travis.yml
39
.travis.yml
@@ -1,39 +0,0 @@
|
|||||||
services:
|
|
||||||
- docker
|
|
||||||
|
|
||||||
language: go
|
|
||||||
|
|
||||||
dist: xenial
|
|
||||||
|
|
||||||
git:
|
|
||||||
depth: false
|
|
||||||
|
|
||||||
go:
|
|
||||||
- "1.13.x"
|
|
||||||
env:
|
|
||||||
- GO111MODULE=on
|
|
||||||
cache:
|
|
||||||
directories:
|
|
||||||
- $HOME/gopath/pkg/mod
|
|
||||||
|
|
||||||
before_script:
|
|
||||||
- docker --version
|
|
||||||
- bash hack/install_kubebuilder.sh
|
|
||||||
|
|
||||||
script:
|
|
||||||
- diff -u <(echo -n) <(gofmt -d ./pkg ./cmd ./tools)
|
|
||||||
- make openapi
|
|
||||||
- make all
|
|
||||||
|
|
||||||
before_install:
|
|
||||||
- go mod vendor
|
|
||||||
|
|
||||||
after_success:
|
|
||||||
- bash <(curl -s https://codecov.io/bash)
|
|
||||||
|
|
||||||
deploy:
|
|
||||||
skip_cleanup: true
|
|
||||||
provider: script
|
|
||||||
script: bash hack/docker_build.sh
|
|
||||||
on:
|
|
||||||
branch: master
|
|
||||||
@@ -3,16 +3,10 @@
|
|||||||
set -ex
|
set -ex
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
|
|
||||||
|
# Default image repo
|
||||||
REPO=kubespheredev
|
REPO=kubespheredev
|
||||||
TAG=latest
|
# Set tag to latest if no argument was given, normally was branch name
|
||||||
|
TAG=${1:-latest}
|
||||||
# check if build was triggered by a travis cronjob
|
|
||||||
if [[ -z "$TRAVIS_EVENT_TYPE" ]]; then
|
|
||||||
echo "TRAVIS_EVENT_TYPE is empty, also normaly build"
|
|
||||||
elif [[ $TRAVIS_EVENT_TYPE == "cron" ]]; then
|
|
||||||
TAG=dev-$(date +%Y%m%d)
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
docker build -f build/ks-apigateway/Dockerfile -t $REPO/ks-apigateway:$TAG .
|
docker build -f build/ks-apigateway/Dockerfile -t $REPO/ks-apigateway:$TAG .
|
||||||
docker build -f build/ks-apiserver/Dockerfile -t $REPO/ks-apiserver:$TAG .
|
docker build -f build/ks-apiserver/Dockerfile -t $REPO/ks-apiserver:$TAG .
|
||||||
|
|||||||
Reference in New Issue
Block a user