forked from SVF-tools/SVF
-
Notifications
You must be signed in to change notification settings - Fork 1
157 lines (149 loc) · 6.4 KB
/
svf-lib_publish.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
name: svf-publish
# Triggers the publish workflow only on master
on:
push:
branches: [ master ]
# Customize the env variable
env:
SVF_CTIR: 1
SVF_Z3: 1
SVF_DIR: $GITHUB_WORKSPACE
jobs:
publish:
if: github.repository == 'SVF-tools/SVF'
runs-on: ${{ matrix.os }}
env:
XCODE_VERSION: '15.3.0' # Define Xcode version here to reuse it
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
steps:
# checkout the repo
- uses: actions/checkout@v2
# setup the environment
- name: mac-setup
if: runner.os == 'macOS'
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: ${{ env.XCODE_VERSION }}
- name: mac-setup-workaround
if: runner.os == 'macOS'
run: |
ln -sfn /Applications/Xcode_${{ env.XCODE_VERSION }}.app /Applications/Xcode.app
brew install astyle
- name: ubuntu-setup
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install cmake gcc g++ nodejs doxygen graphviz libncurses5-dev libtinfo5 libzstd-dev
sudo apt-get update
sudo apt-get install -y astyle
- name: env-setup
if: github.event_name == 'push' && github.repository == 'SVF-tools/SVF'
run: |
echo $RUNNER_OS
git config --global user.email ${{secrets.npm_email}}
git config --global user.name "GitHub Actions Build"
# code-format and build-svf
- name: code-format-and-build-svf
run: |
cd $GITHUB_WORKSPACE
echo $(pwd)
git pull
astyle --style=allman -n -r "*.h" "*.cpp"
if [ ! -z $FILES_CHANGED ]; then clang-format -i $FILES_CHANGED; fi
git clone "https://github.com/SVF-tools/Test-Suite.git";
source ${{github.workspace}}/build.sh
# update formatting code and doxygen
- name: update-formatting-code-and-doxygen
if: |
github.event_name == 'push' &&
github.repository == 'SVF-tools/SVF' &&
runner.os == 'Linux' &&
github.ref == 'refs/heads/master'
run: |
cd $GITHUB_WORKSPACE
echo $(pwd)
git status
git add .
if [ -n "$(git status -s)" ]; then git commit -m"SVF code formatter"; fi
git push https://yuleisui:${{secrets.yulei_git_key}}@github.com/SVF-tools/SVF.git HEAD:master
cd $GITHUB_WORKSPACE/docs && doxygen doxygen.config
cd $GITHUB_WORKSPACE && git clone https://github.com/SVF-tools/SVF-doxygen.git
cp -r $GITHUB_WORKSPACE/docs/generated-doc/html $GITHUB_WORKSPACE/SVF-doxygen/
cd $GITHUB_WORKSPACE/SVF-doxygen
git add .
if [ -n "$(git status -s)" ]; then git commit -m"update SVF doxygen" ; fi
git push https://yuleisui:${{secrets.yulei_git_key}}@github.com/SVF-tools/SVF-doxygen.git HEAD:master
# update performance testing to Test-Suite
- name: upload-performance-testing-to-Test-Suite
working-directory: ${{github.workspace}}/Release-build
if: |
github.event_name == 'push' &&
github.repository == 'SVF-tools/SVF' &&
runner.os == 'Linux' &&
github.ref == 'refs/heads/master'
run: |
ctest -R diff-perf-cruxbc -VV
git pull
cp -r ${{github.workspace}}/Release-build/Testing/Temporary/LastTest.log $GITHUB_WORKSPACE/Test-Suite/diff_tests/perf_history/perf-$(date +'%Y-%m-%dT%H:%M:%S').txt
cp -r ${{github.workspace}}/Release-build/Testing/Temporary/LastTest.log $GITHUB_WORKSPACE/Test-Suite/diff_tests/perf-latest.txt
cd $GITHUB_WORKSPACE/Test-Suite/diff_tests
git add .
if [ -n "$(git status -s)" ]; then git commit -m"update latest SVF performance data" ; fi
git push https://yuleisui:${{secrets.yulei_git_key}}@github.com/SVF-tools/Test-Suite.git HEAD:master
# update-svf-lib
- name: update-svf-lib
if: |
github.event_name == 'push' &&
github.repository == 'SVF-tools/SVF' &&
github.ref == 'refs/heads/master'
run: |
cd $GITHUB_WORKSPACE/..
git clone https://github.com/SVF-tools/SVF-npm.git
if [ "$RUNNER_OS" == "Linux" ]; then export osVersion="linux"; fi
if [ "$RUNNER_OS" == "macOS" ]; then export osVersion="osx"; fi
echo $osVersion
cd ./SVF-npm
git fetch origin
git rebase origin/master
rm -rf SVF-${osVersion}/*
git rm --cached -rf SVF-${osVersion}/*
if [ ! -d "SVF-${osVersion}/Release-build/" ]; then mkdir -p "SVF-${osVersion}/Release-build"; fi
rm -rf $GITHUB_WORKSPACE/Release-build/bin/*.dot
rm -rf $GITHUB_WORKSPACE/Release-build/bin/*.json
cp -rf $GITHUB_WORKSPACE/Release-build/include SVF-${osVersion}/Release-build/
cp -rf $GITHUB_WORKSPACE/svf/include SVF-${osVersion}/Release-build/
cp -rf $GITHUB_WORKSPACE/svf-llvm/include SVF-${osVersion}/Release-build/
cp -rf $GITHUB_WORKSPACE/Release-build/lib SVF-${osVersion}/Release-build/
cp -rf $GITHUB_WORKSPACE/Release-build/bin SVF-${osVersion}/Release-build/
git add .
if [ -n "$(git status -s)" ]; then git commit -m'Update svflib' ; fi
npm version patch
git push https://yuleisui:${{secrets.yulei_git_key}}@github.com/SVF-tools/SVF-npm.git HEAD:master
cd $GITHUB_WORKSPACE
# publish svf
- uses: actions/setup-node@v3
with:
node-version: 18
registry-url: https://registry.npmjs.org/
- name: publish-svf
if: |
github.event_name == 'push' &&
github.repository == 'SVF-tools/SVF' &&
runner.os == 'Linux' &&
github.ref == 'refs/heads/master'
run: |
cd $GITHUB_WORKSPACE
echo $(pwd)
git stash --all
npm_version=`npm v svf-tools version`
sed -i '/version/s/[^:]*$/'"\"${npm_version}\",/" package.json
git add .
if [ -n "$(git status -s)" ]; then git commit -m'update version' ; fi
npm version patch
npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.npm_token}}