From e852d8a6deb18d7b9284edf52003249c58521884 Mon Sep 17 00:00:00 2001 From: Seokhyun Lee <7948302+henrylee97@users.noreply.github.com> Date: Wed, 8 Nov 2023 16:58:40 +0900 Subject: [PATCH] chore(cicd): checkout main before finding diff (#17) * fix: checkout main * fix: fetch main before checking diff * fix: fetch origin and find diff from origin * fix: try build in buggy path --- .github/workflows/build.yml | 2 +- .github/workflows/check.yml | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a38a7bb03..a171cea5a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -16,7 +16,7 @@ jobs: contents: read steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 2 - id: find-targets diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 1ce8c6fdf..a5f85f625 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -13,9 +13,10 @@ jobs: contents: read steps: - - uses: actions/checkout@v3 + - 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} @@ -45,6 +46,7 @@ jobs: 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 @@ -56,4 +58,4 @@ jobs: tags: benchmark:latest - name: Smoke test run: | - docker run --rm benchmark:latest ${{ steps.read-metadata.outputs.buildCommand }} + docker run --rm benchmark:latest /bin/bash -c "cd ${{ steps.read-metadata.outputs.location }}; ${{ steps.read-metadata.outputs.buildCommand }}"