mirror of
https://github.com/LongSoft/UEFITool.git
synced 2024-11-22 16:08:23 +08:00
Run Coverity in Linux with Qt6, improve unixbuild.sh
This commit is contained in:
parent
67c568daf8
commit
e5b594c347
64
.github/workflows/main.yml
vendored
64
.github/workflows/main.yml
vendored
@ -1,4 +1,4 @@
|
|||||||
name: CI
|
name: CI/CD
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
@ -11,14 +11,32 @@ jobs:
|
|||||||
build_mac:
|
build_mac:
|
||||||
name: Build on macOS
|
name: Build on macOS
|
||||||
runs-on: macos-12
|
runs-on: macos-12
|
||||||
|
env:
|
||||||
|
HAS_QT: 1
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- run: ./unixbuild.sh
|
|
||||||
|
- name: Get Qt
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
repository: LongSoft/qt-5.6.3-static-universal-macos-sdk12.3
|
||||||
|
path: qt
|
||||||
|
lfs: true
|
||||||
|
|
||||||
|
- name: Unpack Qt
|
||||||
|
shell: bash
|
||||||
|
working-directory: qt
|
||||||
|
run: sudo unzip -q qt-5.6.3-static-universal-macos-sdk12.3.zip -d/opt && echo "/opt/qt56sm/bin" >> $GITHUB_PATH
|
||||||
|
|
||||||
|
- name: Build everything
|
||||||
|
run: ./unixbuild.sh
|
||||||
|
|
||||||
- name: Upload to artifacts
|
- name: Upload to artifacts
|
||||||
uses: actions/upload-artifact@v2
|
uses: actions/upload-artifact@v2
|
||||||
with:
|
with:
|
||||||
name: macOS builds
|
name: macOS builds
|
||||||
path: dist/*.zip
|
path: dist/*.zip
|
||||||
|
|
||||||
- name: Upload to releases
|
- name: Upload to releases
|
||||||
if: github.event_name == 'release'
|
if: github.event_name == 'release'
|
||||||
uses: svenstaro/upload-release-action@e74ff71f7d8a4c4745b560a485cc5fdb9b5b999d
|
uses: svenstaro/upload-release-action@e74ff71f7d8a4c4745b560a485cc5fdb9b5b999d
|
||||||
@ -30,17 +48,24 @@ jobs:
|
|||||||
|
|
||||||
build_linux:
|
build_linux:
|
||||||
name: Build on Linux
|
name: Build on Linux
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-20.04
|
||||||
|
env:
|
||||||
|
HAS_QT: 1
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
- name: Get Qt
|
- name: Get Qt
|
||||||
run: sudo apt-get install -qq qt5-default qt5-qmake qtbase5-dev-tools cmake
|
run: sudo apt-get install -qq qt5-default qt5-qmake qtbase5-dev-tools cmake
|
||||||
- run: ./unixbuild.sh
|
|
||||||
|
- name: Build everything
|
||||||
|
run: ./unixbuild.sh
|
||||||
|
|
||||||
- name: Upload to artifacts
|
- name: Upload to artifacts
|
||||||
uses: actions/upload-artifact@v2
|
uses: actions/upload-artifact@v2
|
||||||
with:
|
with:
|
||||||
name: Linux builds
|
name: Linux builds
|
||||||
path: dist/*.zip
|
path: dist/*.zip
|
||||||
|
|
||||||
- name: Upload to releases
|
- name: Upload to releases
|
||||||
if: github.event_name == 'release'
|
if: github.event_name == 'release'
|
||||||
uses: svenstaro/upload-release-action@e74ff71f7d8a4c4745b560a485cc5fdb9b5b999d
|
uses: svenstaro/upload-release-action@e74ff71f7d8a4c4745b560a485cc5fdb9b5b999d
|
||||||
@ -50,7 +75,7 @@ jobs:
|
|||||||
tag: ${{ github.ref }}
|
tag: ${{ github.ref }}
|
||||||
file_glob: true
|
file_glob: true
|
||||||
|
|
||||||
build_win_extract:
|
build_win:
|
||||||
name: Build on Windows
|
name: Build on Windows
|
||||||
runs-on: windows-2019
|
runs-on: windows-2019
|
||||||
steps:
|
steps:
|
||||||
@ -62,24 +87,29 @@ jobs:
|
|||||||
repository: LongSoft/qt-5.6.3-static-x86-msvc2017
|
repository: LongSoft/qt-5.6.3-static-x86-msvc2017
|
||||||
path: qt
|
path: qt
|
||||||
lfs: true
|
lfs: true
|
||||||
|
|
||||||
- name: Unpack Qt
|
- name: Unpack Qt
|
||||||
shell: bash
|
shell: bash
|
||||||
working-directory: qt
|
working-directory: qt
|
||||||
run: 7z x qt-5.6.3-static-x86-msvc2017.7z -o../..
|
run: 7z x qt-5.6.3-static-x86-msvc2017.7z -o../..
|
||||||
|
|
||||||
- name: Create dist directory
|
- name: Create dist directory
|
||||||
shell: bash
|
shell: bash
|
||||||
run: mkdir dist
|
run: mkdir dist
|
||||||
|
|
||||||
- name: Create UEFIExtract build directory
|
- name: Create UEFIExtract build directory
|
||||||
run: cmake -E make_directory ${{runner.workspace}}/build/UEFIExtract
|
run: cmake -E make_directory ${{runner.workspace}}/build/UEFIExtract
|
||||||
|
|
||||||
- name: Configure UEFIExtract
|
- name: Configure UEFIExtract
|
||||||
shell: bash
|
shell: bash
|
||||||
working-directory: ${{runner.workspace}}/build/UEFIExtract
|
working-directory: ${{runner.workspace}}/build/UEFIExtract
|
||||||
run: cmake -G "Visual Studio 16 2019" -T "v141_xp" -DU_STATIC_RT=YES ../../UEFITool/UEFIExtract/
|
run: cmake -G "Visual Studio 16 2019" -T "v141_xp" -DU_STATIC_RT=YES ../../UEFITool/UEFIExtract/
|
||||||
|
|
||||||
- name: Build UEFIExtract
|
- name: Build UEFIExtract
|
||||||
working-directory: ${{runner.workspace}}/build/UEFIExtract
|
working-directory: ${{runner.workspace}}/build/UEFIExtract
|
||||||
shell: bash
|
shell: bash
|
||||||
run: cmake --build . --config Release
|
run: cmake --build . --config Release
|
||||||
|
|
||||||
- name: Archive UEFIExtract
|
- name: Archive UEFIExtract
|
||||||
working-directory: ${{runner.workspace}}/build/UEFIExtract/Release
|
working-directory: ${{runner.workspace}}/build/UEFIExtract/Release
|
||||||
shell: bash
|
shell: bash
|
||||||
@ -89,14 +119,17 @@ jobs:
|
|||||||
|
|
||||||
- name: Create UEFIFind build directory
|
- name: Create UEFIFind build directory
|
||||||
run: cmake -E make_directory ${{runner.workspace}}/build/UEFIFind
|
run: cmake -E make_directory ${{runner.workspace}}/build/UEFIFind
|
||||||
|
|
||||||
- name: Configure UEFIFind
|
- name: Configure UEFIFind
|
||||||
shell: bash
|
shell: bash
|
||||||
working-directory: ${{runner.workspace}}/build/UEFIFind
|
working-directory: ${{runner.workspace}}/build/UEFIFind
|
||||||
run: cmake -G "Visual Studio 16 2019" -T "v141_xp" -DU_STATIC_RT=YES ../../UEFITool/UEFIFind/
|
run: cmake -G "Visual Studio 16 2019" -T "v141_xp" -DU_STATIC_RT=YES ../../UEFITool/UEFIFind/
|
||||||
|
|
||||||
- name: Build UEFIFind
|
- name: Build UEFIFind
|
||||||
working-directory: ${{runner.workspace}}/build/UEFIFind
|
working-directory: ${{runner.workspace}}/build/UEFIFind
|
||||||
shell: bash
|
shell: bash
|
||||||
run: cmake --build . --config Release
|
run: cmake --build . --config Release
|
||||||
|
|
||||||
- name: Archive UEFIFind
|
- name: Archive UEFIFind
|
||||||
working-directory: ${{runner.workspace}}/build/UEFIFind/Release
|
working-directory: ${{runner.workspace}}/build/UEFIFind/Release
|
||||||
shell: bash
|
shell: bash
|
||||||
@ -106,16 +139,19 @@ jobs:
|
|||||||
|
|
||||||
- name: Create UEFITool build directory
|
- name: Create UEFITool build directory
|
||||||
run: cmake -E make_directory ${{runner.workspace}}/build/UEFITool
|
run: cmake -E make_directory ${{runner.workspace}}/build/UEFITool
|
||||||
|
|
||||||
- name: Configure UEFITool
|
- name: Configure UEFITool
|
||||||
shell: bash
|
shell: bash
|
||||||
working-directory: ${{runner.workspace}}/build/UEFITool
|
working-directory: ${{runner.workspace}}/build/UEFITool
|
||||||
run: ../../qt-5.6.3-static-x86-msvc2017/bin/qmake.exe ../../UEFITool/UEFITool/
|
run: ../../qt-5.6.3-static-x86-msvc2017/bin/qmake.exe ../../UEFITool/UEFITool/
|
||||||
|
|
||||||
- name: Build UEFITool
|
- name: Build UEFITool
|
||||||
working-directory: ${{runner.workspace}}/build/UEFITool
|
working-directory: ${{runner.workspace}}/build/UEFITool
|
||||||
shell: cmd
|
shell: cmd
|
||||||
run: |
|
run: |
|
||||||
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars32.bat"
|
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars32.bat"
|
||||||
nmake release
|
nmake release
|
||||||
|
|
||||||
- name: Archive UEFITool
|
- name: Archive UEFITool
|
||||||
working-directory: ${{runner.workspace}}/build/UEFITool/release
|
working-directory: ${{runner.workspace}}/build/UEFITool/release
|
||||||
shell: bash
|
shell: bash
|
||||||
@ -128,7 +164,8 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
name: Windows builds
|
name: Windows builds
|
||||||
path: dist/*.zip
|
path: dist/*.zip
|
||||||
- name: Windows to releases
|
|
||||||
|
- name: Upload to releases
|
||||||
if: github.event_name == 'release'
|
if: github.event_name == 'release'
|
||||||
uses: svenstaro/upload-release-action@e74ff71f7d8a4c4745b560a485cc5fdb9b5b999d
|
uses: svenstaro/upload-release-action@e74ff71f7d8a4c4745b560a485cc5fdb9b5b999d
|
||||||
with:
|
with:
|
||||||
@ -141,18 +178,27 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
PROJECT_TYPE: TOOL
|
PROJECT_TYPE: TOOL
|
||||||
JOB_TYPE: COVERITY
|
JOB_TYPE: COVERITY
|
||||||
|
HAS_QT: 1
|
||||||
if: github.repository_owner == 'LongSoft' && github.event_name != 'pull_request'
|
if: github.repository_owner == 'LongSoft' && github.event_name != 'pull_request'
|
||||||
name: Analyze Coverity
|
name: Coverity
|
||||||
runs-on: macos-12
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
|
- name: Install Qt
|
||||||
|
uses: jurplel/install-qt-action@v3
|
||||||
|
with:
|
||||||
|
version: '6.4.0'
|
||||||
|
host: 'linux'
|
||||||
|
target: 'desktop'
|
||||||
|
|
||||||
- name: CI Bootstrap
|
- name: CI Bootstrap
|
||||||
run: |
|
run: |
|
||||||
src=$(/usr/bin/curl -Lfs https://raw.githubusercontent.com/acidanthera/ocbuild/master/ci-bootstrap.sh) && eval "$src" || exit 1
|
src=$(/usr/bin/curl -Lfs https://raw.githubusercontent.com/acidanthera/ocbuild/master/ci-bootstrap.sh) && eval "$src" || exit 1
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- run: ./unixbuild.sh --configure
|
- run: ./unixbuild.sh --configure
|
||||||
|
|
||||||
- name: Run Coverity
|
- name: Run Coverity
|
||||||
run: |
|
run: |
|
||||||
src=$(/usr/bin/curl -Lfs https://raw.githubusercontent.com/acidanthera/ocbuild/master/coverity/covstrap.sh) && eval "$src" || exit 1
|
src=$(/usr/bin/curl -Lfs https://raw.githubusercontent.com/acidanthera/ocbuild/master/coverity/covstrap-linux.sh) && eval "$src" || exit 1
|
||||||
env:
|
env:
|
||||||
COVERITY_SCAN_TOKEN: ${{ secrets.COVERITY_SCAN_TOKEN }}
|
COVERITY_SCAN_TOKEN: ${{ secrets.COVERITY_SCAN_TOKEN }}
|
||||||
COVERITY_SCAN_EMAIL: ${{ secrets.COVERITY_SCAN_EMAIL }}
|
COVERITY_SCAN_EMAIL: ${{ secrets.COVERITY_SCAN_EMAIL }}
|
||||||
|
39
unixbuild.sh
39
unixbuild.sh
@ -9,6 +9,7 @@ elif [ "$1" = "--build" ]; then
|
|||||||
export PRECONFIGURED=1
|
export PRECONFIGURED=1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Determine platform
|
||||||
if [ "$UTARGET" = "Darwin" ]; then
|
if [ "$UTARGET" = "Darwin" ]; then
|
||||||
export UPLATFORM="mac"
|
export UPLATFORM="mac"
|
||||||
elif [ "$UTARGET" = "Linux" ]; then
|
elif [ "$UTARGET" = "Linux" ]; then
|
||||||
@ -21,7 +22,10 @@ else
|
|||||||
export UPLATFORM="$UTARGET"
|
export UPLATFORM="$UTARGET"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$UPLATFORM" = "mac" ]; then
|
# Obtain Qt
|
||||||
|
if [ "$HAS_QT" != "" ]; then
|
||||||
|
echo "Using externally supplied Qt"
|
||||||
|
elif [ "$UPLATFORM" = "mac" ]; then
|
||||||
if [ ! -d /opt/qt56sm ]; then
|
if [ ! -d /opt/qt56sm ]; then
|
||||||
curl -L -o /tmp/qt-5.6.3-static-universal-macos-sdk12.3.zip https://github.com/LongSoft/qt-5.6.3-static-universal-macos-sdk12.3/blob/main/qt-5.6.3-static-universal-macos-sdk12.3.zip?raw=true || exit 1
|
curl -L -o /tmp/qt-5.6.3-static-universal-macos-sdk12.3.zip https://github.com/LongSoft/qt-5.6.3-static-universal-macos-sdk12.3/blob/main/qt-5.6.3-static-universal-macos-sdk12.3.zip?raw=true || exit 1
|
||||||
qtsum=$(shasum -a 256 /tmp/qt-5.6.3-static-universal-macos-sdk12.3.zip | cut -f1 -d' ')
|
qtsum=$(shasum -a 256 /tmp/qt-5.6.3-static-universal-macos-sdk12.3.zip | cut -f1 -d' ')
|
||||||
@ -61,6 +65,7 @@ elif [ "$UPLATFORM" = "win32" ]; then
|
|||||||
export PATH="/c/Qt/5.6/mingw49_32_release_static/bin:$PATH"
|
export PATH="/c/Qt/5.6/mingw49_32_release_static/bin:$PATH"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Build
|
||||||
echo "Attempting to build UEFITool NE for ${UPLATFORM}..."
|
echo "Attempting to build UEFITool NE for ${UPLATFORM}..."
|
||||||
|
|
||||||
UEFITOOL_VER=$(cat version.h | grep PROGRAM_VERSION | cut -d'"' -f2 | sed 's/NE alpha /A/')
|
UEFITOOL_VER=$(cat version.h | grep PROGRAM_VERSION | cut -d'"' -f2 | sed 's/NE alpha /A/')
|
||||||
@ -72,27 +77,28 @@ build_tool() {
|
|||||||
echo "Invalid $1 version!"
|
echo "Invalid $1 version!"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
# Tools are in subdirectories
|
|
||||||
cd "$1" || exit 1
|
# Create build directory
|
||||||
|
mkdir -p "build/$1" || exit 1
|
||||||
|
cd "build/$1" || exit 1
|
||||||
|
|
||||||
# Build
|
# Build
|
||||||
if [ "$PRECONFIGURED" != "1" ]; then
|
if [ "$PRECONFIGURED" != "1" ]; then
|
||||||
if [ "$3" != "" ]; then
|
if [ "$3" != "" ]; then
|
||||||
# -flto is flawed on CI atm
|
|
||||||
if [ "$UPLATFORM" = "mac" ]; then
|
if [ "$UPLATFORM" = "mac" ]; then
|
||||||
qmake $3 QMAKE_CXXFLAGS+=-flto QMAKE_LFLAGS+=-flto CONFIG+=optimize_size || exit 1
|
qmake "../../$1/$3" QMAKE_CXXFLAGS+=-flto QMAKE_LFLAGS+=-flto CONFIG+=optimize_size || exit 1
|
||||||
elif [ "$UPLATFORM" = "win32" ]; then
|
elif [ "$UPLATFORM" = "win32" ]; then
|
||||||
qmake $3 QMAKE_CXXFLAGS="-static -flto -Os -std=c++11" QMAKE_LFLAGS="-static -flto -Os -std=c++11" CONFIG+=optimize_size CONFIG+=staticlib CONFIG+=static || exit 1
|
qmake "../../$1/$3" QMAKE_CXXFLAGS="-static -flto -Os -std=c++11" QMAKE_LFLAGS="-static -flto -Os -std=c++11" CONFIG+=optimize_size CONFIG+=staticlib CONFIG+=static || exit 1
|
||||||
else
|
else
|
||||||
qmake $3 CONFIG+=optimize_size || exit 1
|
qmake "../../$1/$3" CONFIG+=optimize_size || exit 1
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
if [ "$UPLATFORM" = "mac" ]; then
|
if [ "$UPLATFORM" = "mac" ]; then
|
||||||
cmake -G "Unix Makefiles" -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" -DCMAKE_CXX_FLAGS="-stdlib=libc++ -flto -Os -mmacosx-version-min=10.7" -DCMAKE_C_FLAGS="-flto -Os -mmacosx-version-min=10.7" . || exit 1
|
cmake -G "Unix Makefiles" -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" -DCMAKE_CXX_FLAGS="-stdlib=libc++ -flto -Os -mmacosx-version-min=10.7" -DCMAKE_C_FLAGS="-flto -Os -mmacosx-version-min=10.7" "../../$1/" || exit 1
|
||||||
elif [ "$UPLATFORM" = "win32" ]; then
|
elif [ "$UPLATFORM" = "win32" ]; then
|
||||||
cmake -G "Unix Makefiles" -DCMAKE_CXX_FLAGS="-static -Os -std=c++11" -DCMAKE_C_FLAGS="-static -Os" . || exit 1
|
cmake -G "Unix Makefiles" -DCMAKE_CXX_FLAGS="-static -Os -std=c++11" -DCMAKE_C_FLAGS="-static -Os" "../../$1/" || exit 1
|
||||||
else
|
else
|
||||||
cmake -G "Unix Makefiles" -DCMAKE_CXX_FLAGS="-Os" -DCMAKE_C_FLAGS="-Os" . || exit 1
|
cmake -G "Unix Makefiles" -DCMAKE_CXX_FLAGS="-Os" -DCMAKE_C_FLAGS="-Os" "../../$1/" || exit 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
@ -108,25 +114,22 @@ build_tool() {
|
|||||||
# Archive
|
# Archive
|
||||||
if [ "$1" = "UEFITool" ] && [ "$UPLATFORM" = "mac" ]; then
|
if [ "$1" = "UEFITool" ] && [ "$UPLATFORM" = "mac" ]; then
|
||||||
strip -x UEFITool.app/Contents/MacOS/UEFITool || exit 1
|
strip -x UEFITool.app/Contents/MacOS/UEFITool || exit 1
|
||||||
zip -qry ../dist/"${1}_NE_${2}_${UPLATFORM}.zip" UEFITool.app ${4} || exit 1
|
zip -qry ../../dist/"${1}_NE_${2}_${UPLATFORM}.zip" UEFITool.app ${4} || exit 1
|
||||||
else
|
else
|
||||||
strip -x "${1}${BINSUFFIX}" || exit 1
|
strip -x "${1}${BINSUFFIX}" || exit 1
|
||||||
zip -qry ../dist/"${1}_NE_${2}_${UPLATFORM}.zip" "${1}${BINSUFFIX}" ${4} || exit 1
|
zip -qry ../../dist/"${1}_NE_${2}_${UPLATFORM}.zip" "${1}${BINSUFFIX}" ${4} || exit 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Return to parent
|
# Return to parent
|
||||||
cd - || exit 1
|
cd ../.. || exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
rm -rf dist
|
rm -rf dist
|
||||||
mkdir -p dist || exit 1
|
mkdir -p dist || exit 1
|
||||||
|
|
||||||
build_tool UEFITool "$UEFITOOL_VER" uefitool.pro
|
build_tool UEFITool "$UEFITOOL_VER" uefitool.pro
|
||||||
# FIXME: cmake does not let overriding CC after generating files.
|
build_tool UEFIExtract "$UEFITOOL_VER" ""
|
||||||
if [ "$COVERITY_SCAN_TOKEN" = "" ]; then
|
build_tool UEFIFind "$UEFITOOL_VER" ""
|
||||||
build_tool UEFIExtract "$UEFITOOL_VER" ""
|
|
||||||
build_tool UEFIFind "$UEFITOOL_VER" ""
|
|
||||||
fi
|
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
Loading…
Reference in New Issue
Block a user