Skip to content

refactor(ocaml): refactoring ocaml lambda #31

refactor(ocaml): refactoring ocaml lambda

refactor(ocaml): refactoring ocaml lambda #31

Workflow file for this run

name: Check on PR
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
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 "location=$(echo $content | jq -r .buggyPath)" >> ${GITHUB_OUTPUT}
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
outputs: type=docker,dest=./image.tar
- name: Smoke test
run: |
docker load --input ./image.tar
docker run --rm benchmark:latest /bin/bash -c "cd ${{ steps.read-metadata.outputs.location }}; ${{ steps.read-metadata.outputs.buildCommand }}"
check-all-test-pass-on-pr:
runs-on: ubuntu-latest
permissions:
pull-requests: write
needs:
- build-test
if: always()
steps:
- run: exit 1
if: ${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') }}
- uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: ':mega: All tests passed!'
})