-
Notifications
You must be signed in to change notification settings - Fork 20
97 lines (83 loc) · 3.2 KB
/
benchmarking-image.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# 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@v4
with:
go-version: "1.20.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@v2
- name: Login to ghcr.io
uses: docker/login-action@v2
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@v4
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-