Skip to content

👻 workflow must use correct addon & CI tests branch as base (#563) #465

👻 workflow must use correct addon & CI tests branch as base (#563)

👻 workflow must use correct addon & CI tests branch as base (#563) #465

Workflow file for this run

name: Demo Testing
on: ["push", "pull_request"]
jobs:
test:
runs-on: ubuntu-latest
outputs:
api_tests_ref: ${{ steps.extract-info.outputs.API_TESTS_REF }}
steps:
- name: Extract pull request number from inputs or PR description
id: extract-info
run: |
echo "${{ github.event.pull_request.body }}"
PULL_REQUEST_NUMBER=$(echo "${{ github.event.pull_request.body }}" | grep -oP 'Addon PR: \K\d+' || true)
echo "API_TESTS_REF=main" >> $GITHUB_OUTPUT
if [ -z "$PULL_REQUEST_NUMBER" ]; then
if [ -z "${{ github.event.pull_request.base.ref }}" ]; then
echo "Using addon branch main"
echo "ADDON_REF=main" >>$GITHUB_ENV
else
echo "Using addon branch ${{ github.event.pull_request.base.ref }}"
echo "ADDON_REF=${{ github.event.pull_request.base.ref }}" >>$GITHUB_ENV
# when we know the base branch, we should use the identical branch of api tests
echo "API_TESTS_REF=${{ github.event.pull_request.base.ref }}" >> $GITHUB_OUTPUT
fi
else
echo "ADDON_REF=refs/pull/$PULL_REQUEST_NUMBER/merge" >>$GITHUB_ENV
fi
- uses: actions/checkout@v3
- name: build image
run: podman build -t quay.io/konveyor/analyzer-lsp:latest .
- name: build demo image
run: podman build -f demo.Dockerfile -t localhost/testing:latest
- name: install yq for testing
run: go install github.com/mikefarah/yq/v4@latest
- name: run demo image and ensure violations output unchanged
run: |
podman run --entrypoint /usr/local/bin/konveyor-analyzer -v $(pwd)/demo-dep-output.yaml:/analyzer-lsp/demo-dep-output.yaml:Z -v $(pwd)/demo-output.yaml:/analyzer-lsp/output.yaml:Z localhost/testing:latest --dep-output-file=demo-dep-output.yaml
diff \
<(yq -P 'sort_keys(..)' -o=props <(git show HEAD:demo-output.yaml)) \
<(yq -P 'sort_keys(..)' -o=props <(cat demo-output.yaml))
diff \
<(yq -P 'sort_keys(..)' -o=props <(git show HEAD:demo-dep-output.yaml)) \
<(yq -P 'sort_keys(..)' -o=props <(cat demo-dep-output.yaml))
- uses: actions/checkout@v3
with:
fetch-depth: 0
repository: konveyor/tackle2-addon-analyzer
ref: "${{ env.ADDON_REF}}"
path: tackle2-addon-analyzer
- name: Build addon and save image
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
uses: actions/upload-artifact@v3
with:
name: tackle2-addon-analyzer
path: /tmp/tackle2-addon-analyzer.tar
retention-days: 1
e2e:
needs: test
uses: konveyor/ci/.github/workflows/global-ci.yml@main
with:
component_name: tackle2-addon-analyzer
api_tests_ref: "${{ needs.test.outputs.api_tests_ref }}"