599 lines
17 KiB
YAML
599 lines
17 KiB
YAML
name: Workflow
|
|
|
|
on:
|
|
pull_request:
|
|
branches:
|
|
- master
|
|
push:
|
|
branches:
|
|
- master
|
|
|
|
# This ensures that previous jobs for the PR are canceled when the PR is
|
|
# updated.
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.head_ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
lint-job:
|
|
name: Checking Lint
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
matrix:
|
|
go-version: [1.17.x]
|
|
os: [ubuntu-latest]
|
|
steps:
|
|
- name: Set up Go ${{ matrix.go-version }} on ${{ matrix.os }}
|
|
uses: actions/setup-go@v2
|
|
with:
|
|
go-version: ${{ matrix.go-version }}
|
|
id: go
|
|
|
|
- name: Check out code into the Go module directory
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Build on ${{ matrix.os }}
|
|
env:
|
|
GO111MODULE: on
|
|
GOOS: linux
|
|
run: |
|
|
make verifiers
|
|
|
|
no-warnings-and-make-assets:
|
|
name: "React Code Has No Warnings and then Make Assets"
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
matrix:
|
|
go-version: [ 1.17.x ]
|
|
os: [ ubuntu-latest ]
|
|
steps:
|
|
- name: Set up Go ${{ matrix.go-version }} on ${{ matrix.os }}
|
|
uses: actions/setup-go@v2
|
|
with:
|
|
go-version: ${{ matrix.go-version }}
|
|
id: go
|
|
- uses: actions/setup-node@v2
|
|
with:
|
|
node-version: '17'
|
|
- name: Check out code into the Go module directory
|
|
uses: actions/checkout@v2
|
|
- name: Check out operator as a nested repository
|
|
uses: actions/checkout@v2
|
|
with:
|
|
repository: minio/operator
|
|
path: operator
|
|
- uses: actions/cache@v2
|
|
with:
|
|
path: |
|
|
~/.cache/go-build
|
|
~/go/pkg/mod
|
|
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-go-
|
|
|
|
- name: Get yarn cache directory path
|
|
id: yarn-cache-dir-path
|
|
run: echo "::set-output name=dir::$(yarn cache dir)"
|
|
|
|
- uses: actions/cache@v2
|
|
id: yarn-cache
|
|
with:
|
|
path: |
|
|
${{ steps.yarn-cache-dir-path.outputs.dir }}
|
|
./portal-ui/node_modules/
|
|
./portal-ui/build/
|
|
key: ${{ runner.os }}-yarn-${{ hashFiles('./portal-ui/yarn.lock') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-yarn-
|
|
|
|
- name: Install Dependencies
|
|
if: steps.yarn-cache.outputs.cache-hit != 'true'
|
|
working-directory: ./
|
|
run: make assets
|
|
|
|
- name: Check for Warnings in build output
|
|
working-directory: ./portal-ui
|
|
continue-on-error: false
|
|
run: |
|
|
chmod +x check-warnings.sh && ./check-warnings.sh
|
|
|
|
compile-job:
|
|
name: Compiles on Go ${{ matrix.go-version }} and ${{ matrix.os }}
|
|
needs:
|
|
- lint-job
|
|
- no-warnings-and-make-assets
|
|
- coverage
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
matrix:
|
|
go-version: [1.17.x]
|
|
os: [ubuntu-latest]
|
|
steps:
|
|
- name: Set up Go ${{ matrix.go-version }} on ${{ matrix.os }}
|
|
uses: actions/setup-go@v2
|
|
with:
|
|
go-version: ${{ matrix.go-version }}
|
|
id: go
|
|
|
|
- name: Check out code into the Go module directory
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Build on ${{ matrix.os }}
|
|
env:
|
|
GO111MODULE: on
|
|
GOOS: linux
|
|
run: |
|
|
make console
|
|
|
|
cross-compile-1:
|
|
name: Cross compile
|
|
needs:
|
|
- lint-job
|
|
- no-warnings-and-make-assets
|
|
- coverage
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
matrix:
|
|
go-version: [1.17.x]
|
|
os: [ubuntu-latest]
|
|
steps:
|
|
- name: Set up Go ${{ matrix.go-version }} on ${{ matrix.os }}
|
|
uses: actions/setup-go@v2
|
|
with:
|
|
go-version: ${{ matrix.go-version }}
|
|
id: go
|
|
|
|
- name: Check out code into the Go module directory
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Build on ${{ matrix.os }}
|
|
env:
|
|
GO111MODULE: on
|
|
GOOS: linux
|
|
run: |
|
|
make crosscompile arg1="'linux/ppc64le linux/mips64'"
|
|
|
|
cross-compile-2:
|
|
name: Cross compile 2
|
|
needs:
|
|
- lint-job
|
|
- no-warnings-and-make-assets
|
|
- coverage
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
matrix:
|
|
go-version: [1.17.x]
|
|
os: [ubuntu-latest]
|
|
steps:
|
|
- name: Set up Go ${{ matrix.go-version }} on ${{ matrix.os }}
|
|
uses: actions/setup-go@v2
|
|
with:
|
|
go-version: ${{ matrix.go-version }}
|
|
id: go
|
|
|
|
- name: Check out code into the Go module directory
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Build on ${{ matrix.os }}
|
|
env:
|
|
GO111MODULE: on
|
|
GOOS: linux
|
|
run: |
|
|
make crosscompile arg1="'linux/arm64 linux/s390x'"
|
|
|
|
cross-compile-3:
|
|
name: Cross compile 3
|
|
needs:
|
|
- lint-job
|
|
- no-warnings-and-make-assets
|
|
- coverage
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
matrix:
|
|
go-version: [1.17.x]
|
|
os: [ubuntu-latest]
|
|
steps:
|
|
- name: Set up Go ${{ matrix.go-version }} on ${{ matrix.os }}
|
|
uses: actions/setup-go@v2
|
|
with:
|
|
go-version: ${{ matrix.go-version }}
|
|
id: go
|
|
|
|
- name: Check out code into the Go module directory
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Build on ${{ matrix.os }}
|
|
env:
|
|
GO111MODULE: on
|
|
GOOS: linux
|
|
run: |
|
|
make crosscompile arg1="'darwin/amd64 freebsd/amd64'"
|
|
|
|
cross-compile-4:
|
|
name: Cross compile 4
|
|
needs:
|
|
- lint-job
|
|
- no-warnings-and-make-assets
|
|
- coverage
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
matrix:
|
|
go-version: [1.17.x]
|
|
os: [ubuntu-latest]
|
|
steps:
|
|
- name: Set up Go ${{ matrix.go-version }} on ${{ matrix.os }}
|
|
uses: actions/setup-go@v2
|
|
with:
|
|
go-version: ${{ matrix.go-version }}
|
|
id: go
|
|
|
|
- name: Check out code into the Go module directory
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Build on ${{ matrix.os }}
|
|
env:
|
|
GO111MODULE: on
|
|
GOOS: linux
|
|
run: |
|
|
make crosscompile arg1="'windows/amd64 linux/arm'"
|
|
|
|
cross-compile-5:
|
|
name: Cross compile 5
|
|
needs:
|
|
- lint-job
|
|
- no-warnings-and-make-assets
|
|
- coverage
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
matrix:
|
|
go-version: [1.17.x]
|
|
os: [ubuntu-latest]
|
|
steps:
|
|
- name: Set up Go ${{ matrix.go-version }} on ${{ matrix.os }}
|
|
uses: actions/setup-go@v2
|
|
with:
|
|
go-version: ${{ matrix.go-version }}
|
|
id: go
|
|
|
|
- name: Check out code into the Go module directory
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Build on ${{ matrix.os }}
|
|
env:
|
|
GO111MODULE: on
|
|
GOOS: linux
|
|
run: |
|
|
make crosscompile arg1="'linux/386 netbsd/amd64'"
|
|
|
|
test-pkg-on-go:
|
|
name: Test Pkg on Go ${{ matrix.go-version }} and ${{ matrix.os }}
|
|
needs:
|
|
- lint-job
|
|
- no-warnings-and-make-assets
|
|
- coverage
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
matrix:
|
|
go-version: [1.17.x]
|
|
os: [ubuntu-latest]
|
|
steps:
|
|
- name: Set up Go ${{ matrix.go-version }} on ${{ matrix.os }}
|
|
uses: actions/setup-go@v2
|
|
with:
|
|
go-version: ${{ matrix.go-version }}
|
|
id: go
|
|
|
|
- name: Check out code into the Go module directory
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Build on ${{ matrix.os }}
|
|
env:
|
|
GO111MODULE: on
|
|
GOOS: linux
|
|
run: |
|
|
make test-pkg
|
|
|
|
test-restapi-on-go:
|
|
name: Test Restapi on Go ${{ matrix.go-version }} and ${{ matrix.os }}
|
|
needs:
|
|
- lint-job
|
|
- no-warnings-and-make-assets
|
|
- coverage
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
matrix:
|
|
go-version: [1.17.x]
|
|
os: [ubuntu-latest]
|
|
steps:
|
|
- name: Set up Go ${{ matrix.go-version }} on ${{ matrix.os }}
|
|
uses: actions/setup-go@v2
|
|
with:
|
|
go-version: ${{ matrix.go-version }}
|
|
id: go
|
|
|
|
- name: Check out code into the Go module directory
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Build on ${{ matrix.os }}
|
|
env:
|
|
GO111MODULE: on
|
|
GOOS: linux
|
|
run: |
|
|
make test
|
|
|
|
integration-tests:
|
|
name: Integration Tests with Latest Distributed MinIO
|
|
needs:
|
|
- lint-job
|
|
- no-warnings-and-make-assets
|
|
- coverage
|
|
runs-on: ubuntu-latest
|
|
|
|
strategy:
|
|
matrix:
|
|
go-version: [1.17.x]
|
|
|
|
steps:
|
|
- name: Set up Go ${{ matrix.go-version }} on ${{ matrix.os }}
|
|
uses: actions/setup-go@v2
|
|
with:
|
|
go-version: ${{ matrix.go-version }}
|
|
id: go
|
|
|
|
- name: Check out code into the Go module directory
|
|
uses: actions/checkout@v2
|
|
|
|
# To build minio image, we need to clone the repository first
|
|
- name: clone https://github.com/minio/minio
|
|
uses: actions/checkout@master
|
|
with:
|
|
|
|
# Repository name with owner. For example, actions/checkout
|
|
# Default: ${{ github.repository }}
|
|
repository: minio/minio
|
|
|
|
# Relative path under $GITHUB_WORKSPACE to place the repository
|
|
# To have two repositories under the same test
|
|
path: 'minio_repository'
|
|
|
|
- name: Build on ${{ matrix.os }}
|
|
run: |
|
|
echo "The idea is to build minio image from downloaded repository";
|
|
cd $GITHUB_WORKSPACE/minio_repository;
|
|
echo "Get git version to build MinIO Image";
|
|
VERSION=`git rev-parse HEAD`;
|
|
echo $VERSION;
|
|
echo "Create minio image";
|
|
make docker VERSION=$VERSION;
|
|
echo "Jumping back to console repository to run the integration test"
|
|
cd $GITHUB_WORKSPACE;
|
|
echo "We are going to use the built image on test-integration";
|
|
VERSION="minio/minio:$VERSION";
|
|
echo $VERSION;
|
|
make test-integration MINIO_VERSION=$VERSION;
|
|
|
|
react-tests:
|
|
name: React Tests
|
|
needs:
|
|
- lint-job
|
|
- no-warnings-and-make-assets
|
|
- coverage
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- name: Install modules
|
|
working-directory: ./portal-ui
|
|
run: yarn
|
|
- name: Run tests
|
|
working-directory: ./portal-ui
|
|
run: yarn test
|
|
|
|
operator-tests:
|
|
name: Operator Tests
|
|
needs:
|
|
- lint-job
|
|
- no-warnings-and-make-assets
|
|
- coverage
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
matrix:
|
|
go-version: [ 1.17.x ]
|
|
os: [ ubuntu-latest ]
|
|
steps:
|
|
- name: Set up Go ${{ matrix.go-version }} on ${{ matrix.os }}
|
|
uses: actions/setup-go@v2
|
|
with:
|
|
go-version: ${{ matrix.go-version }}
|
|
id: go
|
|
- uses: actions/setup-node@v2
|
|
with:
|
|
node-version: '17'
|
|
- name: Check out code into the Go module directory
|
|
uses: actions/checkout@v2
|
|
- name: Check out operator as a nested repository
|
|
uses: actions/checkout@v2
|
|
with:
|
|
repository: minio/operator
|
|
path: operator
|
|
- uses: actions/cache@v2
|
|
with:
|
|
path: |
|
|
~/.cache/go-build
|
|
~/go/pkg/mod
|
|
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-go-
|
|
|
|
- name: Get yarn cache directory path
|
|
id: yarn-cache-dir-path
|
|
run: echo "::set-output name=dir::$(yarn cache dir)"
|
|
|
|
- uses: actions/cache@v2
|
|
id: yarn-cache
|
|
with:
|
|
path: |
|
|
${{ steps.yarn-cache-dir-path.outputs.dir }}
|
|
./portal-ui/node_modules/
|
|
./portal-ui/build/
|
|
key: ${{ runner.os }}-yarn-${{ hashFiles('./portal-ui/yarn.lock') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-yarn-
|
|
|
|
- name: Install Dependencies
|
|
if: steps.yarn-cache.outputs.cache-hit != 'true'
|
|
working-directory: ./
|
|
run: make assets
|
|
|
|
- name: Build Console on ${{ matrix.os }}
|
|
env:
|
|
GO111MODULE: on
|
|
GOOS: linux
|
|
run: |
|
|
make console
|
|
|
|
# Runs a set of commands using the runners shell
|
|
- name: Start Kind for Operator UI
|
|
run: |
|
|
"${GITHUB_WORKSPACE}/portal-ui/tests/scripts/operator.sh"
|
|
|
|
- name: Run TestCafe Tests
|
|
uses: DevExpress/testcafe-action@latest
|
|
with:
|
|
args: '"chrome:headless" portal-ui/tests/operator/ --skip-js-errors -c 3'
|
|
|
|
permissions:
|
|
name: Permissions Tests
|
|
needs:
|
|
- lint-job
|
|
- no-warnings-and-make-assets
|
|
- coverage
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
matrix:
|
|
go-version: [ 1.17.x ]
|
|
os: [ ubuntu-latest ]
|
|
steps:
|
|
- name: Set up Go ${{ matrix.go-version }} on ${{ matrix.os }}
|
|
uses: actions/setup-go@v2
|
|
with:
|
|
go-version: ${{ matrix.go-version }}
|
|
id: go
|
|
- uses: actions/setup-node@v2
|
|
with:
|
|
node-version: '17'
|
|
- name: Check out code into the Go module directory
|
|
uses: actions/checkout@v2
|
|
- uses: actions/cache@v2
|
|
with:
|
|
path: |
|
|
~/.cache/go-build
|
|
~/go/pkg/mod
|
|
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-go-
|
|
|
|
- name: Get yarn cache directory path
|
|
id: yarn-cache-dir-path
|
|
run: echo "::set-output name=dir::$(yarn cache dir)"
|
|
|
|
- uses: actions/cache@v2
|
|
id: yarn-cache
|
|
with:
|
|
path: |
|
|
${{ steps.yarn-cache-dir-path.outputs.dir }}
|
|
./portal-ui/node_modules/
|
|
./portal-ui/build/
|
|
key: ${{ runner.os }}-yarn-${{ hashFiles('./portal-ui/yarn.lock') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-yarn-
|
|
|
|
- name: Install Dependencies
|
|
if: steps.yarn-cache.outputs.cache-hit != 'true'
|
|
working-directory: ./
|
|
run: make assets
|
|
|
|
- name: Build Console on ${{ matrix.os }}
|
|
env:
|
|
GO111MODULE: on
|
|
GOOS: linux
|
|
run: |
|
|
make console
|
|
|
|
- name: Start Console, front-end app and initialize users/policies
|
|
run: |
|
|
(./console server) & (make initialize-permissions)
|
|
|
|
- name: Run TestCafe Tests
|
|
uses: DevExpress/testcafe-action@latest
|
|
with:
|
|
args: '"chrome:headless" portal-ui/tests/permissions/ --skip-js-errors -c 3'
|
|
|
|
- name: Clean up users & policies
|
|
run: |
|
|
make cleanup-permissions
|
|
|
|
coverage:
|
|
name: "Coverage Limit Check"
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
matrix:
|
|
go-version: [ 1.17.x ]
|
|
os: [ ubuntu-latest ]
|
|
steps:
|
|
- name: Set up Go ${{ matrix.go-version }} on ${{ matrix.os }}
|
|
uses: actions/setup-go@v2
|
|
with:
|
|
go-version: ${{ matrix.go-version }}
|
|
id: go
|
|
- uses: actions/setup-node@v2
|
|
with:
|
|
node-version: '17'
|
|
- name: Check out code into the Go module directory
|
|
uses: actions/checkout@v2
|
|
- name: Check out gocovmerge as a nested repository
|
|
uses: actions/checkout@v2
|
|
with:
|
|
repository: wadey/gocovmerge
|
|
path: gocovmerge
|
|
- uses: actions/cache@v2
|
|
with:
|
|
path: |
|
|
~/.cache/go-build
|
|
~/go/pkg/mod
|
|
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-go-
|
|
- name: Get coverage
|
|
run: |
|
|
cd restapi
|
|
go test -coverprofile=coverage.out
|
|
cd ../integration
|
|
go test -coverpkg=../restapi -c -tags testrunmain .
|
|
docker network create --subnet=173.18.0.0/29 mynet123
|
|
docker run -v /data1 -v /data2 -v /data3 -v /data4 --net=mynet123 -d --name minio --rm -p 9000:9000 "quay.io/minio/minio:latest" server /data{1...4}
|
|
docker run --net=mynet123 --ip=173.18.0.3 --name pgsqlcontainer --rm -p 5432:5432 -e POSTGRES_PASSWORD=password -d postgres
|
|
./integration.test -test.run "^Test*" -test.coverprofile=system.out
|
|
echo "change directory to gocovmerge"
|
|
cd ../gocovmerge
|
|
echo "download golang x tools"
|
|
go mod download golang.org/x/tools
|
|
echo "go mod tidy compat mode"
|
|
go mod tidy -compat=1.17
|
|
echo "go build gocoverage.go"
|
|
go build gocovmerge.go
|
|
echo "put together the outs for final coverage resolution"
|
|
./gocovmerge ../integration/system.out ../restapi/coverage.out > all.out
|
|
echo "grep to obtain the result"
|
|
go tool cover -func=all.out | grep total > tmp2
|
|
result=`cat tmp2 | awk 'END {print $3}'`
|
|
result=${result%\%}
|
|
echo "result:"
|
|
echo $result
|
|
threshold=40
|
|
if (( $(echo "$result > $threshold" |bc -l) )); then
|
|
echo "greater than threshold, passed!"
|
|
else
|
|
echo "smaller than threshold, failed!"
|
|
exit 1
|
|
fi
|