-
Notifications
You must be signed in to change notification settings - Fork 9
59 lines (59 loc) · 2.57 KB
/
scan-build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
---
name: Scan-build
on:
workflow_run:
workflows: ['format']
types:
- completed
jobs:
build:
runs-on: ubuntu-22.04
steps:
- name: Stop if format failed
if: ${{ github.event.workflow_run.conclusion != 'success' }}
run: |
echo ${{ github.event.workflow_run.conclusion }}
exit 1
- uses: bansan85/action-workflow_run-status@main
- uses: actions/checkout@v3
with:
submodules: recursive
ref: ${{ github.event.workflow_run.head_commit.id }}
- name: Install SSH key
if: ${{ github.event.workflow_run.head_branch == 'master' }}
uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.GITHUBCI_PRIVATE_KEY }}
known_hosts: localhost ssh-rsa ${{ secrets.GITHUBCI_KNOW_HOSTS }}
- name: Install clang
run: sudo apt-get install -yq clang-14 llvm-14 clang-tools-14
- name: Install 3rdparty
run: xargs -a config/apt-get.txt sudo apt-get install -yq
- name: cmake
run: |
mkdir build scan-build-output
scan-build-14 -o scan-build-output cmake -S . -B build -DCMAKE_C_COMPILER=/usr/bin/clang-14 -DCMAKE_CXX_COMPILER=/usr/bin/clang++-14 -DCMAKE_AR=/usr/bin/llvm-ar-14 -DCMAKE_RANLIB=/usr/bin/llvm-ranlib-14
scan-build-14 -o scan-build-output cmake --build build/ --target all --config Release
- name: Publish result
if: ${{ github.event.workflow_run.head_branch == 'master' }}
env:
COMMIT_MESSAGE: ${{ github.event.workflow_run.head_commit.message }}
run: |
eval `ssh-agent`
git clone --depth 1 ssh://[email protected]/bansan85/jessica-ci.git -b scan-build
rm -Rf jessica-ci/*
find scan-build-output -mindepth 2 -maxdepth 2 -exec cp -R {} jessica-ci \;
ssh-add ~/.ssh/id_rsa
gpg --version
gpg --quiet --batch --yes --decrypt --passphrase="${{ secrets.ENCRYPT_PASSWORD }}" --output .github/encrypted/github-ci-private.key .github/encrypted/github-ci-private.key.gpg
gpg --import .github/encrypted/github-ci-private.key
cd jessica-ci || exit 1
git config --global user.name "Github CI"
git config --global user.email "[email protected]"
git add .
if [ -n "$(git diff-index --name-only HEAD --)" ]; \
then \
git commit -S${{ secrets.GPG_KEY_ID }} -m "${COMMIT_MESSAGE//\"/\"\"}" -m "Update from bansan85/jessica@$GITHUB_SHA"; \
git push || { echo "Failure git push" && exit 1; } \
fi
cd .. || exit 1