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

Ci enhancements #204

Open
wants to merge 12 commits into
base: develop
Choose a base branch
from
80 changes: 28 additions & 52 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
push:
branches:
- 'develop'
- 'v*'
- 'release/**'
paths-ignore:
- '**.md'
- 'changelogs/**'
Expand All @@ -23,14 +23,28 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4

- uses: cachix/install-nix-action@v22
- uses: rrbutani/[email protected]
with:
file: shell.nix

- name: Check if the chart follows a valid semver version
run: |
BRANCH=${{ github.ref_name }}
./scripts/validate-chart-version.sh --branch $BRANCH

- name: Run chart-testing lint
run: |
ct lint --config ct.yaml

unit-test:
# to ignore builds on release
if: ${{ (github.event.ref_type != 'tag') }}
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.19
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: 1.19.13

Expand All @@ -44,14 +58,19 @@ jobs:
run: make verify-src

- name: Upload Coverage Report
uses: codecov/codecov-action@v1
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.txt
name: coverage-$(date +%s)
flags: unittests

provisioner-localpv:
runs-on: ubuntu-latest
needs: ['lint', 'unit-test']
steps:
- name: Set up Go 1.19
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: 1.19.13

Expand Down Expand Up @@ -149,29 +168,15 @@ jobs:
kubernetes: [v1.27.2]
steps:
- name: Set up Go 1.19
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: 1.19.13

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
with:
version: v0.5.1

- name: Checkout
uses: actions/checkout@v4

- name: Build Image
uses: docker/build-push-action@v4
with:
context: .
file: ./buildscripts/provisioner-localpv/provisioner-localpv.Dockerfile
push: false
load: true
platforms: linux/amd64
tags: |
openebs/provisioner-localpv:ci
- name: Build images locally
run: make provisioner-localpv-image || exit 1;

- name: Setup Minikube-Kubernetes
uses: medyagh/setup-minikube@latest
Expand All @@ -185,40 +190,11 @@ jobs:

- name: Set up infra for integration test
run: |
OPENEBS_NAMESPACE="openebs"
sudo apt-get update && sudo apt-get install -y xfsprogs quota linux-modules-extra-`uname -r`
go install -mod=mod github.com/onsi/ginkgo/v2/[email protected]
sed -e '/openebs-provisioner-hostpath/{N;s/IfNotPresent/Never/}' deploy/kubectl/openebs-operator-lite.yaml | kubectl apply -f -
helm install localpv-provisioner ./deploy/helm/charts -n $OPENEBS_NAMESPACE --create-namespace --set localpv.image.pullPolicy=Never --set analytics.enabled=false

- name: Integration test
run: |
make integration-test

localpv-e2e:
# to ignore builds on release AND build only if the branch is develop
if: ${{ (github.event.ref_type != 'tag') && (github.ref == 'refs/heads/develop') }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set Image Org
# sets the default IMAGE_ORG to openebs
run: |
[ -z "${{ secrets.IMAGE_ORG }}" ] && IMAGE_ORG=openebs || IMAGE_ORG=${{ secrets.IMAGE_ORG}}
echo "IMAGE_ORG=${IMAGE_ORG}" >> $GITHUB_ENV
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push the localpv-e2e image
uses: docker/build-push-action@v4
with:
file: ./e2e-tests/Dockerfile
push: true
load: false
platforms: linux/amd64
tags: |
${{ env.IMAGE_ORG }}/localpv-e2e:ci

91 changes: 52 additions & 39 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ on:
branches:
# on pull requests to develop and release branches
- 'develop'
- 'v*'
- 'release/**'
paths-ignore:
- '**.md'
- 'changelogs/**'
- 'deploy/helm/**'
#- 'deploy/helm/**'
- 'docs/**'
- 'design/**'
- 'LICENSE'
Expand All @@ -21,12 +21,49 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Shellcheck
uses: reviewdog/action-shellcheck@v1
with:
github_token: ${{ secrets.github_token }}
reporter: github-pr-review
path: "."
pattern: "*.sh"

- uses: cachix/install-nix-action@v22
- uses: rrbutani/[email protected]
with:
file: shell.nix

- name: Set up Go 1.19
uses: actions/setup-go@v5
pchandra19 marked this conversation as resolved.
Show resolved Hide resolved
with:
go-version: 1.19.13
cache: false

# - name: Lint Check
# uses: golangci/golangci-lint-action@v4
# with:
# version: v1.56.2
# args: -E exportloopref,dupl,revive,bodyclose,goconst,misspell -D structcheck --timeout 5m0s

- name: Check if the chart follows a valid semver version
run: |
branch_name="${{ github.event.pull_request.base.ref }}"
./scripts/validate-chart-version.sh --branch $branch_name
pchandra19 marked this conversation as resolved.
Show resolved Hide resolved

- name: Run chart-testing lint
run: |
ct lint --config ct.yaml


unit-test:
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.19
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: 1.19.13

Expand All @@ -40,14 +77,19 @@ jobs:
run: make verify-src

- name: Upload Coverage Report
uses: codecov/codecov-action@v1
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.txt
name: coverage-$(date +%s)
flags: unittests

provisioner-localpv:
runs-on: ubuntu-latest
needs: ['lint', 'unit-test']
steps:
- name: Set up Go 1.19
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: 1.19.13

Expand Down Expand Up @@ -84,29 +126,15 @@ jobs:
kubernetes: [v1.27.2]
steps:
- name: Set up Go 1.19
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: 1.19.13

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
with:
version: v0.5.1

- name: Checkout
uses: actions/checkout@v4

- name: Build Image
uses: docker/build-push-action@v4
with:
context: .
file: ./buildscripts/provisioner-localpv/provisioner-localpv.Dockerfile
push: false
load: true
platforms: linux/amd64
tags: |
openebs/provisioner-localpv:ci
- name: Build images locally
run: make provisioner-localpv-image || exit 1;

- name: Setup Minikube-Kubernetes
uses: medyagh/setup-minikube@latest
Expand All @@ -120,27 +148,12 @@ jobs:

- name: Set up infra for integration test
run: |
OPENEBS_NAMESPACE="openebs"
sudo apt-get update && sudo apt-get install -y xfsprogs quota linux-modules-extra-`uname -r`
go install -mod=mod github.com/onsi/ginkgo/v2/[email protected]
sed -e '/openebs-provisioner-hostpath/{N;s/IfNotPresent/Never/}' deploy/kubectl/openebs-operator-lite.yaml | kubectl apply -f -
helm install localpv-provisioner ./deploy/helm/charts -n $OPENEBS_NAMESPACE --create-namespace --set localpv.image.pullPolicy=Never --set analytics.enabled=false

- name: Integration test
run: |
make integration-test

localpv-e2e:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Build the localpv-e2e image
uses: docker/build-push-action@v4
with:
file: ./e2e-tests/Dockerfile
push: false
load: false
platforms: linux/amd64
tags: |
openebs/localpv-e2e:ci

Loading
Loading