Skip to content

chore(cicd): checkout main before finding diff #5

chore(cicd): checkout main before finding diff

chore(cicd): checkout main before finding diff #5

Workflow file for this run

name: Build benchmark images
on:
pull_request:
branches:
- main
jobs:
find-targets:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v4
- id: find-targets
run: |
git fetch origin ${{ github.base_ref }}:refs/remotes/origin/${{ github.base_ref }}
projects=$(git diff --name-only origin/${{ github.base_ref }} ${{ 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 }}