mirror of
https://gitee.com/johng/gf.git
synced 2024-11-29 18:57:44 +08:00
split ci workflow into two workflows for short (#3069)
This commit is contained in:
parent
b2bd12a371
commit
f8462b5218
0
.github/workflows/build_and_test.sh → .github/workflows/ci-main.sh
vendored
Executable file → Normal file
0
.github/workflows/build_and_test.sh → .github/workflows/ci-main.sh
vendored
Executable file → Normal file
@ -1,3 +1,4 @@
|
||||
# The main codes build and unit testing running workflow.
|
||||
name: GoFrame Main CI
|
||||
|
||||
|
||||
@ -183,9 +184,6 @@ jobs:
|
||||
- name: Start Consul Containers
|
||||
run: docker-compose -f ".github/workflows/consul/docker-compose.yml" up -d --build
|
||||
|
||||
# - name: Start Minikube
|
||||
# uses: medyagh/setup-minikube@master
|
||||
|
||||
- name: Setup Golang ${{ matrix.go-version }}
|
||||
uses: actions/setup-go@v4
|
||||
with:
|
||||
@ -197,11 +195,11 @@ jobs:
|
||||
|
||||
- name: Build & Test
|
||||
if: ${{ (github.event_name == 'push' && github.ref != 'refs/heads/master') || github.event_name == 'pull_request' }}
|
||||
run: bash .github/workflows/build_and_test.sh
|
||||
run: bash .github/workflows/ci-main.sh
|
||||
|
||||
- name: Build & Test & Coverage
|
||||
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
|
||||
run: bash .github/workflows/build_and_test.sh coverage
|
||||
run: bash .github/workflows/ci-main.sh coverage
|
||||
|
||||
- name: Stop Redis Cluster Containers
|
||||
run: docker-compose -f ".github/workflows/redis/docker-compose.yml" down
|
27
.github/workflows/ci-sub.sh
vendored
Normal file
27
.github/workflows/ci-sub.sh
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
coverage=$1
|
||||
|
||||
# find all path that contains go.mod.
|
||||
for file in `find . -name go.mod`; do
|
||||
dirpath=$(dirname $file)
|
||||
echo $dirpath
|
||||
|
||||
# package kuhecm needs golang >= v1.19
|
||||
if [ "kubecm" = $(basename $dirpath) ]; then
|
||||
if ! go version|grep -qE "go1.19|go1.[2-9][0-9]"; then
|
||||
echo "ignore kubecm as go version: $(go version)"
|
||||
continue 1
|
||||
fi
|
||||
else
|
||||
continue 1
|
||||
fi
|
||||
|
||||
cd $dirpath
|
||||
|
||||
go mod tidy
|
||||
go build ./...
|
||||
go test ./... -race || exit 1
|
||||
|
||||
cd -
|
||||
done
|
67
.github/workflows/ci-sub.yml
vendored
Normal file
67
.github/workflows/ci-sub.yml
vendored
Normal file
@ -0,0 +1,67 @@
|
||||
# The sub codes build and unit testing running workflow.
|
||||
# It maintains the ci of unimportant packages.
|
||||
name: GoFrame Sub CI
|
||||
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- develop
|
||||
- personal/**
|
||||
- feature/**
|
||||
- enhance/**
|
||||
- fix/**
|
||||
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
- develop
|
||||
- personal/**
|
||||
- feature/**
|
||||
- enhance/**
|
||||
- fix/**
|
||||
|
||||
# This allows a subsequently queued workflow run to interrupt previous runs
|
||||
concurrency:
|
||||
group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}'
|
||||
cancel-in-progress: true
|
||||
|
||||
env:
|
||||
TZ: "Asia/Shanghai"
|
||||
|
||||
|
||||
jobs:
|
||||
code-test:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
go-version: [ "1.18", "1.19", "1.20", "1.21" ]
|
||||
goarch: [ "386", "amd64" ]
|
||||
|
||||
steps:
|
||||
- name: Setup Timezone
|
||||
uses: szenius/set-timezone@v1.1
|
||||
with:
|
||||
timezoneLinux: "Asia/Shanghai"
|
||||
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Start Minikube
|
||||
uses: medyagh/setup-minikube@master
|
||||
|
||||
- name: Setup Golang ${{ matrix.go-version }}
|
||||
uses: actions/setup-go@v4
|
||||
with:
|
||||
go-version: ${{ matrix.go-version }}
|
||||
cache-dependency-path: '**/go.sum'
|
||||
|
||||
- name: Before Script
|
||||
run: bash .github/workflows/before_script.sh
|
||||
|
||||
- name: Build & Test
|
||||
run: bash .github/workflows/ci-sub.sh
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
name: GoFrame CLI Build Release
|
||||
name: GoFrame Release
|
||||
|
||||
on:
|
||||
push:
|
Loading…
Reference in New Issue
Block a user