Skip to content

feat: refresh service #3297

feat: refresh service

feat: refresh service #3297

Workflow file for this run

#
# Copyright SecureKey Technologies Inc. All Rights Reserved.
#
# SPDX-License-Identifier: Apache-2.0
#
name: "build"
env:
GO_VERSION: '1.22'
on:
push:
pull_request:
jobs:
SemanticPullRequest:
name: Semantic Pull Request Check
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- uses: amannn/action-semantic-pull-request@v4
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Checks:
runs-on: ubuntu-20.04
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: '${{ env.GO_VERSION }}'
- name: Run checks
run: |
echo $PATH
go env
echo ${{ github.workspace }}
make checks
UnitTest:
runs-on: ubuntu-20.04
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: '${{ env.GO_VERSION }}'
- name: Run unit tests
run: make unit-test
- uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_UPLOAD_TOKEN }}
verbose: true
BDDTest:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: '${{ env.GO_VERSION }}'
- run: sudo apt-get update && sudo apt install docker-compose -y
- name: Run BDD tests
run: |
echo '127.0.0.1 file-server.trustbloc.local' | sudo tee -a /etc/hosts
echo '127.0.0.1 did-resolver.trustbloc.local' | sudo tee -a /etc/hosts
echo '127.0.0.1 oidc-provider.example.com' | sudo tee -a /etc/hosts
echo '127.0.0.1 vc-rest-echo.trustbloc.local' | sudo tee -a /etc/hosts
echo '127.0.0.1 api-gateway.trustbloc.local' | sudo tee -a /etc/hosts
echo '127.0.0.1 cognito-mock.trustbloc.local' | sudo tee -a /etc/hosts
echo '127.0.0.1 mock-login-consent.example.com' | sudo tee -a /etc/hosts
echo '127.0.0.1 cognito-auth.local' | sudo tee -a /etc/hosts
echo '127.0.0.1 mock-trustregistry.trustbloc.local' | sudo tee -a /etc/hosts
echo '127.0.0.1 mock-attestation.trustbloc.local' | sudo tee -a /etc/hosts
make bdd-test
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
publish:
name: Publish image
if: github.event_name == 'push' && (github.repository == 'trustbloc/vcs' && github.ref == 'refs/heads/main')
needs: [Checks, UnitTest, BDDTest]
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- name: Setup Go 1.22
uses: actions/setup-go@v2
with:
go-version: '1.22'
- uses: actions/checkout@v4
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: 'bug'
- 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 "VCS_IMAGE_PREFIX"=ghcr.io/trustbloc-cicd/vc-server >> $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 vcs image
uses: docker/build-push-action@v2
with:
context: .
file: ./images/vc-rest/Dockerfile
platforms: linux/amd64,linux/arm64
build-args: |
ALPINE_VER=3.18
GO_VER=1.22
push: true
tags: |
${{ env.VCS_IMAGE_PREFIX }}:${{ env.IMAGE_TAG }}
${{ env.VCS_IMAGE_PREFIX }}:latest
- name: Build binaries
run: make build-wallet-cli-binaries
- uses: actions/upload-artifact@v2
with:
name: wallet-cli
path: |
./.build/dist/bin/wallet-cli-darwin-amd64.tar.gz
./.build/dist/bin/wallet-cli-linux-amd64.tar.gz
./.build/dist/bin/wallet-cli-linux-arm64.tar.gz
./.build/dist/bin/wallet-cli-darwin-arm64.tar.gz