-
Notifications
You must be signed in to change notification settings - Fork 2
59 lines (47 loc) · 1.59 KB
/
check.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
name: Build benchmark images
on:
pull_request:
branches:
- main
jobs:
find-targets:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v3
- id: find-targets
run: |
projects=$(git diff --name-only origin/${{ github.base_ref }} origin/${{ github.head_ref }} | grep -e "^OCaml/" -e "^Java/" -e "^C/" -e "^Solidity/" | cut -d '/' -f 1-2 | sort | uniq | xargs -I{prj} echo \"{prj}\" | tr '\n' ',' | sed 's/,*$//')
echo "targets=[$projects]" >> ${GITHUB_OUTPUT}
outputs:
targets: ${{ steps.find-targets.outputs.targets }}
build-test:
runs-on: ubuntu-latest
permissions:
contents: read
needs:
- find-targets
if: always() && needs.find-targets.outputs.targets != '[]'
strategy:
matrix:
target: ${{ fromJSON(needs.find-targets.outputs.targets) }}
steps:
- uses: actions/checkout@v3
- name: Read metadata
id: read-metadata
run: |
content=$(cat ${{ matrix.target }}/metadata.json)
content="${content//$'\n'/''}"
echo "buildCommand=$(echo $content | jq -r .buildCommand)" >> ${GITHUB_OUTPUT}
- uses: docker/setup-buildx-action@v3
- uses: docker/build-push-action@v5
with:
context: ${{ matrix.target }}
file: ${{ matrix.target }}/Dockerfile
platforms: linux/amd64
push: false
tags: benchmark:latest
- name: Smoke test
run: |
docker run --rm benchmark:latest ${{ steps.read-metadata.outputs.buildCommand }}