mirror of
https://github.com/k8snetworkplumbingwg/whereabouts.git
synced 2025-06-03 06:42:26 +00:00
Change CI pipeline from travis CI to github actions
This change replaces travis CI with github actions.
This commit is contained in:
parent
96ef85cfae
commit
0f0a9e5696
27
.github/workflow/build.yml
vendored
Normal file
27
.github/workflow/build.yml
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
on: [push, pull_request]
|
||||
name: Build
|
||||
jobs:
|
||||
build:
|
||||
strategy:
|
||||
matrix:
|
||||
go-version: [1.15.x, 1.16.x]
|
||||
goarch: [386, amd64, arm, ppc64le, arm64]
|
||||
os: [ubuntu-latest] #, macos-latest, windows-latest]
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Install Go
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: ${{ matrix.go-version }}
|
||||
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Generate code
|
||||
run: ./hack/generate-code.sh
|
||||
|
||||
- name: Build
|
||||
env:
|
||||
GOARCH: ${{ matrix.goarch }}
|
||||
GOOS: ${{ matrix.goos }}
|
||||
run: ./hack/build-go.sh
|
38
.github/workflow/image-build.yml
vendored
Normal file
38
.github/workflow/image-build.yml
vendored
Normal file
@ -0,0 +1,38 @@
|
||||
name: Image build
|
||||
on: [pull_request]
|
||||
jobs:
|
||||
build-amd64:
|
||||
name: Image build/amd64
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out code into the Go module directory
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v1
|
||||
|
||||
- name: Build container image
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
context: .
|
||||
push: false
|
||||
tags: dougbtv/whereabouts
|
||||
file: Dockerfile
|
||||
|
||||
build-openshift:
|
||||
name: Image build/amd64
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out code into the Go module directory
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v1
|
||||
|
||||
- name: Build container image
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
context: .
|
||||
push: false
|
||||
tags: dougbtv/whereabouts-ocp
|
||||
file: Dockerfile.openshift
|
61
.github/workflow/image-push-master.yml
vendored
Normal file
61
.github/workflow/image-push-master.yml
vendored
Normal file
@ -0,0 +1,61 @@
|
||||
name: Image push for master
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
env:
|
||||
image-push-owner: 'dougbtv'
|
||||
jobs:
|
||||
push-amd64:
|
||||
name: Image push/amd64
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out code into the Go module directory
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v1
|
||||
|
||||
- name: Login to GitHub Container Registry
|
||||
if: github.repository_owner == ${{ env.image-push-owner }}
|
||||
uses: docker/login-action@v1
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.repository_owner }}
|
||||
password: ${{ secrets.CR_PAT }}
|
||||
|
||||
- name: Push container image
|
||||
if: github.repository_owner == ${{ env.image-push-owner }}
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
context: .
|
||||
push: true
|
||||
tags: dougbtv/whereabouts:latest
|
||||
file: deployments/Dockerfile
|
||||
|
||||
push-origin:
|
||||
name: Image push/origin
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out code into the Go module directory
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v1
|
||||
|
||||
- name: Login to GitHub Container Registry
|
||||
if: github.repository_owner == ${{ env.image-push-owner }}
|
||||
uses: docker/login-action@v1
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.repository_owner }}
|
||||
password: ${{ secrets.CR_PAT }}
|
||||
|
||||
- name: Push container image
|
||||
if: github.repository_owner == ${{ env.image-push-owner }}
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
context: .
|
||||
push: true
|
||||
tags: dougbtv/whereabouts-ocp:latest
|
||||
file: deployments/Dockerfile.openshift
|
43
.github/workflow/image-push-release.yml
vendored
Normal file
43
.github/workflow/image-push-release.yml
vendored
Normal file
@ -0,0 +1,43 @@
|
||||
name: Image push release
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- v*
|
||||
env:
|
||||
image-push-owner: 'dougbtv'
|
||||
jobs:
|
||||
push-amd64:
|
||||
name: Image push/amd64
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out code into the Go module directory
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v1
|
||||
|
||||
- name: Login to GitHub Container Registry
|
||||
if: github.repository_owner == ${{ env.image-push-owner }}
|
||||
uses: docker/login-action@v1
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.repository_owner }}
|
||||
password: ${{ secrets.CR_PAT }}
|
||||
|
||||
- name: Docker meta
|
||||
id: docker_meta
|
||||
uses: crazy-max/ghaction-docker-meta@v1
|
||||
with:
|
||||
#images: ghcr.io/${{ github.repository }}
|
||||
images: dougbtv/whereabouts
|
||||
tag-latest: false
|
||||
|
||||
- name: Push container image
|
||||
if: github.repository_owner == ${{ env.image-push-owner }}
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
context: .
|
||||
push: true
|
||||
tags: |
|
||||
${{ steps.docker_meta.outputs.tags }}-amd64
|
||||
file: deployments/Dockerfile
|
60
.github/workflow/test.yml
vendored
Normal file
60
.github/workflow/test.yml
vendored
Normal file
@ -0,0 +1,60 @@
|
||||
on: [push, pull_request]
|
||||
name: Test
|
||||
jobs:
|
||||
test:
|
||||
strategy:
|
||||
matrix:
|
||||
go-version: [1.15.x, 1.16.x]
|
||||
os: [ubuntu-latest]
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Install Go
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: ${{ matrix.go-version }}
|
||||
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Run Revive Action by building from repository
|
||||
uses: morphy2k/revive-action@v1.4.1
|
||||
with:
|
||||
config: revive.toml
|
||||
exclude: "./vendor/..."
|
||||
name: "Revive"
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Install kubebuilder tools
|
||||
run: ./hack/install-kubebuilder-tools.sh
|
||||
|
||||
- name: Generate code
|
||||
run: ./hack/generate-code.sh
|
||||
|
||||
- name: Run go fmt
|
||||
run: go fmt ./...
|
||||
#run: diff -u <(echo -n) <(gofmt -d -s .)
|
||||
|
||||
- name: Run go vet
|
||||
run: go vet ./...
|
||||
|
||||
- name: Test
|
||||
run: sudo ./hack/test-go.sh
|
||||
|
||||
- name: Send coverage
|
||||
uses: shogo82148/actions-goveralls@v1
|
||||
with:
|
||||
path-to-profile: coverage.out
|
||||
flag-name: Go-${{ matrix.go }}
|
||||
parallel: true
|
||||
env:
|
||||
KUBEBUILDER_ASSETS: "$(pwd)/bin"
|
||||
|
||||
# notifies that all test jobs are finished.
|
||||
finish:
|
||||
needs: test
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: shogo82148/actions-goveralls@v1
|
||||
with:
|
||||
parallel-finished: true
|
57
.travis.yml
57
.travis.yml
@ -1,57 +0,0 @@
|
||||
language: go
|
||||
dist: trusty
|
||||
sudo: false
|
||||
|
||||
go:
|
||||
- 1.13.x
|
||||
|
||||
env:
|
||||
global:
|
||||
- secure: "dBdxB+wVWCoYTHQS9VCs4DmV9Di9QFwAjDJzzlAvqhd8tlnzYsQzLu88+9h80gf6hDMOvJtlmAPn5Pjs5lJ1HF5ethmoDpOkoR76AyGoCT6l85XKXOhix4wGHLMXieOdD5LBEL+lkNeRXDFLs43hGbXp0TPAHaGhGfqXq38FePL/c0Dd45UFmGAXKo1ygDRhNiFNl4S3lFLkKdqhohYxY6Qf7jdSkq3WHMdzX3By9i+3B2ExMFo50mIMM6z7h8jHSGEMVi8aTN0HRIB15NBIhkqI2PlHeSfsInAgGgDPvVFS+aDoSUnXVajzyUDcuwdV4cqNou1r+u+8oMxUiqehrWmf2lacawnmNm/TyPhPi9g8dLLWjLLhJpnY/v281jDO82psb4sV1rldNlFG6k2BT17szcpctgaSE+psVgKo/yexQsEBO+c+d8CxeuZ/FGbXuI0W9Rmdq67ys031PyNbQFTizBOzgHagVDYbzfL4ebAsqtUj/tFez9/lKVg2tGGXIeMBCM2bps1GTzuIRUFStsOh8cXw/xGYoNCANl+yXoZYwdwUvHlOfkMUxBiy/6TJWZSOhnRdJIzVIG/F01DmbM5JCnf6oXPSMAnVB2rnwrxBbWYmh12lvjkLnIP5cIrFTzsQW1FAFfchytptj4bKaULHqGsINdU+lI392fC4Pp0="
|
||||
|
||||
before_install:
|
||||
- go get github.com/mattn/goveralls
|
||||
|
||||
install:
|
||||
- go get -u golang.org/x/lint/golint
|
||||
- ./hack/install-kubebuilder-tools.sh
|
||||
|
||||
before_script:
|
||||
- docker login -u "$REGISTRY_USER" -p "$REGISTRY_PASS";
|
||||
- ./hack/generate-code.sh
|
||||
# - bash -c 'git diff pkg/ doc/ && git diff-index --quiet HEAD -- pkg/ doc/'
|
||||
- golint pkg/... cmd/...
|
||||
- go vet */*.go
|
||||
- test -z $(gofmt -l pkg/. cmd/.)
|
||||
|
||||
script:
|
||||
- ./hack/test-go.sh
|
||||
- ./hack/build-go.sh
|
||||
- KUBEBUILDER_ASSETS="$(pwd)/bin" $GOPATH/bin/goveralls -service=travis-ci
|
||||
- docker build -t dougbtv/whereabouts .
|
||||
- docker build -t dougbtv/whereabouts-ocp -f Dockerfile.openshift .
|
||||
- docker images
|
||||
|
||||
deploy:
|
||||
# Push images to Dockerhub on merge to master
|
||||
- provider: script
|
||||
on:
|
||||
branch: master
|
||||
script: >
|
||||
bash -c '
|
||||
docker login -u "$REGISTRY_USER" -p "$REGISTRY_PASS";
|
||||
docker push dougbtv/whereabouts:latest;
|
||||
docker push dougbtv/whereabouts-ocp:latest;
|
||||
echo done'
|
||||
- provider: script
|
||||
skip_cleanup: true
|
||||
script: >
|
||||
bash -c '
|
||||
docker tag dougbtv/whereabouts:latest dougbtv/whereabouts:$TRAVIS_TAG;
|
||||
docker login -u "$REGISTRY_USER" -p "$REGISTRY_PASS";
|
||||
docker push dougbtv/whereabouts:$TRAVIS_TAG;
|
||||
echo done'
|
||||
on:
|
||||
tags: true
|
||||
all_branches: true
|
||||
condition: "$TRAVIS_TAG =~ ^v[0-9].*$"
|
Loading…
Reference in New Issue
Block a user