Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
247 changes: 45 additions & 202 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,224 +1,67 @@
#
# Copyright SecureKey Technologies Inc. All Rights Reserved.
# Copyright Gen Digital Inc. All Rights Reserved.
#
# SPDX-License-Identifier: Apache-2.0
#

name: Build
name: "orb ci"

env:
GO_VERSION: 1.25

on:
push:
branches: [ main ]
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
branches: [ main ]

- 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
jobs:
SemanticPullRequest:
name: Semantic Pull Request Check
if: github.event_name == 'pull_request'
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
- uses: amannn/action-semantic-pull-request@v4
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

checks:
name: Checks
timeout-minutes: 30
runs-on: ubuntu-latest
Checks:
runs-on: ubuntu-22.04
timeout-minutes: 10
steps:
- name: Setup Go 1.21
uses: actions/setup-go@v2
- uses: actions/checkout@v3
- name: Setup Go 1.25
uses: actions/setup-go@v4
with:
go-version: 1.21

- uses: actions/checkout@v2

go-version: '1.25'
- name: Run checks
timeout-minutes: 30
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 }}
echo $PATH
go env
echo ${{ github.workspace }}
make checks
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

UnitTest:
runs-on: ubuntu-22.04
timeout-minutes: 10
steps:

- name: Build and Push container orb image
uses: docker/build-push-action@v2
- name: Setup Go 1.25
uses: actions/setup-go@v4
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
go-version: '1.25'
id: go

- 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
- uses: actions/checkout@v3

- name: Build binaries
run: make build-orb-cli-binaries
- name: Run unit test
timeout-minutes: 15
run: make unit-test

- uses: actions/upload-artifact@v2
- name: Upload coverage to Codecov
timeout-minutes: 10
uses: codecov/[email protected]
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
file: ./coverage.out
16 changes: 8 additions & 8 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Setup Go 1.21
uses: actions/setup-go@v2
- name: Setup Go 1.25
uses: actions/setup-go@v4
with:
go-version: 1.21
go-version: 1.25
id: go

- name: Set ENV vars
Expand Down Expand Up @@ -49,8 +49,8 @@ jobs:
file: ./images/orb/Dockerfile
platforms: linux/amd64,linux/arm64
build-args: |
ALPINE_VER=3.18
GO_VER=1.21
ALPINE_VER=3.22
GO_VER=1.25
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: |
Expand All @@ -64,8 +64,8 @@ jobs:
file: ./images/orb-driver/Dockerfile
platforms: linux/amd64,linux/arm64
build-args: |
ALPINE_VER=3.18
GO_VER=1.21
ALPINE_VER=3.22
GO_VER=1.25
push: true
tags: |
${{ env.ORB_DRIVER_IMAGE_PREFIX }}:${{ env.IMAGE_TAG }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/sonar.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
sonarcloud:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v5.0.0
with:
# Disabling shallow clone is recommended for improving relevancy of reporting
fetch-depth: 0
Expand Down
Loading
Loading