Skip to content

Commit

Permalink
Merge branch 'master' into KU-1750/merge-logstructured-and-sqllog
Browse files Browse the repository at this point in the history
  • Loading branch information
louiseschmidtgen committed Nov 15, 2024
2 parents af18aeb + ed4b775 commit e4c34ed
Show file tree
Hide file tree
Showing 32 changed files with 1,714 additions and 472 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ on:
branches: [master]
pull_request:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
test:
name: Test
Expand Down
11 changes: 7 additions & 4 deletions .github/workflows/go.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ jobs:

benchmarks:
permissions:
contents: read # for actions/checkout to fetch code
pull-requests: write # for marocchino/sticky-pull-request-comment to create or update PR comment
contents: read # for actions/checkout to fetch code
pull-requests: write # for marocchino/sticky-pull-request-comment to create or update PR comment
name: Run Benchmarks
runs-on: ubuntu-latest

Expand All @@ -97,7 +97,7 @@ jobs:
- name: Install Dqlite
run: |
sudo add-apt-repository -y ppa:dqlite/dev
sudo apt install libdqlite-dev
sudo apt install libdqlite1.17-dev
- name: Run benchmarks
id: bench
Expand Down Expand Up @@ -152,11 +152,14 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
header: Benchmarks
message: |
### Benchmark Result
### Benchmark
<details><summary>Results </summary>
```
${{ steps.stats.outputs.diff }}
```
</details>
<details><summary>Current status</summary>
Expand Down
179 changes: 179 additions & 0 deletions .github/workflows/performance.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,179 @@
name: Performance Test K8s-snap

on:
push:
branches: ["master"]
pull_request:

permissions:
pull-requests: write
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
BASE_SHA: ${{ github.before || github.event.pull_request.base.sha }}
BASE_BRANCH: ${{ github.base_ref || github.ref }}
TARGET_SHA: ${{ github.sha }}

jobs:
build:
name: K8s-snap Performance Test
runs-on: ubuntu-20.04
steps:
- name: Harden Runner
uses: step-security/harden-runner@v2
with:
egress-policy: audit
- name: Checking out repo
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install tox
run: |
pip install tox
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: "1.22"
- name: Set-up R
run: |
sudo apt install r-base
sudo Rscript -e 'install.packages(c("ggplot2", "dplyr", "optparse"), repos="https://cloud.r-project.org")'
- name: Install lxd
run: |
sudo snap refresh lxd --channel 5.21/stable
sudo lxd init --auto
sudo usermod --append --groups lxd $USER
sg lxd -c 'lxc version'
- name: Ensure lxd network traffic flows by removing docker if installed
run: |
if command -v docker >/dev/null 2>&1; then
echo "Docker is installed, purging it"
sudo apt-get purge -y docker-engine docker docker.io docker-ce docker-ce-cli containerd runc
fi
- name: Download latest k8s-snap
run: |
sudo snap download k8s --channel=latest/edge --basename k8s
- name: Unpack Snap
run: |
sudo unsquashfs -d snap-unpack-dir k8s.snap
- name: Create snap with k8s-dqlite ${{ github.head_ref }} code
run: |
make static
sudo cp ./bin/static/k8s-dqlite snap-unpack-dir/bin/k8s-dqlite
sudo chmod o+r snap-unpack-dir/bin/k8s-dqlite
sudo mksquashfs snap-unpack-dir head.snap -noappend -comp lzo -no-fragments
- name: Create snap with k8s-dqlite base-code
run: |
set -o pipefail
git fetch origin $BASE_BRANCH
git reset --hard $BASE_SHA
make static
sudo cp ./bin/static/k8s-dqlite snap-unpack-dir/bin/k8s-dqlite
sudo chmod o+r snap-unpack-dir/bin/k8s-dqlite
sudo mksquashfs snap-unpack-dir base-code.snap -noappend -comp lzo -no-fragments
- name: Create snap with k8s-dqlite v1.1.11
run: |
set -o pipefail
git fetch origin --tags
git reset --hard v1.1.11
make static
sudo cp ./bin/static/k8s-dqlite snap-unpack-dir/bin/k8s-dqlite
sudo chmod o+r snap-unpack-dir/bin/k8s-dqlite
sudo mksquashfs snap-unpack-dir v1-1-11.snap -noappend -comp lzo -no-fragments
- name: Create snap with k8s-dqlite v1.2.0
run: |
set -o pipefail
git fetch origin --tags
git reset --hard v1.2.0
make static
sudo cp ./bin/static/k8s-dqlite snap-unpack-dir/bin/k8s-dqlite
sudo chmod o+r snap-unpack-dir/bin/k8s-dqlite
sudo mksquashfs snap-unpack-dir v1-2-0.snap -noappend -comp lzo -no-fragments
- name: Switch back to target branch
run: git reset --hard $TARGET_SHA
- name: Run Performance test ${{ github.head_ref }} snap
env:
TEST_SNAP: ${{ github.workspace }}/head.snap
TEST_SUBSTRATE: lxd
TEST_LXD_IMAGE: ubuntu:22.04
TEST_INSPECTION_REPORTS_DIR: ${{ github.workspace }}/inspection-reports
TEST_METRICS_DIR: ${{ github.workspace }}/test/performance/results/head
TEST_RUN_NAME: head
run: |
cd test/performance
mkdir -p ./results/head
sg lxd -c 'tox -e performance'
- name: Run Performance test for base code snap
env:
TEST_SNAP: ${{ github.workspace }}/base-code.snap
TEST_SUBSTRATE: lxd
TEST_LXD_IMAGE: ubuntu:22.04
TEST_INSPECTION_REPORTS_DIR: ${{ github.workspace }}/inspection-reports
TEST_METRICS_DIR: ${{ github.workspace }}/test/performance/results/base-code
TEST_RUN_NAME: base-code
run: |
cd test/performance
mkdir -p ./results/base-code
sg lxd -c 'tox -e performance'
- name: Run Performance test for v1.1.11 snap
env:
TEST_SNAP: ${{ github.workspace }}/v1-1-11.snap
TEST_SUBSTRATE: lxd
TEST_LXD_IMAGE: ubuntu:22.04
TEST_INSPECTION_REPORTS_DIR: ${{ github.workspace }}/inspection-reports
TEST_METRICS_DIR: ${{ github.workspace }}/test/performance/results/v1-1-11
TEST_RUN_NAME: v1-1-11
run: |
cd test/performance
mkdir -p ./results/v1-1-11
sg lxd -c 'tox -e performance'
- name: Run Performance test for v1.2.0 snap
env:
TEST_SNAP: ${{ github.workspace }}/v1-2-0.snap
TEST_SUBSTRATE: lxd
TEST_LXD_IMAGE: ubuntu:22.04
TEST_INSPECTION_REPORTS_DIR: ${{ github.workspace }}/inspection-reports
TEST_METRICS_DIR: ${{ github.workspace }}/test/performance/results/v1-2-0
TEST_RUN_NAME: v1-2-0
run: |
cd test/performance
mkdir -p ./results/v1-2-0
sg lxd -c 'tox -e performance'
- name: Generate 3 node Graphs
run: |
cd test/performance
sudo Rscript parse-performance-metrics.R -p ./results/head -o ./results/head -f *three-node.log
sudo Rscript parse-performance-metrics.R -p ./results/base-code -o ./results/base-code -f *three-node.log
sudo Rscript parse-performance-metrics.R -p ./results/v1-1-11 -o ./results/v1-1-11 -f *three-node.log
sudo Rscript parse-performance-metrics.R -p ./results/v1-2-0 -o ./results/v1-2-0 -f *three-node.log
- name: Generate single node Graphs
run: |
cd test/performance
mkdir -p ./results/single-node
cp ./results/head/*single-node.log ./results/single-node
cp ./results/base-code/*single-node.log ./results/single-node
cp ./results/v1-1-11/*single-node.log ./results/single-node
cp ./results/v1-2-0/*single-node.log ./results/single-node
sudo Rscript parse-performance-metrics.R -p ./results/single-node -o ./results/single-node -f *single-node.log
- name: Upload performance result
uses: actions/upload-artifact@v4
with:
name: performance-results
path: ${{ github.workspace }}/test/performance/results
- name: Prepare inspection reports
if: failure()
run: |
tar -czvf inspection-reports.tar.gz -C ${{ github.workspace }} inspection-reports
echo "artifact_name=inspection-reports-${{ matrix.os }}" | sed 's/:/-/g' >> $GITHUB_ENV
- name: Upload inspection report artifact
if: failure()
uses: actions/upload-artifact@v4
with:
name: ${{ env.artifact_name }}
path: ${{ github.workspace }}/inspection-reports.tar.gz
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ bin/
k8s-dqlite
hack/.build/
hack/.deps/
test/performance/results/*
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ bin/static/k8s-dqlite: $(DQLITE_BUILD_SCRIPTS_DIR)/.deps/static/lib/libdqlite.a

bin/static/dqlite: $(DQLITE_BUILD_SCRIPTS_DIR)/.deps/static/lib/libdqlite.a
mkdir -p bin/static
GOBIN=$(shell pwd)/bin/static $(DQLITE_BUILD_SCRIPTS_DIR)/static-go-install.sh github.com/canonical/go-dqlite/cmd/dqlite@v1.20.0
GOBIN=$(shell pwd)/bin/static $(DQLITE_BUILD_SCRIPTS_DIR)/static-go-install.sh github.com/canonical/go-dqlite/v2/cmd/dqlite@v2.0.0

## Dynamic Builds
dynamic: bin/dynamic/k8s-dqlite bin/dynamic/dqlite
Expand All @@ -44,7 +44,7 @@ bin/dynamic/k8s-dqlite: bin/dynamic/lib/libdqlite.so $(GO_SOURCES)

bin/dynamic/dqlite: bin/dynamic/lib/libdqlite.so
mkdir -p bin/dynamic
GOBIN=$(shell pwd)/bin/dynamic $(DQLITE_BUILD_SCRIPTS_DIR)/dynamic-go-install.sh github.com/canonical/go-dqlite/cmd/dqlite@v1.20.0
GOBIN=$(shell pwd)/bin/dynamic $(DQLITE_BUILD_SCRIPTS_DIR)/dynamic-go-install.sh github.com/canonical/go-dqlite/v2/cmd/dqlite@v2.0.0

## Cleanup
clean:
Expand Down
6 changes: 2 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,14 @@ module github.com/canonical/k8s-dqlite

go 1.22

toolchain go1.22.8

require (
github.com/canonical/go-dqlite v1.22.0
github.com/canonical/go-dqlite/v2 v2.0.0
github.com/mattn/go-sqlite3 v1.14.22
github.com/onsi/gomega v1.27.10
github.com/pkg/errors v0.9.1
github.com/prometheus/client_golang v1.19.0
github.com/sirupsen/logrus v1.9.3
github.com/spf13/cobra v1.8.0
github.com/spf13/cobra v1.8.1
go.etcd.io/etcd/api/v3 v3.5.12
go.etcd.io/etcd/client/pkg/v3 v3.5.12
go.etcd.io/etcd/client/v3 v3.5.12
Expand Down
Loading

0 comments on commit e4c34ed

Please sign in to comment.