Skip to content

Merge pull request #1590 from bstasyszyn/sidetree-core #2699

Merge pull request #1590 from bstasyszyn/sidetree-core

Merge pull request #1590 from bstasyszyn/sidetree-core #2699

Workflow file for this run

#
# Copyright SecureKey Technologies Inc. All Rights Reserved.
#
# SPDX-License-Identifier: Apache-2.0
#
name: Build
on:
push:
pull_request:
jobs:
unitTest:
name: Unit test
runs-on: ${{ matrix.os }}
timeout-minutes: 15
strategy:
matrix:
os: [ubuntu-latest]
steps:
- name: Setup Go 1.21
uses: actions/setup-go@v2
with:
go-version: 1.21
id: go
- uses: actions/checkout@v2
- name: Run unit test
timeout-minutes: 15
run: make unit-test
- name: Upload coverage to Codecov
timeout-minutes: 10
if: matrix.os == 'ubuntu-latest' && github.repository == 'trustbloc/orb'
uses: codecov/[email protected]
with:
file: ./coverage.out
bddTest-cas-local:
name: BDD test cas local
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- name: Setup Go 1.21
uses: actions/setup-go@v2
with:
go-version: 1.21
id: go
- uses: actions/checkout@v2
- name: Run bdd test cas local
timeout-minutes: 60
run: |
echo '127.0.0.1 orb.domain1.com' | sudo tee -a /etc/hosts
echo '127.0.0.1 orb.vct' | sudo tee -a /etc/hosts
wget https://fastdl.mongodb.org/tools/db/mongodb-database-tools-ubuntu2204-x86_64-100.6.1.deb
sudo apt install ./mongodb-database-tools-ubuntu2204-x86_64-100.6.1.deb
make bdd-test-cas-local
- uses: actions/upload-artifact@v2
if: always()
with:
name: logs-cas-local
path: test/bdd/docker-compose.log
bddTest-cas-ipfs:
name: BDD test cas ipfs
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- name: Setup Go 1.21
uses: actions/setup-go@v2
with:
go-version: 1.21
id: go
- uses: actions/checkout@v2
- name: Run bdd test cas ipfs
timeout-minutes: 60
run: |
echo '127.0.0.1 orb.domain1.com' | sudo tee -a /etc/hosts
echo '127.0.0.1 orb.vct' | sudo tee -a /etc/hosts
make bdd-test-cas-ipfs
- uses: actions/upload-artifact@v2
if: always()
with:
name: logs-cas-ipfs
path: test/bdd/docker-compose.log
bddTest-versions-maintenance:
name: BDD test protocol versions, maintenance mode
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- name: Setup Go 1.21
uses: actions/setup-go@v2
with:
go-version: 1.21
id: go
- uses: actions/checkout@v2
- name: Run bdd test protocol versions, maintenance mode
timeout-minutes: 60
run: |
echo '127.0.0.1 orb.domain1.com' | sudo tee -a /etc/hosts
echo '127.0.0.1 orb.vct' | sudo tee -a /etc/hosts
make bdd-test-versions-maintenance
- uses: actions/upload-artifact@v2
if: always()
with:
name: logs-versions-maintenance
path: test/bdd/docker-compose.log
checks:
name: Checks
timeout-minutes: 10
runs-on: ubuntu-latest
steps:
- name: Setup Go 1.21
uses: actions/setup-go@v2
with:
go-version: 1.21
- uses: actions/checkout@v2
- name: Run checks
timeout-minutes: 10
run: make checks
publish:
name: Publish image
if: github.event_name == 'push' && (github.repository == 'trustbloc/orb' && github.ref == 'refs/heads/main')
needs: [checks, unitTest]
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Setup Go 1.21
uses: actions/setup-go@v2
with:
go-version: 1.21
- uses: actions/checkout@v2
with: { fetch-depth: 0 }
- name: Get current published version
run: |
TAG=$(git describe --tags --always `git rev-list --tags --max-count=1`)
VERSION=$(git rev-parse --short=7 HEAD)
if [[ $TAG == $VERSION ]]; then
TAG=v0.0.0
fi
echo "CURRENT_SEMVER=${TAG:1}" >> $GITHUB_ENV
- name: Bump published version
id: bump_version
uses: christian-draeger/[email protected]
with:
current-version: "${{ env.CURRENT_SEMVER }}"
version-fragment: 'rc'
- name: Set ENV vars
run: |
VERSION=$(git rev-parse --short=7 HEAD)
echo "IMAGE_TAG"=v${{ steps.bump_version.outputs.next-version }}-snapshot-$VERSION >> $GITHUB_ENV
echo "ORB_IMAGE_PREFIX"=ghcr.io/trustbloc-cicd/orb >> $GITHUB_ENV
echo "ORB_DRIVER_IMAGE_PREFIX"=ghcr.io/trustbloc-cicd/orb-did-driver >> $GITHUB_ENV
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to Github Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ secrets.CR_USER }}
password: ${{ secrets.CR_PAT }}
- name: Build and Push container orb image
uses: docker/build-push-action@v2
with:
context: .
file: ./images/orb/Dockerfile
platforms: linux/amd64,linux/arm64
build-args: |
ALPINE_VER=3.18
GO_VER=1.21
GO_LDFLAGS=-X 'github.com/trustbloc/orb/pkg/nodeinfo.OrbVersion=${{ env.IMAGE_TAG }}' -X 'github.com/trustbloc/orb/pkg/httpserver.BuildVersion=${{ env.IMAGE_TAG }}'
push: true
tags: |
${{ env.ORB_IMAGE_PREFIX }}:${{ env.IMAGE_TAG }}
${{ env.ORB_IMAGE_PREFIX }}:latest
- name: Build and Push orb driver image
uses: docker/build-push-action@v2
with:
context: .
file: ./images/orb-driver/Dockerfile
platforms: linux/amd64,linux/arm64
build-args: |
ALPINE_VER=3.18
GO_VER=1.21
push: true
tags: |
${{ env.ORB_DRIVER_IMAGE_PREFIX }}:${{ env.IMAGE_TAG }}
${{ env.ORB_DRIVER_IMAGE_PREFIX }}:latest
- name: Build binaries
run: make build-orb-cli-binaries
- uses: actions/upload-artifact@v2
with:
name: orb-cli
path: |
./.build/dist/bin/orb-cli-darwin-amd64.tar.gz
./.build/dist/bin/orb-cli-linux-amd64.tar.gz
./.build/dist/bin/orb-cli-linux-arm64.tar.gz
./.build/dist/bin/orb-cli-darwin-arm64.tar.gz