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
76 changes: 22 additions & 54 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,14 @@ jobs:
run: make verify-src

- name: Upload Coverage Report
uses: codecov/codecov-action@v1
uses: codecov/codecov-action@v4

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 +163,12 @@ 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 @@ -187,38 +184,9 @@ jobs:
run: |
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

72 changes: 46 additions & 26 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
pchandra19 marked this conversation as resolved.
Show resolved Hide resolved

- 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,14 @@ jobs:
run: make verify-src

- name: Upload Coverage Report
uses: codecov/codecov-action@v1
uses: codecov/codecov-action@v4

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 +121,12 @@ 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 @@ -122,7 +142,7 @@ jobs:
run: |
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: |
Expand Down
107 changes: 105 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,118 @@
# See the License for the specific language governing permissions and
# limitations under the License.

name: release
name: Release Images and Charts

on:
release:
types:
- 'created'

jobs:
provisioner-localpv:

lint:
runs-on: ubuntu-latest
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
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
pchandra19 marked this conversation as resolved.
Show resolved Hide resolved

- 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: Check if the chart is publishable
run: |
TAG=${{ github.event.release.tag_name }}
./scripts/update-chart-version.sh --tag $TAG --publish-release
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@v5
with:
go-version: 1.19.13

- name: Checkout
uses: actions/checkout@v4

- name: Unit test
run: make test

- name: Verify corrections
run: make verify-src

- name: Upload Coverage Report
uses: codecov/codecov-action@v4

integration-test:
runs-on: ubuntu-latest
needs: ['lint', 'unit-test']
strategy:
matrix:
kubernetes: [v1.27.2]
steps:
- name: Set up Go 1.19
uses: actions/setup-go@v5
with:
go-version: 1.19.13

- name: Build images locally
run: make provisioner-localpv-image || exit 1;

- name: Setup Minikube-Kubernetes
uses: medyagh/setup-minikube@latest
with:
cache: false
minikube-version: 1.31.1
driver: none
kubernetes-version: ${{ matrix.kubernetes }}
cni: calico
start-args: '--install-addons=false'

- name: Set up infra for integration test
run: |
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]
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

csi-driver:
if: contains(github.ref, 'tags/v')
runs-on: ubuntu-latest
steps:
Expand Down
3 changes: 2 additions & 1 deletion ct.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ target-branch: develop
chart-dirs:
- deploy/helm
helm-extra-args: --timeout=500s
validate-maintainers: false
validate-maintainers: false
pchandra19 marked this conversation as resolved.
Show resolved Hide resolved
check-version-increment: false
14 changes: 14 additions & 0 deletions nix/sources.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"nixpkgs": {
"branch": "release-23.05",
"description": "A read-only mirror of NixOS/nixpkgs tracking the released channels. Send issues and PRs to",
"homepage": "https://github.com/NixOS/nixpkgs",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "9a333eaa80901efe01df07eade2c16d183761fa3",
"sha256": "0xhqjli4m9wkzv7xhs6fr1iajdjbv7xnj0bwvwldq9s6arlwkhj3",
"type": "tarball",
"url": "https://github.com/NixOS/nixpkgs/archive/9a333eaa80901efe01df07eade2c16d183761fa3.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
}
}
pchandra19 marked this conversation as resolved.
Show resolved Hide resolved
Loading
Loading