Skip to content

Commit 1f74753

Browse files
authored
Add coverity scan action and Update gitee mirror action (swoole#4020)
1 parent b74d5d4 commit 1f74753

File tree

2 files changed

+61
-4
lines changed

2 files changed

+61
-4
lines changed

.github/workflows/coverity.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: coverity-scan
2+
3+
on:
4+
push:
5+
branches:
6+
- coverity_scan
7+
8+
env:
9+
COVERITY_SCAN_TOKEN: ${{ secrets.COVERITY_SCAN_TOKEN }}
10+
COVERITY_SCAN_EMAIL: team@swoole.com
11+
COVERITY_PROJECT: ${{ github.repository }}
12+
COV_TOOLS_DIR: ${{ github.workspace }}/cov-analysis-linux64
13+
COV_BUILD_DIR: ${{ github.workspace }}
14+
COV_RESULTS_DIR: cov-int
15+
COV_RESULTS_FILE: analysis-results.tgz
16+
17+
jobs:
18+
coverity-scan:
19+
if: github.repository_owner == 'swoole'
20+
runs-on: ubuntu-latest
21+
steps:
22+
- uses: actions/checkout@v1
23+
- name: Setup PHP
24+
uses: shivammathur/setup-php@v2
25+
with:
26+
php-version: "7.4"
27+
28+
- name: Download and install Coverity Build Tool
29+
run: |
30+
wget -q https://scan.coverity.com/download/linux64 \
31+
--post-data "token=${COVERITY_SCAN_TOKEN}&project=${COVERITY_PROJECT}" \
32+
-O cov-analysis-linux64.tar.gz
33+
mkdir ${COV_TOOLS_DIR}
34+
tar xzf cov-analysis-linux64.tar.gz --strip 1 -C ${COV_TOOLS_DIR}
35+
ls -la ${COV_TOOLS_DIR}/bin
36+
37+
- name: Run build steps
38+
run: |
39+
sudo phpize && ./configure
40+
41+
- name: Run Coverity Scan Analysis Tool
42+
run: |
43+
export PATH=${COV_TOOLS_DIR}/bin:$PATH
44+
cd ${COV_BUILD_DIR}
45+
cov-build --dir ${COV_RESULTS_DIR} make -j 4
46+
47+
- name: Upload Coverity Scan Analysis results
48+
run: |
49+
cd ${COV_BUILD_DIR}
50+
tar czf ${COV_RESULTS_FILE} ${COV_RESULTS_DIR}
51+
curl \
52+
--form project=${COVERITY_PROJECT} \
53+
--form token=${COVERITY_SCAN_TOKEN} \
54+
--form email=${COVERITY_SCAN_EMAIL} \
55+
--form file=@${COV_RESULTS_FILE} \
56+
--form version=${GITHUB_SHA} \
57+
--form description="GitHub Actions" \
58+
https://scan.coverity.com/builds?project=${COVERITY_PROJECT}

.github/workflows/gitee.yml renamed to .github/workflows/mirror.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
name: Mirror to Gitee Repo
1+
name: mirror
22

33
on: [ push, delete, create ]
44

55
jobs:
6-
git-mirror:
6+
gitee:
7+
if: github.repository_owner == 'swoole'
78
runs-on: ubuntu-latest
89
steps:
910
- name: Configure Private Key
10-
if: github.repository_owner == 'swoole'
1111
env:
1212
SSH_PRIVATE_KEY: ${{ secrets.GITEE_PRIVATE_KEY }}
1313
run: |
@@ -17,7 +17,6 @@ jobs:
1717
echo "StrictHostKeyChecking no" >> ~/.ssh/config
1818
1919
- name: Push Mirror
20-
if: github.repository_owner == 'swoole'
2120
env:
2221
SOURCE_REPO: 'https://github.com/swoole/swoole-src.git'
2322
DESTINATION_REPO: 'git@gitee.com:swoole/swoole.git'

0 commit comments

Comments
 (0)