👻 workflow must use correct addon branch #461
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Demo Testing | ||
on: ["push", "pull_request"] | ||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Extract pull request number from inputs or PR description | ||
run: | | ||
echo "${{ github.event.pull_request.body }}" | ||
PULL_REQUEST_NUMBER=$(echo "${{ github.event.pull_request.body }}" | grep -oP 'Addon PR: \K\d+' || true) | ||
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 | ||
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 | ||
# env.ADDON_REF should work as release branches are identical everywhere | ||
api_tests_ref: "${{ env.ADDON_REF }}" | ||
Check failure on line 72 in .github/workflows/demo-testing.yml GitHub Actions / Demo TestingInvalid workflow file
|