Skip to content

Commit

Permalink
add workflow step to test with bundle
Browse files Browse the repository at this point in the history
Signed-off-by: Pranav Gaikwad <[email protected]>
  • Loading branch information
pranavgaikwad committed May 16, 2024
1 parent 4731456 commit 546e31e
Showing 1 changed file with 34 additions and 5 deletions.
39 changes: 34 additions & 5 deletions .github/workflows/demo-testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,51 @@ jobs:
env:
PULL_REQUEST_BODY: ${{ github.event.pull_request.body }}
run: |
echo "BUILD_ADDON=false" >> $GITHUB_OUTPUT
echo "BUILD_BUNDLE=false" >> $GITHUB_OUTPUT
# if this is a PR, we should use the base branch
# else, use the branch on which this is running
if [ ! -z ${GITHUB_BASE_REF} ]; then
echo "Using ${GITHUB_BASE_REF}"
echo "API_TESTS_REF=${GITHUB_BASE_REF}" >> $GITHUB_OUTPUT
echo "ADDON_REF=${GITHUB_BASE_REF}" >>$GITHUB_ENV
echo "JAVA_BUNDLE_REF=${GITHUB_BASE_REF}" >>$GITHUB_OUTPUT
else
echo "Using ${GITHUB_REF_NAME}"
echo "API_TESTS_REF=${GITHUB_REF_NAME}" >> $GITHUB_OUTPUT
echo "ADDON_REF=${GITHUB_REF_NAME}" >>$GITHUB_ENV
echo "JAVA_BUNDLE_REF=${GITHUB_REF_NAME}" >>$GITHUB_OUTPUT
fi
# override with explicitely set value in PR description
echo "${PULL_REQUEST_BODY}"
PULL_REQUEST_NUMBER=$(echo "${PULL_REQUEST_BODY}" | grep -oP '[A|a]ddon [P|p][R|r]: \K\d+' || true)
if [ ! -z "$PULL_REQUEST_NUMBER" ]; then
echo "Using pull/${PULL_REQUEST_NUMBER} for addon"
echo "ADDON_REF=refs/pull/$PULL_REQUEST_NUMBER/merge" >>$GITHUB_ENV
fi
ADDON_PULL_REQUEST_NUMBER=$(echo "${PULL_REQUEST_BODY}" | grep -oP '[A|a]ddon [P|p][R|r]: \K\d+' || true)
if [ ! -z "$ADDON_PULL_REQUEST_NUMBER" ]; then
echo "Using pull/${ADDON_PULL_REQUEST_NUMBER} for addon"
echo "ADDON_REF=refs/pull/$ADDON_PULL_REQUEST_NUMBER/merge" >>$GITHUB_ENV
echo "BUILD_ADDON=true" >>$GITHUB_OUTPUT
fi
JAVA_BUNDLE_PR_NUMBER=$(echo "${PULL_REQUEST_BODY}" | grep -oP '[B|b]undle [P|p][R|r]: \K\d+' || true)
if [ ! -z "$JAVA_BUNDLE_PR_NUMBER" ]; then
echo "Using bundle PR pull/${JAVA_BUNDLE_PR_NUMBER}"
echo "JAVA_BUNDLE_REF=refs/pull/$JAVA_BUNDLE_PR_NUMBER/merge" >> $GITHUB_OUTPUT
echo "BUILD_BUNDLE=true" >>$GITHUB_OUTPUT
fi
- name: actions/checkout@v3
if: ${{ output.BUILD_BUNDLE }}
with:
fetch-depth: 0
repository: konveyor/java-analyzer-bundle
ref: "${{ env.JAVA_BUNDLE_REF }}"
path: java-analyzer-bundle

- name: build java analyzer bundle image
if: ${{ output.BUILD_BUNDLE }}
working-directory: java-analyzer-bundle
run: |
podman build -t quay.io/konveyor/jdtls-server-base:latest -f Dockerfile .
- uses: actions/checkout@v3

Expand Down Expand Up @@ -61,19 +87,22 @@ jobs:
<(yq -P 'sort_keys(..)' -o=props <(cat demo-dep-output.yaml))
- uses: actions/checkout@v3
if: ${{ output.BUILD_ADDON }}
with:
fetch-depth: 0
repository: konveyor/tackle2-addon-analyzer
ref: "${{ env.ADDON_REF}}"
path: tackle2-addon-analyzer

- name: Build addon and save image
if: ${{ output.BUILD_ADDON }}
working-directory: tackle2-addon-analyzer
run: |
IMG=quay.io/konveyor/tackle2-addon-analyzer:latest make image-podman
podman save -o /tmp/tackle2-addon-analyzer.tar quay.io/konveyor/tackle2-addon-analyzer:latest
- name: Upload image as artifact
if: ${{ output.BUILD_ADDON }}
uses: actions/upload-artifact@v3
with:
name: tackle2-addon-analyzer
Expand Down

0 comments on commit 546e31e

Please sign in to comment.