Skip to content

Commit

Permalink
chore(actions): move travis tests to github action (#95)
Browse files Browse the repository at this point in the history
Signed-off-by: shubham <[email protected]>
  • Loading branch information
shubham14bajpai authored Mar 5, 2021
1 parent bd5b0e0 commit 406cc60
Show file tree
Hide file tree
Showing 10 changed files with 278 additions and 28 deletions.
89 changes: 87 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:

upgrade:
runs-on: ubuntu-latest
needs: ['lint']
needs: ['lint','upgrade-e2e']
steps:
- name: Checkout
uses: actions/checkout@v2
Expand Down Expand Up @@ -79,7 +79,7 @@ jobs:
migrate:
runs-on: ubuntu-latest
needs: ['lint']
needs: ['lint', 'migration-e2e']
steps:
- name: Checkout
uses: actions/checkout@v2
Expand Down Expand Up @@ -122,3 +122,88 @@ jobs:
run: |
make docker.buildx.migrate
make buildx.push.migrate
unit-tests:
name: unit tests
runs-on: ubuntu-latest
steps:

- name: Set up Go 1.14
uses: actions/setup-go@v2
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 check-license

- name: verify dependencies
run: make deps

- name: verify tests
run: make test

migration-e2e:
needs: ['unit-tests']
runs-on: ubuntu-latest
strategy:
fail-fast: true
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: Running tests
run: ./ci/migrate/sanity.sh

upgrade-e2e:
needs: ['unit-tests']
runs-on: ubuntu-latest
strategy:
fail-fast: true
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: Running tests
run: ./ci/upgrade/sanity.sh
79 changes: 79 additions & 0 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,82 @@ jobs:
env:
IMG_RESULT: cache
run: make docker.buildx.migrate

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

- name: Set up Go 1.14
uses: actions/setup-go@v2
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 check-license

- name: verify dependencies
run: make deps

- name: verify tests
run: make test

migration-e2e:
needs: ['unit-tests']
runs-on: ubuntu-latest
strategy:
fail-fast: true
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.base_ref}}"
CI_TAG="ci"
echo "TAG=${CI_TAG}" >> $GITHUB_ENV
echo "BRANCH=${BRANCH}" >> $GITHUB_ENV
- name: Running tests
run: ./ci/migrate/sanity.sh

upgrade-e2e:
needs: ['unit-tests']
runs-on: ubuntu-latest
strategy:
fail-fast: true
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.base_ref}}"
CI_TAG="ci"
echo "TAG=${CI_TAG}" >> $GITHUB_ENV
echo "BRANCH=${BRANCH}" >> $GITHUB_ENV
- name: Running tests
run: ./ci/upgrade/sanity.sh
79 changes: 79 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ on:

jobs:
upgrade:
needs: ['upgrade-e2e']
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand Down Expand Up @@ -60,6 +61,7 @@ jobs:
make buildx.push.upgrade
migrate:
needs: ['migration-e2e']
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand Down Expand Up @@ -98,3 +100,80 @@ jobs:
run: |
make docker.buildx.migrate
make buildx.push.migrate
unit-tests:
name: unit tests
runs-on: ubuntu-latest
steps:

- name: Set up Go 1.14
uses: actions/setup-go@v2
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 check-license

- name: verify dependencies
run: make deps

- name: verify tests
run: make test

migration-e2e:
needs: ['unit-tests']
runs-on: ubuntu-latest
strategy:
fail-fast: true
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: Running tests
run: ./ci/migrate/sanity.sh

upgrade-e2e:
needs: ['unit-tests']
runs-on: ubuntu-latest
strategy:
fail-fast: true
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: Running tests
run: ./ci/upgrade/sanity.sh
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,9 @@ clean-upgrade:
# deps ensures fresh go.mod and go.sum.
.PHONY: deps
deps:
@echo "--> Tidying up submodules"
@go mod tidy
@echo "--> Verifying submodules"
@go mod verify

.PHONY: test
Expand Down
1 change: 1 addition & 0 deletions changelogs/unreleased/95-shubham14bajpai
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
chore(actions): move travis tests to github action
20 changes: 11 additions & 9 deletions ci/migrate/sanity.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,13 @@
# See the License for the specific language governing permissions and
# limitations under the License.

sudo modprobe iscsi_tcp

make migrate-image.amd64

# To test the sanity in different customized
# image prefixes
if [[ ${IMAGE_ORG} == "" ]]; then
if [ -z "${IMAGE_ORG}" ]; then
IMAGE_ORG="openebs";
export IMAGE_ORG;
fi
Expand All @@ -28,11 +30,11 @@ fi
# image tags
# Determine the current branch
CURRENT_BRANCH=""
if [ -z ${TRAVIS_BRANCH} ];
if [ -z "${BRANCH}" ];
then
CURRENT_BRANCH=$(git branch | grep \* | cut -d ' ' -f2)
else
CURRENT_BRANCH=${TRAVIS_BRANCH}
CURRENT_BRANCH="${BRANCH}"
fi

TEST_IMAGE_TAG="${CURRENT_BRANCH}-ci"
Expand All @@ -41,17 +43,17 @@ if [ ${CURRENT_BRANCH} = "master" ]; then
fi
TEST_VERSION="${CURRENT_BRANCH}-dev"

if [ -n "$TRAVIS_TAG" ]; then
# Trim the `v` from the TRAVIS_TAG if it exists
if [ -n "$RELEASE_TAG" ]; then
# Trim the `v` from the RELEASE_TAG if it exists
# Example: v1.10.0 maps to 1.10.0
# Example: 1.10.0 maps to 1.10.0
# Example: v1.10.0-custom maps to 1.10.0-custom
TEST_IMAGE_TAG="${TRAVIS_TAG#v}"
TEST_VERSION="${TRAVIS_TAG#v}"
TEST_IMAGE_TAG="${RELEASE_TAG#v}"
TEST_VERSION="${RELEASE_TAG#v}"
fi

export TEST_IMAGE_TAG=${TEST_IMAGE_TAG#v}
export TEST_VERSION=${TEST_VERSION#v}
export TEST_IMAGE_TAG="${TEST_IMAGE_TAG#v}"
export TEST_VERSION="${TEST_VERSION#v}"

echo "Testing migrate for org: $IMAGE_ORG version: $TEST_VERSION imagetag: $TEST_IMAGE_TAG"

Expand Down
2 changes: 1 addition & 1 deletion ci/migrate/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ kubectl label nodes --all nodetype=storage

echo "Create application with cStor volume on SPC"

bdname=$(kubectl -n openebs get blockdevices -o jsonpath='{.items[*].metadata.name}')
bdname=$(kubectl -n openebs get blockdevices -o jsonpath='{.items[?(@.spec.details.deviceType=="sparse")].metadata.name}')
sed "s/SPCBD/$bdname/" ./ci/migrate/application.tmp.yaml > ./ci/migrate/application.yaml
kubectl apply -f ./ci/migrate/application.yaml
sleep 5
Expand Down
Loading

0 comments on commit 406cc60

Please sign in to comment.