Skip to content

Commit

Permalink
CI: switch amd64 tests to Github Action
Browse files Browse the repository at this point in the history
Signed-off-by: Xiang Dai <long0dai@foxmail.com>
  • Loading branch information
daixiang0 committed Nov 18, 2020
1 parent 1debbb0 commit 2aebd72
Show file tree
Hide file tree
Showing 15 changed files with 197 additions and 116 deletions.
188 changes: 188 additions & 0 deletions .github/workflows/main.yaml
@@ -0,0 +1,188 @@
name: Main CI WorkFlow

on:
push:
branches:
- master
tags:
pull_request:

jobs:
lint:
runs-on: ubuntu-latest
name: Verify vendor, licenses, do lint
steps:
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: 1.14.x

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

- uses: actions/cache@v2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}

- name: Install dependences
run: |
sudo apt-get install -y jq
curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | BINARY=golangci-lint sh -s -- -d -b $(go env GOPATH)/bin v1.23.7
- name: Run verify test
run: make verify

- name: Run lint test
run: make lint
build:
runs-on: ubuntu-latest
name: Multiple build
steps:
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: 1.14.x

- uses: actions/cache@v2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}

- name: Install dependences
run: sudo apt-get install -y upx-ucl gcc-aarch64-linux-gnu libc6-dev-arm64-cross gcc-arm-linux-gnueabi libc6-dev-armel-cross

- name: Checkout code into the Go module directory
uses: actions/checkout@v2
with:
fetch-depth: 0

- run: make

- run: make bluetoothdevice

- run: make smallbuild

- run: make crossbuild

- run: make crossbuild GOARM=GOARM7

basic_test:
runs-on: ubuntu-latest
name: Unit test, integration test edge
env:
GO111MODULE: on
steps:
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: 1.14.x

- uses: actions/cache@v2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}

- name: Install dependences
run: |
command -v ginkgo || go get github.com/onsi/ginkgo/ginkgo
- name: Check out code into the Go module directory
uses: actions/checkout@v2
with:
fetch-depth: 0

- run: make test

- run: make integrationtest

e2e_test:
runs-on: ubuntu-latest
name: E2e test
env:
GO111MODULE: on
steps:
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: 1.14.x

- uses: actions/cache@v2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}

- name: Install dependences
run: |
command -v ginkgo || go get github.com/onsi/ginkgo/ginkgo
command -v kind || go get sigs.k8s.io/kind@v0.9.0
curl -LO https://storage.googleapis.com/kubernetes-release/release/v1.19.3/bin/linux/amd64/kubectl && sudo install kubectl /usr/local/bin/kubectl
- name: Check out code into the Go module directory
uses: actions/checkout@v2
with:
fetch-depth: 0

- run: make e2e

keadm_e2e_test:
runs-on: ubuntu-latest
name: Keadm e2e test
env:
GO111MODULE: on
steps:
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: 1.14.x

- uses: actions/cache@v2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}

- name: Install dependences
run: |
command -v ginkgo || go get github.com/onsi/ginkgo/ginkgo
command -v kind || go get sigs.k8s.io/kind@v0.9.0
curl -LO https://storage.googleapis.com/kubernetes-release/release/v1.19.3/bin/linux/amd64/kubectl && sudo install kubectl /usr/local/bin/kubectl
export RELEASE_VERSION=$(wget -qO - https://kubeedge.io/latestversion | cat)
sudo wget -qP /etc/kubeedge https://github.com/kubeedge/kubeedge/releases/download/${RELEASE_VERSION}/checksum_kubeedge-${RELEASE_VERSION}-linux-amd64.tar.gz.txt
sudo wget -qP /etc/kubeedge https://github.com/kubeedge/kubeedge/releases/download/${RELEASE_VERSION}/kubeedge-${RELEASE_VERSION}-linux-amd64.tar.gz
echo "$(cat /etc/kubeedge/checksum_kubeedge-${RELEASE_VERSION}-linux-amd64.tar.gz.txt) /etc/kubeedge/kubeedge-${RELEASE_VERSION}-linux-amd64.tar.gz" | sha512sum -c
- name: Check out code into the Go module directory
uses: actions/checkout@v2
with:
fetch-depth: 0

- run: make keadm_e2e

docker_build:
runs-on: ubuntu-latest
name: Multiple docker image build
steps:
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: 1.14.x

- uses: actions/cache@v2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}

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

- run: make cloudimage

- run: make admissionimage

- run: make edgeimage ARCH="amd64"

- run: make edgesiteimage ARCH="amd64"

- run: make bluetoothdevice_image
111 changes: 1 addition & 110 deletions .travis.yml
Expand Up @@ -33,82 +33,6 @@ install: skip

jobs:
include:
- stage: "Verify vendor, licenses, do lint"
name: "Verify vendor, licenses, do lint"
before_script:
- curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | BINARY=golangci-lint sh -s -- -d -b $(go env GOPATH)/bin v1.23.7
- export GO111MODULE=on
- export GOFLAGS=-mod=mod
- sudo apt-get install jq -y
script:
- make verify
- make lint

- stage: "Test on amd64"
name: "build, smallbuild, crossbuild"
arch: amd64
before_script:
- sudo apt-get install upx-ucl -y
- sudo apt-get install gcc-aarch64-linux-gnu -y
- sudo apt-get install libc6-dev-arm64-cross -y
- sudo apt-get install gcc-arm-linux-gnueabi -y
- sudo apt-get install libc6-dev-armel-cross -y
- export GOFLAGS=-mod=vendor
script:
- make
- make bluetoothdevice
- make smallbuild
- make crossbuild
- make crossbuild GOARM=GOARM7
- name: "unit test, integration test edge"
arch: amd64
before_script:
- go get github.com/onsi/ginkgo/ginkgo
- export GOFLAGS=-mod=mod
script:
- make test
- make integrationtest
- name: "e2e test"
arch: amd64
before_script:
- go get github.com/onsi/ginkgo/ginkgo
- go get sigs.k8s.io/kind@v0.9.0
- go mod vendor
- export GOFLAGS=-mod=vendor
- sudo apt-get update && sudo apt-get install -y apt-transport-https
- curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
- echo "deb https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee -a /etc/apt/sources.list.d/kubernetes.list
- sudo apt-get update
- sudo apt-get install -y kubectl
script:
- travis_retry make e2e
- name: "keadm e2e test"
arch: amd64
before_script:
- go get github.com/onsi/ginkgo/ginkgo
- go get sigs.k8s.io/kind@v0.7.0
- go mod vendor
- export GOFLAGS=-mod=vendor
- sudo apt-get update && sudo apt-get install -y apt-transport-https
- curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
- echo "deb https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee -a /etc/apt/sources.list.d/kubernetes.list
- sudo apt-get update
- sudo apt-get install -y kubectl
- export RELEASE_VERSION=$(wget -qO - https://kubeedge.io/latestversion | cat)
- travis_retry sudo wget -qP /etc/kubeedge https://github.com/kubeedge/kubeedge/releases/download/${RELEASE_VERSION}/checksum_kubeedge-${RELEASE_VERSION}-linux-amd64.tar.gz.txt
- travis_retry sudo wget -qP /etc/kubeedge https://github.com/kubeedge/kubeedge/releases/download/${RELEASE_VERSION}/kubeedge-${RELEASE_VERSION}-linux-amd64.tar.gz
- echo "$(cat /etc/kubeedge/checksum_kubeedge-${RELEASE_VERSION}-linux-amd64.tar.gz.txt) /etc/kubeedge/kubeedge-${RELEASE_VERSION}-linux-amd64.tar.gz" | sha512sum -c || exit 1
script:
- make keadm_e2e
- name: "build docker images on amd64"
arch: amd64
script:
- make cloudimage
- make admissionimage
- make edgeimage ARCH="amd64"
- make edgesiteimage ARCH="amd64"
- make bluetoothdevice_image

- stage: "Test on arm64"
name: "build, smallbuild"
arch: arm64
Expand All @@ -120,44 +44,11 @@ jobs:
- make bluetoothdevice
- make smallbuild
- name: "unit test, integration test edge"
arch: arm64-graviton2
virt: vm
arch: arm64
before_script:
- go get github.com/onsi/ginkgo/ginkgo
- export GOFLAGS=-mod=mod
script:
- make test
- make integrationtest
- name: "e2e test"
arch: arm64-graviton2
virt: vm
before_script:
- go get github.com/onsi/ginkgo/ginkgo
- go get sigs.k8s.io/kind@v0.7.0
- go mod vendor
- export GOFLAGS=-mod=vendor
- sudo apt-get update && sudo apt-get install -y apt-transport-https
- curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
- echo "deb https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee -a /etc/apt/sources.list.d/kubernetes.list
- sudo apt-get update
- sudo apt-get install -y kubectl
script:
- travis_retry make e2e
- name: "keadm e2e test"
arch: arm64-graviton2
virt: vm
before_script:
- go get github.com/onsi/ginkgo/ginkgo
- go get sigs.k8s.io/kind@v0.7.0
- go mod vendor
- export GOFLAGS=-mod=vendor
- sudo apt-get update && sudo apt-get install -y apt-transport-https
- curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
- echo "deb https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee -a /etc/apt/sources.list.d/kubernetes.list
- sudo apt-get update
- sudo apt-get install -y kubectl
script:
- travis_retry make keadm_e2e
- name: "build docker images on arm64"
arch: arm64
script:
Expand Down
14 changes: 8 additions & 6 deletions Makefile
Expand Up @@ -2,6 +2,8 @@ DESTDIR?=
USR_DIR?=/usr/local
INSTALL_DIR?=${DESTDIR}${USR_DIR}
INSTALL_BIN_DIR?=${INSTALL_DIR}/bin
GOPATH?=$(shell go env GOPATH)

# make all builds both cloud and edge binaries

BINARIES=cloudcore \
Expand Down Expand Up @@ -62,17 +64,17 @@ endif

.PHONY: verify-golang
verify-golang:
bash hack/verify-golang.sh
hack/verify-golang.sh

.PHONY: verify-vendor
verify-vendor:
bash hack/verify-vendor.sh
hack/verify-vendor.sh
.PHONY: verify-codegen
verify-codegen:
bash cloud/hack/verify-codegen.sh
cloud/hack/verify-codegen.sh
.PHONY: verify-vendor-licenses
verify-vendor-licenses:
bash hack/verify-vendor-licenses.sh
hack/verify-vendor-licenses.sh

define TEST_HELP_INFO
# run golang test case.
Expand Down Expand Up @@ -212,7 +214,7 @@ else
e2e:
# bash tests/e2e/scripts/execute.sh device_crd
# This has been commented temporarily since there is an issue of CI using same master for all PRs, which is causing failures when run parallelly
bash tests/e2e/scripts/execute.sh
tests/e2e/scripts/execute.sh
endif

define KEADM_E2E_HELP_INFO
Expand All @@ -229,7 +231,7 @@ keadm_e2e:
@echo "KEADM_E2E_HELP_INFO"
else
keadm_e2e:
bash tests/e2e/scripts/keadm_e2e.sh
tests/e2e/scripts/keadm_e2e.sh
endif

define CLEAN_HELP_INFO
Expand Down
Empty file modified edge/hack/clean.sh 100644 → 100755
Empty file.
Empty file modified edge/hack/install_docker_for_raspbian.sh 100644 → 100755
Empty file.
Empty file modified edge/hack/setup_for_IEF.sh 100644 → 100755
Empty file.
Empty file modified hack/lib/golang.sh 100644 → 100755
Empty file.
Empty file modified hack/lib/init.sh 100644 → 100755
Empty file.
Empty file modified hack/lib/install.sh 100644 → 100755
Empty file.
Empty file modified hack/lib/lint.sh 100644 → 100755
Empty file.
Empty file modified hack/lib/mapper.sh 100644 → 100755
Empty file.
Empty file modified hack/lib/util.sh 100644 → 100755
Empty file.
Empty file modified hack/setup-vmruntime.sh 100644 → 100755
Empty file.
Empty file modified mappers/modbus_mapper/scripts/start_modbusmapper.sh 100644 → 100755
Empty file.
Empty file modified tests/e2e/scripts/bluetoothconfig.sh 100644 → 100755
Empty file.

0 comments on commit 2aebd72

Please sign in to comment.