Skip to content

Commit

Permalink
chore(CI): collect ci check data
Browse files Browse the repository at this point in the history
  collect ci check data

Log: 收集ci检查结果数据
  • Loading branch information
kuchune committed Sep 18, 2024
1 parent 3c1ef72 commit c90c820
Show file tree
Hide file tree
Showing 7 changed files with 57 additions and 564 deletions.
108 changes: 19 additions & 89 deletions .github/workflows/api-check.yml
Original file line number Diff line number Diff line change
@@ -1,96 +1,26 @@
name: Api Check
name: apiCheck
on: workflow_call


jobs:
Check-Api-Change:
runs-on: ubuntu-latest
outputs:
isFail: ${{ steps.check-api.outputs.isFail }}
steps:
- name: install tools
run: |
sudo apt-get install quilt -y
sudo apt-get install universal-ctags -y
- uses: actions/checkout@v4
with:
repository: kuchune/check-tools
sparse-checkout: |
apiCheck/deepin-abigail
apiCheck/fastFilesCompare.json
sparse-checkout-cone-mode: false
- run: mv apiCheck/* .
- name: download lastest code
uses: actions/checkout@v4
with:
path: baseCodeDir
- working-directory: ./baseCodeDir
run: |
if [ -d "debian/patches" ];then
if [ "`ls -A debian/patches`" != "" ];then
cp debian/patches . -fr
quilt push -a || true
fi
fi
- name: download new code
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
path: currentCodeDir
- working-directory: ./currentCodeDir
run: |
if [ -d "debian/patches" ];then
if [ "`ls -A debian/patches`" != "" ];then
cp debian/patches . -fr
quilt push -a || true
fi
fi
- name: check api
id: check-api
run: |
./deepin-abigail -c fastFilesCompare.json | tee api_check.txt
logMsg1='''
<details>
<summary>详情</summary>
```ruby
'''
logMsg2='''
```
</details>
'''
resultInfoMsg=$(cat api_check.txt)
detailUrl="https://github.com/reviews-team-test/infra-settings/blob/master/services/prow/config/jobs/images/api-check/readme.md"
logMsgHead="> [!WARNING]\n> [[API接口检查]]($detailUrl)\n- 检测到存在对外接口删除和修改;"
if [ -e 'api_check.txt' ];then
check_num=$(cat api_check.txt | grep -c '\[Chg_exprort_fun\|\[Del_export_fun' || true)
if [ $check_num -gt 0 ];then
echo "isFail=true" >> $GITHUB_OUTPUT
echo -e "${logMsgHead}${logMsg1}${resultInfoMsg}${logMsg2}" | tee comment.txt
exit 1
fi
fi
- name: upload artifact
if: always() && steps.check-api.outputs.isFail == 'true'
uses: actions/upload-artifact@v4
with:
name: api-check-comment
path: comment.txt
Post-Check:
api-check:
runs-on: ubuntu-latest
needs: Check-Api-Change
continue-on-error: true
if: needs.Check-Api-Change.outputs.isFail == 'true' && failure()
steps:
- name: download artifact
uses: actions/download-artifact@v4
with:
name: api-check-comment
- name: Comment PR
uses: thollander/actions-comment-pull-request@v2
- id: api-check
continue-on-error: true
uses: reviews-team-test/ci-check-action@api-check
- if: always() && hashFiles('comment.txt')
continue-on-error: true
uses: reviews-team-test/ci-check-action@post-check
with:
filePath: comment.txt
- name: Add Reviewers to Pull Request
uses: ryaugusta/pr-add-reviewers-action@v1
comment-file: comment.txt
reviewers: liujianqiang-niu
- if: always()
continue-on-error: true
uses: reviews-team-test/ci-check-action@send-data
with:
token: ${{ github.token }}
reviewers: liujianqiang-niu
testtype: "apiCheck"
status: ${{ steps.api-check.outputs.isFail == 'true' && '否' || '是' }}
result: ${{ steps.api-check.outputs.isFail == 'true' && '1' || '0' }}
- if: always() && steps.api-check.outputs.isFail == 'true'
run: exit 1

Check warning on line 26 in .github/workflows/api-check.yml

View workflow job for this annotation

GitHub Actions / validate-yaml

26:20 [new-line-at-end-of-file] no new line character at the end of file
77 changes: 0 additions & 77 deletions .github/workflows/debian-check-keys.yml

This file was deleted.

107 changes: 0 additions & 107 deletions .github/workflows/debian-check-post.yml

This file was deleted.

41 changes: 0 additions & 41 deletions .github/workflows/debian-check-prefix.yml

This file was deleted.

Loading

0 comments on commit c90c820

Please sign in to comment.