-
Notifications
You must be signed in to change notification settings - Fork 45
88 lines (76 loc) · 3.21 KB
/
demo-testing.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
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
env:
PULL_REQUEST_BODY: ${{ github.event.pull_request.body }}
run: |
# 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
else
echo "Using ${GITHUB_REF_NAME}"
echo "API_TESTS_REF=${GITHUB_REF_NAME}" >> $GITHUB_OUTPUT
echo "ADDON_REF=${GITHUB_REF_NAME}" >>$GITHUB_ENV
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
- uses: actions/checkout@v3
# build all provider images and the analyzer-lsp image
- name: build images
run: |
make build-external
podman build -t quay.io/konveyor/analyzer-lsp:latest -f Dockerfile .
# run the demo in a podman pod
- name: run demo image
run : |
make run-external-providers-pod
podman build -f demo-local.Dockerfile -t localhost/testing:latest
make run-demo-image
- name: install yq for testing
run: go install github.com/mikefarah/yq/v4@latest
- name: ensure violation and dependency outputs are unchanged
run: |
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 }}"