forked from vmware-tanzu/tanzu-framework
-
Notifications
You must be signed in to change notification settings - Fork 0
105 lines (90 loc) · 3.26 KB
/
Copy pathplugin_tests.yaml
File metadata and controls
105 lines (90 loc) · 3.26 KB
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
name: Plugin Tests
on:
pull_request:
branches: [main, release-* ]
paths:
- "cmd/cli/plugin/cluster/**"
- "cmd/cli/plugin/managementcluster/**"
- 'tkg/**'
- 'providers/**'
- '.github/workflows/plugin_tests.yaml'
- Makefile
- 'cli/**'
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 and clean up installed plugins on runner
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf /home/tanzu/.cache
sudo rm -rf /home/tanzu/.kube
sudo rm -rf /home/tanzu/.local/share/tanzu-cli/*
sudo sh -c 'find /tmp -type d -name "go-build*" -mtime +3 | xargs rm -rf'
mkdir -p /home/tanzu/.local/share/tanzu-cli/test
- name: Set up Go 1.x
uses: actions/setup-go@v3
with:
go-version: 1.18
id: go
- name: Check out code into the Go module directory
uses: actions/checkout@v1
- name: go cache
uses: actions/cache@v3
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Get dependencies
run: go mod download
- 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), since we require linear history,
# we are not even generating a merge commit that can help identify the
# PR number, so don't even try. Instead we just hard-code to a dummy
# value.
filter_push: 1009
- 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
- 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
- name: Cleanup
run: rm -rf ~/.tanzu ~/.tkg ~/.config ~/.cache/tanzu; docker kill $(docker ps -q) | true; docker system prune -a --volumes -f
- name: Install Tanzu CLI
run: |
make install-cli
tanzu config set features.global.context-aware-cli-for-plugins true
- name: Install CLI plugins
run: |
tanzu plugin install all --local artifacts/linux/amd64/cli/
tanzu plugin install all --local artifacts-admin/linux/amd64/cli/
- name: Run cluster test plugin
run: tanzu test plugin cluster