Skip to content
Open
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
99 changes: 99 additions & 0 deletions .github/workflows/build-publish-docker-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
name: Build/publish Docker image

on:
push:
branches:
Copy link
Contributor

@smiasojed smiasojed Jan 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that we should not upload docker image on push to master because we are going to upload to this branch stats from benchmark execution each day.
I see 2 options:

  1. push the benchmarks stats to a different branch, maybe gh-pages?
  2. before uploading docker we should check if anything has change apart of stats

Copy link
Author

@sergejparity sergejparity Jan 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@smiasojed But what will be the pattern (files or folders) of changes? Stats will be pushed to some folder?
So we can setup paths/paths-ignore for push events which will lead to release of new Docker image.

Copy link
Contributor

@smiasojed smiasojed Jan 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

results/.csv results/.png

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So we can just ignore whole results folder?

- master
paths-ignore:
- '**/.gitingore'
- 'CODEOWNERS'
- 'LICENSE'
- '**/*.md'
- 'results/**'
pull_request:
branches:
- master
paths-ignore:
- '.gitingore'
- 'CODEOWNERS'
- 'LICENSE'
- '**/*.md'
- 'results/**'

env:
IMAGE_NAME: "paritytech/smart-bench"

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
build-docker-image:
name: Test Docker image build
if: ${{ github.event_name == 'pull_request' }}
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Download binaries
run: |
cd launch
bash ./download-bins.sh

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build Docker image
uses: docker/build-push-action@v5
with:
push: false
context: .
file: ./launch/smart_bench.Dockerfile
build-args: |
VCS_REF="${{ github.sha }}"
BUILD_DATE="$(date -u '+%Y-%m-%dT%H:%M:%SZ')"
tags: |
${{ env.IMAGE_NAME }}:test

build-publish-docker-image:
name: Build and publish Docker image
if: ${{ github.ref == 'refs/heads/master' }}
runs-on: ubuntu-latest
environment: master

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Prepare Docker environment
run: |
echo IMAGE_TAG="master-${GITHUB_SHA::7}" >> $GITHUB_ENV
echo "Docker image will be published with the tag: ${{ env.IMAGE_TAG }}!"

- name: Download binaries
run: |
cd launch
bash ./download-bins.sh

- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
push: true
context: .
file: ./launch/smart_bench.Dockerfile
build-args: |
VCS_REF="${{ github.sha }}"
BUILD_DATE="$(date -u '+%Y-%m-%dT%H:%M:%SZ')"
tags: |
${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}
${{ env.IMAGE_NAME }}:latest