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

chore(actions): move travis tests to github actions #223

Merged
merged 5 commits into from
Jan 8, 2021
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
67 changes: 62 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,66 @@ jobs:
pattern: '*.sh'
exclude: './.git/*,./vendor/*'

unit-tests:
name: unit tests
runs-on: ubuntu-latest
steps:

- name: Set up Go 1.14
uses: actions/setup-go@v1
with:
go-version: 1.14.7
id: go

- name: Check out code into the Go module directory
uses: actions/checkout@v2

- name: verify license
run: make license-check

- name: verify dependencies
run: make deps

- name: verify tests
run: make test

e2e-tests:
needs: ['unit-tests']
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shubham14bajpai Do we need e2e to be dependent on unit-tests. ?

IMHO, lint, unit-tests and e2e-tests can be run in parallel. Only the final build/push needs to be dependent on all these 3 jobs.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think checking the modules using make deps and running unit tests to check for syntactical errors is good before building and running the images.

runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
kubernetes: [v1.18.6]
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup Minikube-Kubernetes
uses: manusa/[email protected]
with:
minikube version: v1.9.2
kubernetes version: ${{ matrix.kubernetes }}
github token: ${{ secrets.GITHUB_TOKEN }}

- name: Set tag
run: |
BRANCH="${GITHUB_REF##*/}"
CI_TAG=${BRANCH#v}-ci
if [ ${BRANCH} = "master" ]; then
CI_TAG="ci"
fi
echo "TAG=${CI_TAG}" >> $GITHUB_ENV
echo "BRANCH=${BRANCH}" >> $GITHUB_ENV

- name: Build images locally
run: make all.amd64 || exit 1;
akhilerm marked this conversation as resolved.
Show resolved Hide resolved

- name: Running tests
run: ./ci/sanity/install.sh && ./ci/sanity/sanity.sh

cspc-operator:
runs-on: ubuntu-latest
needs: ['lint']
needs: ['lint', 'e2e-tests']
steps:
- name: Checkout
uses: actions/checkout@v2
Expand Down Expand Up @@ -79,7 +136,7 @@ jobs:

cvc-operator:
runs-on: ubuntu-latest
needs: ['lint']
needs: ['lint', 'e2e-tests']
steps:
- name: Checkout
uses: actions/checkout@v2
Expand Down Expand Up @@ -125,7 +182,7 @@ jobs:

pool-manager:
runs-on: ubuntu-latest
needs: ['lint']
needs: ['lint', 'e2e-tests']
steps:
- name: Checkout
uses: actions/checkout@v2
Expand Down Expand Up @@ -171,7 +228,7 @@ jobs:

volume-manager:
runs-on: ubuntu-latest
needs: ['lint']
needs: ['lint', 'e2e-tests']
steps:
- name: Checkout
uses: actions/checkout@v2
Expand Down Expand Up @@ -217,7 +274,7 @@ jobs:

cstor-webhook:
runs-on: ubuntu-latest
needs: ['lint']
needs: ['lint', 'e2e-tests']
steps:
- name: Checkout
uses: actions/checkout@v2
Expand Down
47 changes: 0 additions & 47 deletions .github/workflows/go.yml

This file was deleted.

56 changes: 55 additions & 1 deletion .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
path: '.'
pattern: '*.sh'
exclude: './vendor/*'

cspc-operator:
runs-on: ubuntu-latest
needs: ['lint']
Expand Down Expand Up @@ -151,3 +151,57 @@ jobs:
env:
IMG_RESULT: cache
run: make docker.buildx.cstor-webhook

unit-tests:
name: unit tests
runs-on: ubuntu-latest
steps:

- name: Set up Go 1.14
uses: actions/setup-go@v1
with:
go-version: 1.14.7
id: go

- name: Check out code into the Go module directory
uses: actions/checkout@v2

- name: verify license
run: make license-check

- name: verify dependencies
run: make deps

- name: verify tests
run: make test

e2e-tests:
needs: ['unit-tests']
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
kubernetes: [v1.18.6]
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup Minikube-Kubernetes
uses: manusa/[email protected]
with:
minikube version: v1.9.2
kubernetes version: ${{ matrix.kubernetes }}
github token: ${{ secrets.GITHUB_TOKEN }}

- name: Set tag
run: |
BRANCH="${GITHUB_REF##*/}"
CI_TAG="ci"
echo "TAG=${CI_TAG}" >> $GITHUB_ENV
echo "BRANCH=${BRANCH}" >> $GITHUB_ENV

- name: Build images locally
run: make all.amd64 || exit 1;

- name: Running tests
run: ./ci/sanity/install.sh && ./ci/sanity/sanity.sh
58 changes: 58 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,62 @@ on:
- 'v*'

jobs:
unit-tests:
name: unit tests
runs-on: ubuntu-latest
steps:

- name: Set up Go 1.14
uses: actions/setup-go@v1
with:
go-version: 1.14.7
id: go

- name: Check out code into the Go module directory
uses: actions/checkout@v2

- name: verify license
run: make license-check

- name: verify dependencies
run: make deps

- name: verify tests
run: make test

e2e-tests:
needs: ['unit-tests']
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
kubernetes: [v1.18.6]
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup Minikube-Kubernetes
uses: manusa/[email protected]
with:
minikube version: v1.9.2
kubernetes version: ${{ matrix.kubernetes }}
github token: ${{ secrets.GITHUB_TOKEN }}

- name: Set Tag
run: |
TAG="${GITHUB_REF#refs/*/v}"
echo "TAG=${TAG}" >> $GITHUB_ENV
echo "RELEASE_TAG=${TAG}" >> $GITHUB_ENV

- name: Build images locally
run: make all.amd64 || exit 1;

- name: Running tests
run: ./ci/sanity/install.sh && ./ci/sanity/sanity.sh

cspc-operator:
runs-on: ubuntu-latest
needs: ['e2e-tests']
steps:
- name: Checkout
uses: actions/checkout@v1
Expand Down Expand Up @@ -61,6 +115,7 @@ jobs:

cvc-operator:
runs-on: ubuntu-latest
needs: ['e2e-tests']
steps:
- name: Checkout
uses: actions/checkout@v1
Expand Down Expand Up @@ -101,6 +156,7 @@ jobs:

pool-manager:
runs-on: ubuntu-latest
needs: ['e2e-tests']
steps:
- name: Checkout
uses: actions/checkout@v1
Expand Down Expand Up @@ -141,6 +197,7 @@ jobs:

volume-manager:
runs-on: ubuntu-latest
needs: ['e2e-tests']
steps:
- name: Checkout
uses: actions/checkout@v1
Expand Down Expand Up @@ -181,6 +238,7 @@ jobs:

cstor-webhook:
runs-on: ubuntu-latest
needs: ['e2e-tests']
steps:
- name: Checkout
uses: actions/checkout@v1
Expand Down
2 changes: 1 addition & 1 deletion ci/sanity/sanity.sh
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ function getBD(){
nodeName=$1
BD_RETRY=$2
for i in $(seq 1 $BD_RETRY) ; do
bdName=$(kubectl get bd -n openebs -l kubernetes.io/hostname=$nodeName -o=jsonpath={.items[0].metadata.name})
bdName=$(kubectl get bd -n openebs -l kubernetes.io/hostname="$nodeName" -o=jsonpath='{.items[1].metadata.name}')
if [ "$bdName" != "" ]; then
echo "Got BD $bdName"
break
Expand Down