Skip to content

Commit 1df1856

Browse files
committed
ci: enable new ci and build.yml changes
Signed-off-by: Diwakar Sharma <[email protected]>
1 parent 34049cb commit 1df1856

File tree

4 files changed

+74
-160
lines changed

4 files changed

+74
-160
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,44 @@
1-
# Copyright 2020 The OpenEBS Authors. All rights reserved.
2-
#
3-
# Licensed under the Apache License, Version 2.0 (the "License");
4-
# you may not use this file except in compliance with the License.
5-
# You may obtain a copy of the License at
6-
#
7-
# http://www.apache.org/licenses/LICENSE-2.0
8-
#
9-
# Unless required by applicable law or agreed to in writing, software
10-
# distributed under the License is distributed on an "AS IS" BASIS,
11-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12-
# See the License for the specific language governing permissions and
13-
# limitations under the License.
14-
name: build
1+
name: Build and Push
152

163
on:
174
create:
185
push:
196
branches:
20-
- 'develop'
21-
- 'v*'
7+
- develop
8+
- "release/**"
229
paths-ignore:
23-
- '*.md'
24-
- 'BUILDMETA'
25-
- 'changelogs/**'
26-
- 'deploy/helm/**'
27-
- 'docs/**'
28-
- 'LICENSE'
29-
- 'MAINTAINERS'
10+
- "*.md"
11+
- "BUILDMETA"
12+
- "changelogs/**"
13+
- "deploy/helm/**"
14+
- "docs/**"
15+
- "design/**"
16+
- "LICENSE"
17+
- "MAINTAINERS"
3018

3119
jobs:
3220
lint:
33-
# to ignore builds on release
34-
if: ${{ (github.event.ref_type != 'tag') }}
3521
runs-on: ubuntu-latest
3622
steps:
3723
- name: Checkout
3824
uses: actions/checkout@v4
39-
40-
- name: Shellcheck
41-
uses: reviewdog/action-shellcheck@v1
4225
with:
43-
github_token: ${{ secrets.github_token }}
44-
reporter: github-pr-review
45-
path: '.'
46-
pattern: '*.sh'
47-
exclude: './.git/*'
26+
fetch-depth: 0
4827

49-
- name: Set up Go 1.19
50-
uses: actions/setup-go@v5
28+
- uses: cachix/install-nix-action@v22
29+
- uses: rrbutani/[email protected]
5130
with:
52-
go-version: 1.19.9
53-
cache: false
31+
file: shell.nix
5432

55-
- name: Lint Check
56-
uses: golangci/golangci-lint-action@v4
57-
with:
58-
version: v1.56.2
59-
args: -E exportloopref,dupl,revive,bodyclose,goconst,misspell -D structcheck --timeout 5m0s
33+
- name: Check if the chart follows a valid semver version
34+
run: |
35+
BRANCH=${{ github.ref_name }}
36+
./scripts/validate-chart-version.sh --branch $BRANCH
37+
- name: Run chart-testing lint
38+
run: |
39+
ct lint --config ct.yaml
6040
61-
unit-test:
62-
# to ignore builds on release
63-
if: ${{ (github.event.ref_type != 'tag') }}
41+
unit-tests:
6442
runs-on: ubuntu-latest
6543
steps:
6644
- name: Checkout
@@ -76,15 +54,15 @@ jobs:
7654
run: make test
7755

7856
- name: Upload Coverage Report
79-
uses: codecov/codecov-action@v4
57+
uses: codecov/codecov-action@v4
8058
with:
8159
token: ${{ secrets.CODECOV_TOKEN }}
8260
file: ./coverage.txt
8361
name: coverage-$(date +%s)
8462
flags: unittests
8563

86-
bdd-test:
87-
needs: ['unit-test']
64+
bdd-tests:
65+
needs: ["unit-tests"]
8866
runs-on: ubuntu-latest
8967
strategy:
9068
fail-fast: true
@@ -108,7 +86,7 @@ jobs:
10886
driver: none
10987
kubernetes-version: ${{ matrix.kubernetes }}
11088
cni: calico
111-
start-args: '--install-addons=false'
89+
start-args: "--install-addons=false"
11290

11391
- name: Build images locally
11492
run: make lvm-driver-image || exit 1;
@@ -117,6 +95,8 @@ jobs:
11795
run: make bootstrap
11896

11997
- name: Running tests
98+
env:
99+
OPENEBS_NAMESPACE: "openebs"
120100
run: ./ci/ci-test.sh
121101

122102
- name: Upload Coverage Report
@@ -127,44 +107,14 @@ jobs:
127107
name: coverage-bdd_coverage-$(date +%s)
128108
flags: bddtests
129109

130-
ansible:
131-
runs-on: ubuntu-latest
132-
needs: ['lint', 'unit-test', 'bdd-test']
133-
steps:
134-
- name: Checkout
135-
uses: actions/checkout@v4
136-
137-
- name: Set Image Org
138-
# sets the default IMAGE_ORG to openebs
139-
run: |
140-
[ -z "${{ secrets.IMAGE_ORG }}" ] && IMAGE_ORG=openebs || IMAGE_ORG=${{ secrets.IMAGE_ORG}}
141-
echo "IMAGE_ORG=${IMAGE_ORG}" >> $GITHUB_ENV
142-
143-
- name: Login to Docker Hub
144-
uses: docker/login-action@v3
145-
with:
146-
username: ${{ secrets.DOCKERHUB_USERNAME }}
147-
password: ${{ secrets.DOCKERHUB_TOKEN }}
148-
149-
- name: Build and push the ansible image
150-
uses: docker/build-push-action@v5
151-
with:
152-
file: ./e2e-tests/Dockerfile
153-
push: true
154-
load: false
155-
platforms: linux/amd64
156-
tags: |
157-
${{ env.IMAGE_ORG }}/lvm-localpv-e2e:ci
158-
159110
csi-driver:
160111
runs-on: ubuntu-latest
161-
needs: ['lint', 'unit-test', 'bdd-test']
112+
needs: ["lint", "bdd-tests"]
162113
steps:
163114
- name: Checkout
164115
uses: actions/checkout@v4
165116

166117
- name: Set Image Org
167-
# sets the default IMAGE_ORG to openebs
168118
run: |
169119
[ -z "${{ secrets.IMAGE_ORG }}" ] && IMAGE_ORG=openebs || IMAGE_ORG=${{ secrets.IMAGE_ORG }}
170120
echo "IMAGE_ORG=${IMAGE_ORG}" >> $GITHUB_ENV
@@ -174,15 +124,11 @@ jobs:
174124
run: |
175125
echo "DATE=$(date -u +'%Y-%m-%dT%H:%M:%S%Z')" >> $GITHUB_OUTPUT
176126
177-
- name: Set Tag
127+
- name: Set IMAGE_TAG and BRANCH
178128
run: |
179-
BRANCH="${GITHUB_REF##*/}"
180-
CI_TAG=${BRANCH#v}-ci
181-
if [ ${BRANCH} = "develop" ]; then
182-
CI_TAG="ci"
183-
fi
184-
echo "TAG=${CI_TAG}" >> $GITHUB_ENV
185-
echo "BRANCH=${BRANCH}" >> $GITHUB_ENV
129+
BRANCH=${{ github.ref_name }}
130+
echo "BRANCH=$BRANCH" >> $GITHUB_ENV
131+
echo "IMAGE_TAG=$(awk -F': ' '/^version:/ {print $$2}' deploy/helm/charts/Chart.yaml)" >> $GITHUB_ENV
186132
187133
- name: Docker meta
188134
id: docker_meta
@@ -195,11 +141,11 @@ jobs:
195141
ghcr.io/${{ env.IMAGE_ORG }}/lvm-driver
196142
tags: |
197143
type=raw,value=latest,enable=false
198-
type=raw,value=${{ env.TAG }}
144+
type=raw,value=${{ env.IMAGE_TAG }}
199145
200146
- name: Print Tag info
201147
run: |
202-
echo "BRANCH: ${BRANCH}"
148+
echo "BRANCH: ${env.BRANCH}"
203149
echo "${{ steps.docker_meta.outputs.tags }}"
204150
205151
- name: Set up QEMU
@@ -247,3 +193,14 @@ jobs:
247193
DBUILD_REPO_URL=https://github.com/openebs/lvm-localpv
248194
DBUILD_SITE_URL=https://openebs.io
249195
BRANCH=${{ env.BRANCH }}
196+
197+
release-chart:
198+
runs-on: ubuntu-latest
199+
needs: ["csi-driver"]
200+
steps:
201+
- uses: actions/checkout@v4
202+
- name: Publish lvm localpv develop or prerelease helm chart
203+
uses: stefanprodan/helm-gh-pages@master
204+
with:
205+
token: ${{ secrets.GITHUB_TOKEN }}
206+
charts_dir: ./deploy/helm

.github/workflows/pull_request.yml

+22-32
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@ name: Pull Request CI
33
on:
44
pull_request:
55
branches:
6-
- 'develop'
7-
- 'release/**'
6+
- develop
7+
- "release/**"
88
paths-ignore:
9-
- '*.md'
10-
- 'BUILDMETA'
11-
- 'changelogs/**'
12-
- 'docs/**'
13-
- 'design/**'
14-
- 'LICENSE'
15-
- 'MAINTAINERS'
9+
- "*.md"
10+
- "BUILDMETA"
11+
- "changelogs/**"
12+
- "docs/**"
13+
- "design/**"
14+
- "LICENSE"
15+
- "MAINTAINERS"
1616

1717
jobs:
1818
lint:
@@ -29,12 +29,6 @@ jobs:
2929
go-version: 1.19.9
3030
cache: false
3131

32-
- name: Format test
33-
run: make format
34-
35-
- name: bootstrap
36-
run: make bootstrap
37-
3832
- name: Lint Check
3933
uses: golangci/golangci-lint-action@v4
4034
with:
@@ -46,19 +40,19 @@ jobs:
4640
with:
4741
github_token: ${{ secrets.github_token }}
4842
reporter: github-pr-review
49-
path: '.'
50-
pattern: '*.sh'
43+
path: "."
44+
pattern: "*.sh"
5145

5246
- uses: cachix/install-nix-action@v22
5347
- uses: rrbutani/[email protected]
5448
with:
5549
file: shell.nix
5650

57-
# - name: Check if the chart follows a valid semver version
58-
# run: |
59-
# branch_name="${{ github.event.pull_request.base.ref }}"
60-
# ./scripts/validate-chart-version.sh --branch $branch_name
61-
51+
- name: Check if the chart follows a valid semver version
52+
run: |
53+
branch_name="${{ github.event.pull_request.base.ref }}"
54+
./scripts/validate-chart-version.sh --branch $branch_name
55+
6256
- name: Run chart-testing lint
6357
run: |
6458
ct lint --config ct.yaml
@@ -79,15 +73,15 @@ jobs:
7973
run: make test
8074

8175
- name: Upload Coverage Report
82-
uses: codecov/codecov-action@v4
76+
uses: codecov/codecov-action@v4
8377
with:
8478
token: ${{ secrets.CODECOV_TOKEN }}
8579
file: ./coverage.txt
8680
name: coverage-$(date +%s)
8781
flags: unittests
8882

8983
bdd-tests:
90-
needs: ['unit-tests']
84+
needs: ["unit-tests"]
9185
runs-on: ubuntu-latest
9286
strategy:
9387
fail-fast: true
@@ -96,11 +90,6 @@ jobs:
9690
steps:
9791
- name: Checkout
9892
uses: actions/checkout@v4
99-
100-
- uses: cachix/install-nix-action@v22
101-
- uses: rrbutani/[email protected]
102-
with:
103-
file: shell.nix
10493

10594
- name: Set up Go 1.19
10695
uses: actions/setup-go@v5
@@ -119,17 +108,18 @@ jobs:
119108
driver: none
120109
kubernetes-version: ${{ matrix.kubernetes }}
121110
cni: calico
122-
start-args: '--install-addons=false'
111+
start-args: "--install-addons=false"
123112

124113
- name: Setting environment variables
125114
run: |
126115
echo "KUBECONFIG=$HOME/.kube/config" >> $GITHUB_ENV
127-
echo "OPENEBS_NAMESPACE=openebs" >> $GITHUB_ENV
128116
129117
- name: bootstrap
130118
run: make bootstrap
131119

132120
- name: Running tests
121+
env:
122+
OPENEBS_NAMESPACE: "openebs"
133123
run: ./ci/ci-test.sh
134124

135125
- name: Upload Coverage Report
@@ -142,7 +132,7 @@ jobs:
142132

143133
csi-driver:
144134
runs-on: ubuntu-latest
145-
needs: ['lint', 'unit-tests', 'bdd-tests']
135+
needs: ["lint", "unit-tests", "bdd-tests"]
146136
steps:
147137
- name: Checkout
148138
uses: actions/checkout@v4

.github/workflows/release-charts.yml

-34
This file was deleted.

0 commit comments

Comments
 (0)