Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor build process for k8s-dqlite #90

Merged
merged 15 commits into from
Feb 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 0 additions & 49 deletions .github/workflows/build-snap.yml

This file was deleted.

33 changes: 33 additions & 0 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: End To End

on:
push:
branches: [master]
pull_request:

jobs:
test:
name: Test
runs-on: ubuntu-latest

steps:
- name: Checking out repo
uses: actions/checkout@v4
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: "1.21"
- name: Build k8s-dqlite
run: |
make static
- name: Running test
run: |
mkdir dir
./bin/static/k8s-dqlite --enable-tls=false --storage-dir=dir &

git clone https://github.com/etcd-io/etcd.git
cd etcd
git checkout release-3.5
cd tools/benchmark
go build .
./benchmark --endpoints http://127.0.0.1:12379 range asd
63 changes: 24 additions & 39 deletions .github/workflows/go.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Go

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

jobs:
Expand All @@ -12,12 +12,12 @@ jobs:

steps:
- name: Check out code
uses: actions/checkout@v4.1.0
uses: actions/checkout@v4

- name: Install Go
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: "1.20"
go-version: "1.21"

- name: go mod download
run: go mod download
Expand All @@ -27,17 +27,14 @@ jobs:

- name: check diff
run: |
if ! git diff; then
if ! [ -z "$(git diff)" ]; then
echo "Detected changes that have not been committed to the repository"
echo "Please run 'make go.fmt'"
echo "git diff:"
git diff
exit 1
fi

- name: install dqlite
run: |
sudo add-apt-repository ppa:dqlite/dev
sudo apt update
sudo apt install -y libdqlite-dev

- name: go vet
run: make go.vet

Expand All @@ -47,12 +44,12 @@ jobs:

steps:
- name: Check out Code
uses: actions/checkout@v4.1.0
uses: actions/checkout@v4

- name: Install Go
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: "1.20"
go-version: "1.21"

- name: go mod download
run: go mod download
Expand All @@ -66,22 +63,16 @@ jobs:

steps:
- name: Check out Code
uses: actions/checkout@v4.1.0
uses: actions/checkout@v4

- name: Install Go
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: "1.20"
go-version: "1.21"

- name: go mod download
run: go mod download

- name: install dqlite
run: |
sudo add-apt-repository ppa:dqlite/dev
sudo apt update
sudo apt install -y libdqlite-dev

- name: Run tests
run: make go.test.dqlite

Expand All @@ -91,12 +82,12 @@ jobs:

steps:
- name: Check out Code
uses: actions/checkout@v4.1.0
uses: actions/checkout@v4

- name: Install Go
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: "1.20"
go-version: "1.21"

- name: go mod download
run: go mod download
Expand All @@ -110,22 +101,16 @@ jobs:

steps:
- name: Check out Code
uses: actions/checkout@v4.1.0
uses: actions/checkout@v4

- name: Install Go
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: "1.20"
go-version: "1.21"

- name: go mod download
run: go mod download

- name: install dqlite
run: |
sudo add-apt-repository ppa:dqlite/dev
sudo apt update
sudo apt install -y libdqlite-dev

- name: Run benchmarks
run: make go.bench.dqlite

Expand All @@ -135,12 +120,12 @@ jobs:

steps:
- name: Check out code
uses: actions/checkout@v4.1.0
uses: actions/checkout@v4

- name: Install Go
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: "1.20"
go-version: "1.21"

- name: Build static binaries
run: |
Expand All @@ -153,7 +138,7 @@ jobs:
- name: Build shared binaries
run: |
make -j dynamic
export LD_LIBRARY_PATH=bin/dynamic/lib
export LD_LIBRARY_PATH=bin/dynamic

./bin/dynamic/k8s-dqlite --help
./bin/dynamic/k8s-dqlite migrator --help
Expand Down
37 changes: 37 additions & 0 deletions .github/workflows/trivy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Trivy

on:
pull_request:
schedule:
- cron: '0 10 * * *'

jobs:
scan:
runs-on: ubuntu-latest
strategy:
matrix:
branch: [master]

steps:
- name: Checking out repo
uses: actions/checkout@v4
with:
ref: ${{ matrix.branch }}
- name: Run Trivy vulnerability scanner in repo mode
uses: aquasecurity/trivy-action@master
with:
scan-type: "fs"
ignore-unfixed: true
format: "sarif"
output: "output.sarif"
severity: "MEDIUM,HIGH,CRITICAL"
- name: Get commit sha
run: |
SHA="$(git rev-parse HEAD)"
echo "head_sha=$SHA" >> "$GITHUB_ENV"
- name: Upload Trivy scan results to GitHub Security tab
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: "output.sarif"
sha: ${{ env.head_sha }}
ref: refs/heads/${{ matrix.branch }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,5 @@ deps/
build/
bin/
k8s-dqlite
hack/.build/
hack/.deps/
1 change: 1 addition & 0 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @canonical/kubernetes
Loading
Loading