Merge pull request #2018 from oasisprotocol/dependabot/npm_and_yarn/c… #848
This file contains 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
# NOTE: This name appears in GitHub's Checks API and in workflow's status badge. | |
name: docker | |
# Trigger the workflow when: | |
on: | |
# A push occurs to one of the matched branches. | |
push: | |
branches: | |
- main | |
# Cancel in-progress jobs on same branch. | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build-benchmarking-image: | |
# NOTE: This name appears in GitHub's Checks API. | |
name: build-benchmarking-images | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
# Check out pull request's HEAD commit instead of the merge commit. | |
ref: ${{ github.event.pull_request.head.sha }} | |
- name: Determine tag name | |
id: determine_tag | |
uses: ./.github/actions/determine-tag | |
- name: Determine oasis-core artifacts paths | |
id: determine-artifacts-paths | |
shell: bash | |
run: | | |
. tests/consts.sh | |
. tests/paths.sh | |
echo "oasis_core_node_binary_path=$(echo ${TEST_NODE_BINARY})" >> ${GITHUB_OUTPUT} | |
echo "oasis_core_runtime_loader_path=$(echo ${TEST_RUNTIME_LOADER})" >> ${GITHUB_OUTPUT} | |
env: | |
TESTS_DIR: tests | |
- name: Set up Rust | |
run: rustup show | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: "1.22.x" | |
- name: Install Oasis dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install bubblewrap build-essential libseccomp-dev libssl-dev protobuf-compiler | |
- name: Build benchmarks | |
working-directory: tests/benchmark | |
run: ./build-benchmarks.sh | |
# Build and push benchmarks docker image. | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to ghcr.io | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: "Rebuild ghcri.io/oasisprotocol/oasis-sdk-benchmark:${{ steps.determine_tag.outputs.tag }}" | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: tests/benchmark/Dockerfile | |
tags: ghcr.io/oasisprotocol/oasis-sdk-benchmark:${{ steps.determine_tag.outputs.tag }} | |
pull: true | |
push: true | |
build-args: | | |
OASIS_CORE_NODE_BINARY=${{ steps.determine-artifacts-paths.outputs.oasis_core_node_binary_path }} | |
OASIS_CORE_RUNTIME_LOADER=${{ steps.determine-artifacts-paths.outputs.oasis_core_runtime_loader_path }} | |
labels: | | |
org.opencontainers.image.source=${{ github.event.repository.html_url }} | |
org.opencontainers.image.created=${{ steps.determine_tag.outputs.created }} | |
org.opencontainers.image.revision=${{ github.sha }} | |
- name: Prune old ghcr.io/oasisprotocol/oasis-sdk-benchmark images | |
uses: vlaurin/[email protected] | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
organization: oasisprotocol | |
container: oasis-sdk-benchmark | |
keep-younger-than: 7 # days | |
keep-last: 2 | |
prune-untagged: true | |
prune-tags-regexes: ^pr- |