Skip to content

Commit 8a7e84c

Browse files
authored
Merge pull request #338 from openebs/ci_remaining
ci: enable new ci and build.yml changes
2 parents 45e0fbd + 4a67df3 commit 8a7e84c

File tree

10 files changed

+81
-224
lines changed

10 files changed

+81
-224
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,43 @@
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:
17-
create:
184
push:
195
branches:
20-
- 'develop'
21-
- 'v*'
6+
- develop
7+
- "release/**"
228
paths-ignore:
23-
- '*.md'
24-
- 'BUILDMETA'
25-
- 'changelogs/**'
26-
- 'deploy/helm/**'
27-
- 'docs/**'
28-
- 'LICENSE'
29-
- 'MAINTAINERS'
9+
- "*.md"
10+
- "BUILDMETA"
11+
- "changelogs/**"
12+
- "docs/**"
13+
- "design/**"
14+
- "LICENSE"
15+
- "MAINTAINERS"
3016

3117
jobs:
3218
lint:
33-
# to ignore builds on release
34-
if: ${{ (github.event.ref_type != 'tag') }}
3519
runs-on: ubuntu-latest
3620
steps:
3721
- name: Checkout
3822
uses: actions/checkout@v4
39-
40-
- name: Shellcheck
41-
uses: reviewdog/action-shellcheck@v1
4223
with:
43-
github_token: ${{ secrets.github_token }}
44-
reporter: github-pr-review
45-
path: '.'
46-
pattern: '*.sh'
47-
exclude: './.git/*'
24+
fetch-depth: 0
4825

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

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
31+
- name: Check if the chart follows a valid semver version
32+
run: |
33+
BRANCH=${{ github.ref_name }}
34+
./scripts/validate-chart-version.sh --branch $BRANCH
35+
36+
- name: Run chart-testing lint
37+
run: |
38+
ct lint --config ct.yaml
6039
61-
unit-test:
62-
# to ignore builds on release
63-
if: ${{ (github.event.ref_type != 'tag') }}
40+
unit-tests:
6441
runs-on: ubuntu-latest
6542
steps:
6643
- name: Checkout
@@ -76,15 +53,15 @@ jobs:
7653
run: make test
7754

7855
- name: Upload Coverage Report
79-
uses: codecov/codecov-action@v4
56+
uses: codecov/codecov-action@v4
8057
with:
8158
token: ${{ secrets.CODECOV_TOKEN }}
8259
file: ./coverage.txt
8360
name: coverage-$(date +%s)
8461
flags: unittests
8562

86-
bdd-test:
87-
needs: ['unit-test']
63+
bdd-tests:
64+
needs: ["unit-tests"]
8865
runs-on: ubuntu-latest
8966
strategy:
9067
fail-fast: true
@@ -108,7 +85,7 @@ jobs:
10885
driver: none
10986
kubernetes-version: ${{ matrix.kubernetes }}
11087
cni: calico
111-
start-args: '--install-addons=false'
88+
start-args: "--install-addons=false"
11289

11390
- name: Build images locally
11491
run: make lvm-driver-image || exit 1;
@@ -117,6 +94,8 @@ jobs:
11794
run: make bootstrap
11895

11996
- name: Running tests
97+
env:
98+
OPENEBS_NAMESPACE: "openebs"
12099
run: ./ci/ci-test.sh
121100

122101
- name: Upload Coverage Report
@@ -127,44 +106,14 @@ jobs:
127106
name: coverage-bdd_coverage-$(date +%s)
128107
flags: bddtests
129108

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-
159109
csi-driver:
160110
runs-on: ubuntu-latest
161-
needs: ['lint', 'unit-test', 'bdd-test']
111+
needs: ["lint", "bdd-tests"]
162112
steps:
163113
- name: Checkout
164114
uses: actions/checkout@v4
165115

166116
- name: Set Image Org
167-
# sets the default IMAGE_ORG to openebs
168117
run: |
169118
[ -z "${{ secrets.IMAGE_ORG }}" ] && IMAGE_ORG=openebs || IMAGE_ORG=${{ secrets.IMAGE_ORG }}
170119
echo "IMAGE_ORG=${IMAGE_ORG}" >> $GITHUB_ENV
@@ -174,15 +123,11 @@ jobs:
174123
run: |
175124
echo "DATE=$(date -u +'%Y-%m-%dT%H:%M:%S%Z')" >> $GITHUB_OUTPUT
176125
177-
- name: Set Tag
126+
- name: Set IMAGE_TAG and BRANCH
178127
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
128+
BRANCH=${{ github.ref_name }}
129+
echo "BRANCH=$BRANCH" >> $GITHUB_ENV
130+
echo "IMAGE_TAG=$(awk -F': ' '/^version:/ {print $2}' deploy/helm/charts/Chart.yaml)" >> $GITHUB_ENV
186131
187132
- name: Docker meta
188133
id: docker_meta
@@ -195,11 +140,11 @@ jobs:
195140
ghcr.io/${{ env.IMAGE_ORG }}/lvm-driver
196141
tags: |
197142
type=raw,value=latest,enable=false
198-
type=raw,value=${{ env.TAG }}
143+
type=raw,value=${{ env.IMAGE_TAG }}
199144
200145
- name: Print Tag info
201146
run: |
202-
echo "BRANCH: ${BRANCH}"
147+
echo "BRANCH: ${{ env.BRANCH }}"
203148
echo "${{ steps.docker_meta.outputs.tags }}"
204149
205150
- name: Set up QEMU
@@ -247,3 +192,14 @@ jobs:
247192
DBUILD_REPO_URL=https://github.com/openebs/lvm-localpv
248193
DBUILD_SITE_URL=https://openebs.io
249194
BRANCH=${{ env.BRANCH }}
195+
196+
release-chart:
197+
runs-on: ubuntu-latest
198+
needs: ["csi-driver"]
199+
steps:
200+
- uses: actions/checkout@v4
201+
- name: Publish lvm localpv develop or prerelease helm chart
202+
uses: stefanprodan/helm-gh-pages@master
203+
with:
204+
token: ${{ secrets.GITHUB_TOKEN }}
205+
charts_dir: ./deploy/helm

.github/workflows/chart-lint-test.yml

-56
This file was deleted.

0 commit comments

Comments
 (0)