-
Notifications
You must be signed in to change notification settings - Fork 1.6k
129 lines (108 loc) · 5.25 KB
/
performance-comparison.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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
name: performance comparison (on comment)
on:
issue_comment:
types: [created]
permissions:
contents: read
pull-requests: write
concurrency:
group: build-${{ github.event.pull_request.number || github.ref }}-${{github.workflow}}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
jobs:
build:
if: ${{ startsWith(github.event.comment.body, '/run-comparisonstats') }}
name: Performance comparison (on comment)
runs-on: ubuntu-latest
strategy:
matrix:
kustomize_version: [5.0.3]
ko_version: [0.4.0]
kompose_version: [1.21.0]
gcloud_sdk_version: [410.0.0]
container_structure_tests_version: [1.8.0]
steps:
- name: "Check if user has write access"
uses: "lannonbr/repo-permission-check-action@2bb8c89ba8bf115c4bfab344d6a6f442b24c9a1f"
with:
permission: "write"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Add reaction
uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043
with:
comment-id: ${{ github.event.comment.id }}
reactions: rocket
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.23.*
id: go
- name: Check out code into the Go module directory
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install Kustomize
run: |
wget -O kustomize.tar.gz https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize/v${{ matrix.kustomize_version }}/kustomize_v${{ matrix.kustomize_version }}_linux_amd64.tar.gz
sudo tar -xvf kustomize.tar.gz -C /usr/local/bin/
- name: Install Ko
run: |
wget -O ko.tar.gz https://github.com/google/ko/releases/download/v${{ matrix.ko_version }}/ko_${{ matrix.ko_version }}_Linux_x86_64.tar.gz
sudo tar -xvf ko.tar.gz -C /usr/local/bin/
- name: Install Kompose
run: |
wget -O kompose https://github.com/kubernetes/kompose/releases/download/v${{ matrix.kompose_version }}/kompose-linux-amd64 && chmod +x kompose
sudo mv kompose /usr/local/bin/
- name: Install GCloud
run: |
wget -O gcloud.tar.gz https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-sdk-${{ matrix.gcloud_sdk_version }}-linux-x86_64.tar.gz
tar -xvf gcloud.tar.gz -C ${HOME}/
${HOME}/google-cloud-sdk/install.sh --usage-reporting=false --bash-completion=false --disable-installation-options
echo "${HOME}/google-cloud-sdk/bin" >> $GITHUB_PATH
- name: Configure GCloud with Docker
run: gcloud auth configure-docker
- name: Install Container Structure Test
run: |
wget -O container-structure-test https://storage.googleapis.com/container-structure-test/v${{ matrix.container_structure_tests_version }}/container-structure-test-linux-amd64 && chmod +x container-structure-test
sudo mv container-structure-test /usr/local/bin/
- name: Setup other files and permissions
run: |
sudo chown $(whoami):docker ${HOME}/.docker -R
sudo chmod g+rw ${HOME}/.docker -R
echo '{}' > ${HOME}/.docker/config.json
mkdir -p ${HOME}/.m2/ && cp ./hack/maven/settings.xml ${HOME}/.m2/settings.xml
- name: Install Minikube from minikube master branch @HEAD and start cluster
run: |
curl -Lo minikube https://storage.googleapis.com/minikube-builds/master/minikube-linux-amd64
sudo install minikube /usr/local/bin/minikube
minikube start --profile=minikube --driver=docker
- uses: xt0rted/pull-request-comment-branch@e8b8daa837e8ea7331c0003c9c316a64c6d8b0b1
id: comment-branch
- name: Make and install Skaffold binary from current PR
run: |
make
sudo install "${HOME}/work/skaffold/skaffold/out/skaffold" /usr/local/bin/skaffold-${{ steps.comment-branch.outputs.head_ref }}
- name: Install Skaffold from main branch (built from CI/CD on merge)
run: |
curl -Lo skaffold-from-main-branch https://storage.googleapis.com/skaffold/builds/latest/skaffold-linux-amd64 && \
sudo install skaffold-from-main-branch /usr/local/bin/
- name: Parse Comment To Yaml Format
env:
COMMENT_BODY: ${{ github.event.comment.body }}
run: |
tail -n +2 <<< "$COMMENT_BODY" > yaml-input-file.yaml
- name: Run performance comparison benchmarks
id: run-performance-comparison-benchmarks
run: |
/usr/local/bin/skaffold-${{ steps.comment-branch.outputs.head_ref }} config set --global collect-metrics false
make COMPARISONSTATS_ARGS='--summary-output-path=gh-comment.txt --yaml-input-file=yaml-input-file.yaml --warmup-runs=1 /usr/local/bin/skaffold-from-main-branch /usr/local/bin/skaffold-${{ steps.comment-branch.outputs.head_ref }} helm-deployment main.go "//per-dev-iteration-comment"' comparisonstats
body=$(cat gh-comment.txt)
body="${body//'%'/'%25'}"
body="${body//$'\n'/'%0A'}"
body="${body//$'\r'/'%0D'}"
echo "body=$body" >> $GITHUB_OUTPUT
- name: Create comment
uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043
with:
issue-number: ${{ github.event.issue.number }}
body: "${{ steps.run-performance-comparison-benchmarks.outputs.body }}"