Add checks, snapshot and release workflows

This commit is contained in:
Marko Sabec
2021-07-08 07:38:18 +02:00
parent 1cb2e64d60
commit 70e5bc8bdd
7 changed files with 227 additions and 70 deletions
+28
View File
@@ -0,0 +1,28 @@
name: checks
on: [pull_request]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v1
with:
go-version: 1.16
- uses: actions/cache@v2
if: ${{ !env.ACT }}
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ runner.os }}-go-
- run: make test.coverprofile.all
env:
GOFLAGS: -mod=readonly
- uses: codecov/codecov-action@v1
with:
token: 628a7104-4ec8-46ef-a3a8-50b0c2507082
files: .cover.out
fail_ci_if_error: true
+100
View File
@@ -0,0 +1,100 @@
name: release
on:
push:
tags:
- '**'
jobs:
test:
runs-on: ubuntu-latest
env:
GOFLAGS: -mod=readonly
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v1
with:
go-version: 1.16
- uses: actions/cache@v2
if: ${{ !env.ACT }}
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ runner.os }}-go-
- run: make test.all
release-linux:
runs-on: ubuntu-latest
needs:
- test
env:
GOFLAGS: -mod=readonly
BUILD_OS: linux
BUILD_ARCH: amd64
RELEASE_SFTP_KEY: ${{ secrets.RELEASE_SFTP_KEY }}
RELEASE_SFTP_URI: ${{ secrets.RELEASE_SFTP_URI }}
steps:
- run: echo "BUILD_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
- uses: actions/checkout@v2
- uses: actions/setup-go@v1
with:
go-version: 1.16
- uses: actions/cache@v2
if: ${{ !env.ACT }}
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ runner.os }}-go-
- run: make release-clean release
- run: make upload
if: ${{ !env.ACT }}
release-darwin:
runs-on: macos-latest
needs:
- test
env:
GOFLAGS: -mod=readonly
BUILD_OS: darwin
BUILD_ARCH: amd64
BUILD_VERSION: ${{ format(github.ref, 'refs/tags/', '') }}
RELEASE_SFTP_KEY: ${{ secrets.RELEASE_SFTP_KEY }}
RELEASE_SFTP_URI: ${{ secrets.RELEASE_SFTP_URI }}
steps:
- run: echo "BUILD_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
- uses: actions/checkout@v2
- uses: actions/setup-go@v1
with:
go-version: 1.16
- uses: actions/cache@v2
if: ${{ !env.ACT }}
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ runner.os }}-go-
- run: make release-clean release
- run: make upload
if: ${{ !env.ACT }}
release-docker:
runs-on: ubuntu-latest
needs:
- test
env:
GOFLAGS: -mod=readonly
BUILD_OS: linux
BUILD_ARCH: amd64
steps:
- run: echo "BUILD_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
- uses: actions/checkout@v2
- uses: docker/login-action@v1
if: ${{ !env.ACT }}
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- run: docker build -t cortezaproject/corteza-server:${{ env.BUILD_VERSION }} .
if: ${{ !env.ACT }}
- run: docker push cortezaproject/corteza-server:${{ env.BUILD_VERSION }}
if: ${{ !env.ACT }}
+56
View File
@@ -0,0 +1,56 @@
name: snapshot
on:
push:
branches:
- 2021.3.x*
- 2021.6.x*
- 2021.9.x*
- 2021.12.x*
jobs:
test:
runs-on: ubuntu-latest
env:
GOFLAGS: -mod=readonly
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v1
with:
go-version: 1.16
- uses: actions/cache@v2
if: ${{ !env.ACT }}
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ runner.os }}-go-
- run: make test.all
snapshot-docker:
runs-on: ubuntu-latest
needs:
- test
env:
GOFLAGS: -mod=readonly
BUILD_OS: linux
BUILD_ARCH: amd64
BUILD_VERSION: ${GITHUB_SHA}
steps:
- uses: actions/checkout@v2
- uses: docker/login-action@v1
if: ${{ !env.ACT }}
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- uses: docker/login-action@v1
if: ${{ !env.ACT }}
with:
registry: ghcr.io
username: ${{ secrets.GH_USERNAME }}
password: ${{ secrets.GH_TOKEN }}
- run: docker build -t ghcr.io/cortezaproject/corteza-server:${{ env.BUILD_VERSION }} .
if: ${{ !env.ACT }}
- run: docker push ghcr.io/cortezaproject/corteza-server:${{ env.BUILD_VERSION }}
if: ${{ !env.ACT }}