Skip to content

[Snyk] Upgrade @dashevo/dapi-grpc from 0.21.0 to 0.25.22 #738

[Snyk] Upgrade @dashevo/dapi-grpc from 0.21.0 to 0.25.22

[Snyk] Upgrade @dashevo/dapi-grpc from 0.21.0 to 0.25.22 #738

name: Test and Release
on:
workflow_dispatch:
schedule:
- cron: '42 */160 * * *'
release:
types:
- published
pull_request:
branches:
- master
- v[0-9]+.[0-9]+-dev
jobs:
test:
name: Run DAPI tests
runs-on: ubuntu-20.04
timeout-minutes: 10
steps:
- name: Cancel previous runs
uses: styfle/cancel-workflow-action@0.9.0
with:
access_token: ${{ github.token }}
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '16'
- name: Enable NPM cache
uses: actions/cache@v2
with:
path: '~/.npm'
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Check NPM package lock version is updated
uses: dashevo/gh-action-check-package-lock@v1
- name: Install NPM dependencies
run: npm ci
- name: Run ESLinter
run: npm run lint
- name: Create dotenv file
run: cp .env.example .env
- name: Run tests
run: npm run test:coverage
test_suite:
name: Run Platform Test Suite
needs: test
runs-on: ubuntu-20.04
timeout-minutes: 60
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: '3.8.6'
- uses: actions/setup-node@v2
with:
node-version: '16'
- name: Set up Docker BuildX
id: buildx
uses: docker/setup-buildx-action@v1
with:
version: v0.6.1
install: true
driver-opts: image=moby/buildkit:buildx-stable-1
# Temporary fix until Docker Compose V2 is GA
- name: Set up Docker Compose V2
run: |
curl https://github.com/docker/compose-cli/releases/download/v2.0.0-beta.6/docker-compose-linux-amd64 --location --create-dirs -o $HOME/.docker/cli-plugins/docker-compose
chmod +x $HOME/.docker/cli-plugins/docker-compose
docker version
docker info
# - name: Set up QEMU
# uses: docker/setup-qemu-action@v1
- name: Enable NPM cache
uses: actions/cache@v2
with:
path: '~/.npm'
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Enable buildkit cache
uses: actions/cache@v2
with:
path: /tmp/buildkit-cache/buildkit-state.tar
key: ${{ runner.os }}-buildkit-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildkit-
- name: Load buildkit state from cache
uses: dashevo/gh-action-cache-buildkit-state@v1
with:
builder: buildx_buildkit_${{ steps.buildx.outputs.name }}0
cache-path: /tmp/buildkit-cache
cache-max-size: 2g
- name: Load workflow dotenv file
uses: c-py/action-dotenv-to-setenv@v3
with:
env-file: .github/workflows/.env
- name: Set compatible branches for Platform components
uses: dashevo/gh-action-platform-branches@v1
id: platform-branches
with:
override-dashmate-branch: ${{ env.DASHMATE_BRANCH }}
override-testsuite-branch: ${{ env.TEST_SUITE_BRANCH }}
- name: Start Dash local network
uses: dashevo/gh-action-start-local-network@v1
id: start-local-network
with:
drive-branch: ${{ env.DRIVE_BRANCH }}
dapi-branch: ${{ steps.platform-branches.outputs.current-branch }}
dashmate-branch: ${{ steps.platform-branches.outputs.dashmate-branch }}
sdk-branch: ${{ env.SDK_BRANCH }}
- name: Run Platform Test Suite
uses: dashevo/gh-action-run-platform-test-suite@v1
with:
sdk-branch: ${{ env.SDK_BRANCH }}
faucet-private-key: ${{ steps.start-local-network.outputs.faucet-private-key }}
dpns-contract-id: ${{ steps.start-local-network.outputs.dpns-contract-id }}
dpns-top-level-identity-id: ${{ steps.start-local-network.outputs.dpns-top-level-identity-id }}
dpns-top-level-identity-private-key: ${{ steps.start-local-network.outputs.dpns-top-level-identity-private-key }}
platform-test-suite-branch: ${{ steps.platform-branches.outputs.testsuite-branch }}
feature-flags-identity-id: ${{ steps.start-local-network.outputs.feature-flags-identity-id }}
feature-flags-contract-id: ${{ steps.start-local-network.outputs.feature-flags-contract-id }}
- name: Show Docker logs
if: ${{ failure() }}
uses: jwalton/gh-docker-logs@v1
release:
name: Release Docker Image
runs-on: ubuntu-20.04
needs: test_suite
if: ${{ github.event_name == 'release' }}
steps:
- uses: actions/checkout@v2
- name: Check package version matches tag
uses: geritol/match-tag-to-package-version@0.1.0
env:
TAG_PREFIX: refs/tags/v
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker BuildX
id: buildx
uses: docker/setup-buildx-action@v1
with:
version: v0.6.1
install: true
driver-opts: image=moby/buildkit:latest
- name: Enable buildkit cache
uses: actions/cache@v2
with:
path: /tmp/buildkit-cache/buildkit-state.tar
key: ${{ runner.os }}-buildkit-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildkit-
- name: Load buildkit state from cache
uses: dashevo/gh-action-cache-buildkit-state@v1
with:
builder: buildx_buildkit_${{ steps.buildx.outputs.name }}0
cache-path: /tmp/buildkit-cache
cache-max-size: 2g
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Set suffix to Docker tags
uses: actions/github-script@v3
id: suffix
with:
result-encoding: string
script: "return (context.payload.release.tag_name.includes('-dev') ? '-dev' : '');"
- name: Set Docker tags and labels
id: docker_meta
uses: docker/metadata-action@v3
with:
images: dashpay/dapi
tags: |
type=match,pattern=v(\d+),group=1
type=match,pattern=v(\d+.\d+),group=1
type=match,pattern=v(\d+.\d+.\d+),group=1
type=match,pattern=v(.*),group=1,suffix=,enable=${{ contains(github.event.release.tag_name, '-dev') }}
flavor: |
latest=${{ !contains(github.event.release.tag_name, '-dev') }}
suffix=${{ steps.suffix.outputs.result }}
- name: Build and push Docker image
id: docker_build
uses: docker/build-push-action@v2
with:
context: .
builder: ${{ steps.buildx.outputs.name }}
file: ./Dockerfile
push: true
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }}
platforms: linux/amd64,linux/arm64
- name: Show Docker image digest
run: echo ${{ steps.docker_build.outputs.digest }}