-
Notifications
You must be signed in to change notification settings - Fork 6
CI: add GHA to build/publish Docker image #56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
sergejparity
wants to merge
3
commits into
master
Choose a base branch
from
sk-add-ci-for-docker-image
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,99 @@ | ||
| name: Build/publish Docker image | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - 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 | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
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:
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
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-ignoreforpushevents which will lead to release of new Docker image.Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
results/.csv results/.png
There was a problem hiding this comment.
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
resultsfolder?