Skip to content

Merge pull request #1562 from jumormt/fix #596

Merge pull request #1562 from jumormt/fix

Merge pull request #1562 from jumormt/fix #596

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}}