-
Notifications
You must be signed in to change notification settings - Fork 0
87 lines (75 loc) · 2.92 KB
/
ci.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
name: Goodnotes CI Task
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
build-and-test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup KinD Cluster
run: |
curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.14.0/kind-$(uname)-amd64
chmod +x ./kind
./kind create cluster --config ./config/cluster.yaml
- name: Disable IPv6
run: |
sudo sysctl -w net.ipv6.conf.all.disable_ipv6=1
sudo sysctl -w net.ipv6.conf.default.disable_ipv6=1
sudo sysctl -w net.ipv6.conf.lo.disable_ipv6=1
- name: Configuration, tools and dependencies
run: |
# sudo apt update && sudo apt upgrade -y
sudo apt install siege -y
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
chmod +x ./kubectl
sudo mv ./kubectl /usr/local/bin/kubectl
chmod +x ./scripts/*.sh
- name: Deploy Applications and Ingress
run: |
kubectl apply -f ./config/deployment-bar.yaml
kubectl apply -f ./config/deployment-foo.yaml
kubectl apply -f ./config/ingress.yaml
sleep 15
- name: Deploy Ingress Controller
run: kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/main/deploy/static/provider/kind/deploy.yaml
- name: Wait for Deployments
run: |
sleep 15
kubectl wait --for=condition=available --timeout=300s deployment/ingress-nginx-controller -n ingress-nginx
kubectl wait --for=condition=available --timeout=300s deployment/bar
kubectl wait --for=condition=available --timeout=300s deployment/foo
- name: Load Testing
run: |
bash ./scripts/load-test.sh
cat load-test-results.txt
# cat foo-load-test-results.txt
# cat bar-load-test-results.txt
- name: Post Results to PR
if: github.event_name == 'pull_request'
uses: actions/github-script@v6
with:
script: |
const output = fs.readFileSync('load-test-results.txt', 'utf8');
github.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `Load Test Results:\n${output}`
});
# - name: Post Results to PR
# if: github.event_name == 'pull_request'
# env:
# GH_TOKEN: ${{ secrets.GH_TOKEN }}
# run: |
# # Read load test results
# output=$(cat load-test-results.txt)
# # Use GitHub API to post the results as a comment
# curl -s -X POST -H "Authorization: token ${GH_TOKEN}" -H "Accept: application/vnd.github.v3+json" \
# "https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.number }}/comments" \
# -d "{\"body\": \"Load Test Results:\n\`\`\`\n${output}\n\`\`\`\"}"