Skip to content

Adds blockchain serialization and deserialization #171

Adds blockchain serialization and deserialization

Adds blockchain serialization and deserialization #171

name: Deliver to DockerHub
on:
push:
pull_request:
release:
types: [published]
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.11
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install cpplint
- name: Lint with cpplint
run: |
make lint
build:
needs: [lint]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- id: get_version
name: Get version
run: |
echo "THEBLOCKCHAINKILLER_BUILD_VERSION=$(python get_app_version.py)" >> $GITHUB_OUTPUT
- name: Check version
run: |
echo THEBLOCKCHAINKILLER_BUILD_VERSION
echo ${{ steps.get_version.outputs.THEBLOCKCHAINKILLER_BUILD_VERSION }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build image
uses: docker/build-push-action@v3
with:
tags: kostaleonard/theblockchainkiller:latest,kostaleonard/theblockchainkiller:${{ steps.get_version.outputs.THEBLOCKCHAINKILLER_BUILD_VERSION }}
outputs: type=docker,dest=/tmp/theblockchainkiller.tar
cache-from: type=gha
cache-to: type=gha
- name: Upload Docker image artifact
uses: actions/upload-artifact@v2
with:
name: theblockchainkiller-image
path: /tmp/theblockchainkiller.tar
outputs:
THEBLOCKCHAINKILLER_BUILD_VERSION: ${{ steps.get_version.outputs.THEBLOCKCHAINKILLER_BUILD_VERSION }}
test:
needs: [build]
runs-on: ubuntu-latest
steps:
- name: Download Docker image artifact
uses: actions/download-artifact@v2
with:
name: theblockchainkiller-image
path: .
- name: Load Docker image
run: |
docker load -i theblockchainkiller.tar
- name: Run tests
run: |
docker run -e THEBLOCKCHAINKILLER_TEST_PUBLIC_KEY=${{ secrets.THEBLOCKCHAINKILLER_TEST_PUBLIC_KEY }} -e THEBLOCKCHAINKILLER_TEST_PRIVATE_KEY=${{ secrets.THEBLOCKCHAINKILLER_TEST_PRIVATE_KEY }} --rm kostaleonard/theblockchainkiller:latest ./build/tests
valgrind:
needs: [build]
runs-on: ubuntu-latest
steps:
- name: Download Docker image artifact
uses: actions/download-artifact@v2
with:
name: theblockchainkiller-image
path: .
- name: Load Docker image
run: |
docker load -i theblockchainkiller.tar
- name: Run valgrind on tests
run: |
docker run -e THEBLOCKCHAINKILLER_TEST_PUBLIC_KEY=${{ secrets.THEBLOCKCHAINKILLER_TEST_PUBLIC_KEY }} -e THEBLOCKCHAINKILLER_TEST_PRIVATE_KEY=${{ secrets.THEBLOCKCHAINKILLER_TEST_PRIVATE_KEY }} --rm kostaleonard/theblockchainkiller:latest valgrind --leak-check=full --error-exitcode=1 ./build/tests
trivy-scan:
needs: [build]
runs-on: ubuntu-latest
steps:
- name: Download Docker image artifact
uses: actions/download-artifact@v2
with:
name: theblockchainkiller-image
path: .
- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@master
with:
input: '/github/workspace/theblockchainkiller.tar'
format: 'table'
exit-code: '0'
ignore-unfixed: true
vuln-type: 'os,library'
severity: 'CRITICAL,HIGH'
deliver:
needs: [lint, build, test, valgrind, trivy-scan]
runs-on: ubuntu-latest
if: github.event_name == 'release'
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
# These build steps use the cached images according to docker/build-push-action docs.
# We want to use the cached images so that we don't build twice.
- name: Build and push
uses: docker/build-push-action@v3
with:
push: true
tags: kostaleonard/theblockchainkiller:latest,kostaleonard/theblockchainkiller:${{ needs.build.outputs.THEBLOCKCHAINKILLER_BUILD_VERSION }}
cache-from: type=gha
cache-to: type=gha