Skip to content

Commit

Permalink
Merge branch 'sync_github' into 'dev'
Browse files Browse the repository at this point in the history
sync dev branch to github after test job pass

See merge request maix_sw/k230_canmv!178
  • Loading branch information
wuwentao committed Jan 31, 2024
2 parents 247f73f + 60daed9 commit 2aa4a5d
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 25 deletions.
11 changes: 9 additions & 2 deletions .github/workflows/release.yml
Expand Up @@ -3,6 +3,13 @@ name: K230 CanMV Release
on:
release:
types: [released]
push:
branches:
- dev
pull_request:
branches:
- main
- dev

defaults:
run:
Expand Down Expand Up @@ -42,7 +49,7 @@ jobs:
with:
fetch-depth: 0
clean: true
submodules: true
submodules: recursive

- name: Download Toolchain and Setup Build Env
run: |
Expand Down Expand Up @@ -102,6 +109,7 @@ jobs:
upload_release:
needs: build_image
name: Release
if: ${{ startsWith(github.ref, 'refs/tags/') }}
runs-on: ubuntu-latest
steps:

Expand All @@ -120,7 +128,6 @@ jobs:
pwd
ls -alht
ls -alht artifacts || exit 0
shell: bash
- name: Upload images to Release Asset
uses: softprops/action-gh-release@v1
Expand Down
58 changes: 35 additions & 23 deletions .gitlab-ci.yml
Expand Up @@ -26,18 +26,33 @@ stages:
- send_msg

# MR merged
push_sync:
main_release:
stage: publish
rules:
- if: $CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH == "main"
variables:
BRANCH: main
extends:
- .sync_github_gitee

# tag push
tag_sync:
tag_release:
stage: publish
rules:
- if: $CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_TAG =~ /^v\d+\.\d+.*$/
variables:
BRANCH: main
extends:
- .sync_github_gitee

# schedule daily build sync
dev_release:
stage: publish
rules:
# daily build
- if: $CI_PIPELINE_SOURCE == "schedule"
variables:
BRANCH: dev
extends:
- .sync_github_gitee

Expand All @@ -50,11 +65,11 @@ tag_sync:
- git clone ${GITLAB_REPO} k230_canmv || exit 1
- cd k230_canmv || exit 1
- pwd
- git checkout main
- git checkout ${BRANCH}
- git branch -a
- git status
- echo '---pull latest main branch---'
- git pull origin main
- echo '---pull latest ${BRANCH} branch---'
- git pull origin ${BRANCH}
- echo '---fetch all tags---'
- git fetch --tags
- git remote add github ${GITHUB_REPO}
Expand All @@ -63,9 +78,9 @@ tag_sync:
- git branch -a
- git status
- echo "---push to gitee---"
- git push --atomic --tags -u -f gitee main || git push --atomic --tags -u -f gitee main
- git push --atomic --tags -u -f gitee ${BRANCH} || git push --atomic --tags -u -f gitee ${BRANCH} || git push --atomic --tags -u -f gitee ${BRANCH}
- echo "---push to github---"
- git push --atomic --tags -u -f github main || git push --atomic --tags -u -f github main || git push --atomic --tags -u -f github main
- git push --atomic --tags -u -f github ${BRANCH} || git push --atomic --tags -u -f github ${BRANCH} || git push --atomic --tags -u -f github ${BRANCH}

.show_vars: &show_vars
- echo "${JOB_TYPE}"
Expand Down Expand Up @@ -557,18 +572,19 @@ tag_sync:
- test -f $NFS_CASE_FOLDER/${TEST_ENV}.yml || exit 1
smoke_test:
- echo "----------Run Smoke Test start----------"
- test -d bin || mkdir ./bin
- test -f ./bin/airobot && rm -rf ./bin/airobot
- wget -qc https://ai.b-bug.org/k230/test_resources/ci/tools/airobot -O ./bin/airobot
- chmod +x ./bin/airobot
- echo "---add test script"
- test -d k230_canmv_testscripts || git clone ${TEST_SCRIPTS_REPO} k230_canmv_testscripts || exit 1
- cd k230_canmv_testscripts || exit 1
- git fetch origin main || exit 1
- git checkout main || exit 1
- cd ../ || exit 1
- pwd
- test -d bin || mkdir ./bin
- test -f ./bin/airobot && rm -rf ./bin/airobot
- wget -qc https://ai.b-bug.org/k230/test_resources/ci/tools/airobot -O ./bin/airobot
- chmod +x ./bin/airobot
- wget -qc https://ai.b-bug.org/k230/test_resources/ci/testscripts/k230_canmv_smoke_test.sh -O ./k230_canmv_smoke_test.sh
- chmod +x ./k230_canmv_smoke_test.sh
- ls -alht
- |
echo "---start to run k230 canmv smoke test in for loop"
stime=$(date +'%Y-%m-%d %H:%M:%S')
Expand Down Expand Up @@ -607,16 +623,15 @@ tag_sync:
- echo "----------Run Smoke Test pass----------"
daily_test:
- echo "----------Run Daily Test start----------"
- test -d bin || mkdir ./bin
- test -f ./bin/airobot && rm -rf ./bin/airobot
- wget -qc https://ai.b-bug.org/k230/test_resources/ci/tools/airobot -O ./bin/airobot
- chmod +x ./bin/airobot
- echo "---add test script"
- test -d k230_canmv_testscripts || git clone ${TEST_SCRIPTS_REPO} k230_canmv_testscripts || exit 1
- cd k230_canmv_testscripts || exit 1
- git fetch origin main || exit 1
- git checkout main || exit 1
- cd ../ || exit 1
- test -d bin || mkdir ./bin
- test -f ./bin/airobot && rm -rf ./bin/airobot
- wget -qc https://ai.b-bug.org/k230/test_resources/ci/tools/airobot -O ./bin/airobot
- chmod +x ./bin/airobot
- wget -qc https://ai.b-bug.org/k230/test_resources/ci/testscripts/k230_canmv_daily_test.sh -O ./k230_canmv_daily_test.sh
- chmod +x ./k230_canmv_daily_test.sh
- |
Expand Down Expand Up @@ -788,9 +803,6 @@ load_image_smoke_test:

# daily build test
daily_build_test:
image: ai.b-bug.org:5000/k230_testscripts:latest
tags:
- k230_testscripts
stage: test
rules:
# release job
Expand All @@ -801,7 +813,7 @@ daily_build_test:
- if: $CI_PIPELINE_SOURCE == "web" && $CI_COMMIT_TAG !~ /^v\d+\.\d+.*$/
# daily build
- if: $CI_PIPELINE_SOURCE == "schedule"
timeout: 180m
timeout: 300m
variables:
TEST_ENV: ai
script:
Expand Down Expand Up @@ -851,8 +863,8 @@ dev_to_main:
- ./k230_canmv_release canmv $RELEASE_TAG "k230 canmv release $RELEASE_TAG" || exit 1
- echo "----------sync dev to main branch pass for canmv repo----------"

# senf feishu msg
senf_feishu_msg:
# send feishu msg
send_feishu_msg:
stage: send_msg
rules:
# release job
Expand Down

0 comments on commit 2aa4a5d

Please sign in to comment.