Add checks, snapshot and release workflows
This commit is contained in:
69
.drone.yml
69
.drone.yml
@@ -1,69 +0,0 @@
|
||||
kind: pipeline
|
||||
name: Build
|
||||
type: docker
|
||||
|
||||
steps:
|
||||
- name: "Quality Control"
|
||||
image: cortezaproject/corteza-server-builder:1.16
|
||||
pull: always
|
||||
commands:
|
||||
- make test.unit
|
||||
|
||||
- name: "Build release (tag)"
|
||||
image: cortezaproject/corteza-server-builder:1.16
|
||||
environment:
|
||||
RELEASE_SFTP_KEY: { from_secret: RELEASE_SFTP_KEY }
|
||||
RELEASE_SFTP_URI: { from_secret: RELEASE_SFTP_URI }
|
||||
commands:
|
||||
- make release-clean release BUILD_OS=linux BUILD_ARCH=amd64 BUILD_VERSION=${DRONE_TAG}
|
||||
# - make release-clean release BUILD_OS=darwin BUILD_ARCH=amd64 BUILD_VERSION=${DRONE_TAG}
|
||||
# - make release-clean release BUILD_OS=windows BUILD_ARCH=amd64 BUILD_VERSION=${DRONE_TAG}
|
||||
- make upload
|
||||
when:
|
||||
event: [ tag ]
|
||||
ref:
|
||||
- refs/tags/20??.3.*
|
||||
- refs/tags/20??.6.*
|
||||
- refs/tags/20??.9.*
|
||||
- refs/tags/20??.12.*
|
||||
|
||||
---
|
||||
|
||||
kind: pipeline
|
||||
name: Integration
|
||||
type: docker
|
||||
|
||||
steps:
|
||||
- name: test
|
||||
image: cortezaproject/corteza-server-builder:1.16
|
||||
pull: always
|
||||
environment:
|
||||
GOFLAGS: -mod=vendor
|
||||
CGO_ENABLED: "1"
|
||||
GOOS: linux
|
||||
GOARCH: amd64
|
||||
CI: circleci
|
||||
|
||||
# Corteza basics
|
||||
AUTH_OIDC_ENABLED: "0"
|
||||
AUTH_JWT_SECRET: FBjddkvwQib0d4usifnEGVr1bncuVeD7
|
||||
CORREDOR_CLIENT_CERTIFICATES_ENABLED: "false"
|
||||
CORREDOR_ENABLED: "false"
|
||||
|
||||
# Storage backends
|
||||
DB_DSN: sqlite3://file::memory:?cache=shared&mode=memory
|
||||
# for now, we only run Store tests with SQLite
|
||||
RDBMS_SQLITE_DSN: sqlite3://file::memory:?cache=shared&mode=memory
|
||||
commands:
|
||||
- make test.coverprofile.all
|
||||
|
||||
- name: coverage
|
||||
image: plugins/codecov
|
||||
settings:
|
||||
token: 628a7104-4ec8-46ef-a3a8-50b0c2507082
|
||||
files:
|
||||
- .cover.out
|
||||
|
||||
trigger:
|
||||
event:
|
||||
exclude: [ pull_request ]
|
||||
28
.github/workflows/checks.yml
vendored
Normal file
28
.github/workflows/checks.yml
vendored
Normal 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
.github/workflows/release.yml
vendored
Normal file
100
.github/workflows/release.yml
vendored
Normal 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
.github/workflows/snapshot.yml
vendored
Normal file
56
.github/workflows/snapshot.yml
vendored
Normal 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 }}
|
||||
2
.gitignore
vendored
2
.gitignore
vendored
@@ -13,3 +13,5 @@ profile.coverprofile
|
||||
/gin-bin
|
||||
/.vscode
|
||||
/federation/etc/.env*
|
||||
/.act*
|
||||
/workflow
|
||||
|
||||
40
Dockerfile
Normal file
40
Dockerfile
Normal file
@@ -0,0 +1,40 @@
|
||||
# build stage
|
||||
FROM golang:1.16-alpine as build-stage
|
||||
|
||||
ENV GOFLAGS='-mod=readonly'
|
||||
ENV BUILD_OS=linux
|
||||
ENV BUILD_ARCH=amd64
|
||||
ENV BUILD_VERSION=latest
|
||||
|
||||
RUN apk add build-base --no-cache
|
||||
|
||||
WORKDIR /corteza
|
||||
|
||||
COPY . ./
|
||||
|
||||
RUN make release-clean release
|
||||
|
||||
|
||||
# deploy stage
|
||||
FROM alpine:3
|
||||
|
||||
ENV STORAGE_PATH "/data"
|
||||
ENV CORREDOR_ADDR "corredor:80"
|
||||
ENV HTTP_ADDR "0.0.0.0:80"
|
||||
ENV HTTP_WEBAPP_ENABLED "false"
|
||||
ENV PATH "/corteza/bin:${PATH}"
|
||||
|
||||
WORKDIR /corteza
|
||||
|
||||
VOLUME /data
|
||||
|
||||
COPY --from=build-stage /corteza/build/pkg/corteza-server ./
|
||||
|
||||
HEALTHCHECK --interval=30s --start-period=1m --timeout=30s --retries=3 \
|
||||
CMD curl --silent --fail --fail-early http://127.0.0.1:80/healthcheck || exit 1
|
||||
|
||||
EXPOSE 80
|
||||
|
||||
ENTRYPOINT ["./bin/corteza-server"]
|
||||
|
||||
CMD ["serve-api"]
|
||||
2
Makefile
2
Makefile
@@ -95,7 +95,7 @@ release-clean:
|
||||
rm -rf $(BUILD_DEST_DIR)/$(RELEASE_NAME)
|
||||
|
||||
upload: $(RELEASE_PKEY)
|
||||
@ echo "put $(BUILD_DEST_DIR)/*.tar.gz" | sftp -q -i $(RELEASE_PKEY) $(RELEASE_SFTP_URI)
|
||||
@ echo "put $(BUILD_DEST_DIR)/*.tar.gz" | sftp -q -o "StrictHostKeyChecking no" -i $(RELEASE_PKEY) $(RELEASE_SFTP_URI)
|
||||
@ rm -f $(RELEASE_PKEY)
|
||||
|
||||
$(RELEASE_PKEY):
|
||||
|
||||
Reference in New Issue
Block a user