forked from vmware-tanzu/tanzu-framework
-
Notifications
You must be signed in to change notification settings - Fork 0
91 lines (77 loc) · 3.09 KB
/
plugin_tests.yaml
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
89
90
91
name: Plugin Tests
on:
pull_request:
branches: [main, release-*]
paths:
- "cmd/cli/plugin/cluster/**"
- "cmd/cli/plugin/managementcluster/**"
- 'pkg/v1/tkg/**'
- 'pkg/v1/providers/**'
- '.github/workflows/plugin_tests.yaml'
concurrency:
group: ${{ format('plugin-tests-{0}', github.head_ref) }}
cancel-in-progress: true
jobs:
build:
name: Plugin Tests
runs-on: tkg
steps:
- name: Free disk space on runner
run: sudo rm -rf /usr/share/dotnet
- name: Set up Go 1.x
uses: actions/setup-go@v2
with:
go-version: "1.17"
id: go
- name: Check out code into the Go module directory
uses: actions/checkout@v1
- name: Get dependencies
run: |
go get -v -t -d ./...
if [ -f Gopkg.toml ]; then
curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
dep ensure
fi
- name: Extract PR Number
uses: Dovyski/payload-info-action@master
id: get_pr_num
with:
# when event is a pull request, obtaining the PR number is obvious
filter_pull_request: '.number'
# when event is a push (merge of PR), obtains original PR number from the merge commit message
filter_push: '.head_commit.message | capture("Merge pull request #(?<pr>[[:digit:]]+)").pr | tonumber'
- name: Find Comment
uses: peter-evans/find-comment@v1
id: findcomment
with:
issue-number: ${{ steps.get_pr_num.outputs.value }}
body-includes: //usebom
direction: last
- name: Extract Alternate BOM
shell: bash
run: |
export BOMCOMMENT=$(echo -e "${{ steps.findcomment.outputs.comment-body }}" | tr -d "[:space:]")
echo "##[set-output name=bompath;]$(echo "$BOMCOMMENT" | awk -F : '{print $2}')"
id: extract_bom
# Using `ENABLE_CONTEXT_AWARE_PLUGIN_DISCOVERY=false` to build and install cli and plugins because
# currently, context-aware-plugin-discovery does not support test plugins
# Issue: https://github.com/vmware-tanzu/tanzu-framework/issues/1164
# above issue need to be addressed and as part of the change we can use context-aware way of plugin
# tests as part of this test workflow.
- name: Build
run: |
if [[ ! -z "${{ steps.extract_bom.outputs.bompath }}" ]]; then
export TKG_DEFAULT_COMPATIBILITY_IMAGE_PATH=${{ steps.extract_bom.outputs.bompath }}
fi
env | sort
make configure-bom
make build-cli-local ENABLE_CONTEXT_AWARE_PLUGIN_DISCOVERY=false
- name: Install Tanzu CLI
run: |
make install-cli ENABLE_CONTEXT_AWARE_PLUGIN_DISCOVERY=false
- name: Install CLI plugins
run: make install-cli-plugins ENABLE_CONTEXT_AWARE_PLUGIN_DISCOVERY=false
- name: Cleanup
run: rm -rf ~/.tanzu ~/.tkg ~/.config; docker kill $(docker ps -q) | true; docker system prune -a --volumes -f
- name: Run cluster test plugin
run: tanzu test plugin cluster