1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-22 02:32:36 +01:00

CI: Maintenance

- Rename .travis dir to .ci, since it isn't just for Travis
- Convert Linux build scripts to posix sh
- Clean up some scripts per shellcheck
This commit is contained in:
JohnHolmesII 2020-04-06 19:53:23 -07:00 committed by Ivan
parent c2ae8be3eb
commit c4a21438ad
9 changed files with 71 additions and 57 deletions

27
.travis/build-linux.bash → .ci/build-linux.sh Normal file → Executable file
View File

@ -1,23 +1,25 @@
#!/bin/env bash -ex #!/bin/sh -ex
shopt -s nocasematch
# Setup Qt variables # Setup Qt variables
export QT_BASE_DIR=/opt/qt${QTVERMIN} export QT_BASE_DIR=/opt/qt${QTVERMIN}
export PATH=$QT_BASE_DIR/bin:$PATH export PATH=$QT_BASE_DIR/bin:$PATH
export LD_LIBRARY_PATH=$QT_BASE_DIR/lib/x86_64-linux-gnu:$QT_BASE_DIR/lib export LD_LIBRARY_PATH=$QT_BASE_DIR/lib/x86_64-linux-gnu:$QT_BASE_DIR/lib
cd rpcs3 cd rpcs3 || exit 1
git submodule update --quiet --init asmjit 3rdparty/ffmpeg 3rdparty/pugixml 3rdparty/span 3rdparty/libpng 3rdparty/cereal 3rdparty/hidapi 3rdparty/xxHash 3rdparty/yaml-cpp 3rdparty/libusb 3rdparty/FAudio Vulkan/glslang 3rdparty/curl 3rdparty/wolfssl # Pull all the submodules except llvm, since it is built separately and we just download that build
# Note: Tried to use git submodule status, but it takes over 20 seconds
# shellcheck disable=SC2046
git submodule -q update --init $(awk '/path/ && !/llvm/ { print $3 }' .gitmodules)
# Download pre-compiled llvm libs # Download pre-compiled llvm libs
curl -sLO https://github.com/RPCS3/llvm-mirror/releases/download/custom-build/llvmlibs-linux.tar.gz curl -sLO https://github.com/RPCS3/llvm-mirror/releases/download/custom-build/llvmlibs-linux.tar.gz
mkdir llvmlibs mkdir llvmlibs
tar -xzf ./llvmlibs-linux.tar.gz -C llvmlibs tar -xzf ./llvmlibs-linux.tar.gz -C llvmlibs
mkdir build ; cd build mkdir build && cd build || exit 1
if [ $COMPILER = "gcc" ]; then if [ "$COMPILER" = "gcc" ]; then
# These are set in the dockerfile # These are set in the dockerfile
export CC=${GCC_BINARY} export CC=${GCC_BINARY}
export CXX=${GXX_BINARY} export CXX=${GXX_BINARY}
@ -44,8 +46,13 @@ ninja; build_status=$?;
cd .. cd ..
# If it compiled succesfully let's deploy depending on the build pipeline (Travis, Azure Pipelines) # If it compiled succesfully let's deploy depending on the build pipeline (Travis, Azure Pipelines).
# BUILD_REASON is an Azure Pipeline variable, and we want to deploy when using Azure Pipelines # Travis only deploys on master, and it publishes to GitHub releases. Azure publishes PRs as artifacts
if [[ $build_status -eq 0 && ( -n "$BUILD_REASON" || ( "$TRAVIS_BRANCH" = "master" && "$TRAVIS_PULL_REQUEST" = false ) ) ]]; then # only.
/bin/bash -ex .travis/deploy-linux.bash { [ "$IS_AZURE" = "true" ] ||
{ [ "$TRAVIS_BRANCH" = "master" ] && [ "$TRAVIS_PULL_REQUEST" = "false" ]; };
} && SHOULD_DEPLOY="true" || SHOULD_DEPLOY="false"
if [ "$build_status" -eq 0 ] && [ "$SHOULD_DEPLOY" = "true" ]; then
.ci/deploy-linux.sh
fi fi

15
.travis/build-mac.bash → .ci/build-mac.sh Normal file → Executable file
View File

@ -1,3 +1,5 @@
#!/bin/sh -ex
export CCACHE_SLOPPINESS=pch_defines,time_macros export CCACHE_SLOPPINESS=pch_defines,time_macros
export CMAKE_PREFIX_PATH=/usr/local/opt/qt5/ export CMAKE_PREFIX_PATH=/usr/local/opt/qt5/
export PATH="/usr/local/opt/ccache/libexec:$PATH" export PATH="/usr/local/opt/ccache/libexec:$PATH"
@ -8,15 +10,18 @@ unzip -: gfx-portability-macos-latest.zip
curl -sLO https://github.com/KhronosGroup/Vulkan-Headers/archive/sdk-1.1.106.0.zip curl -sLO https://github.com/KhronosGroup/Vulkan-Headers/archive/sdk-1.1.106.0.zip
unzip -: sdk-*.zip unzip -: sdk-*.zip
mkdir vulkan-sdk mkdir vulkan-sdk
ln -s ${PWD}/Vulkan-Headers*/include vulkan-sdk/include ln -s "${PWD}"/Vulkan-Headers*/include vulkan-sdk/include
mkdir vulkan-sdk/lib mkdir vulkan-sdk/lib
cp target/release/libportability.dylib vulkan-sdk/lib/libVulkan.dylib cp target/release/libportability.dylib vulkan-sdk/lib/libVulkan.dylib
# Let macdeployqt locate and install Vulkan library # Let macdeployqt locate and install Vulkan library
install_name_tool -id ${PWD}/vulkan-sdk/lib/libVulkan.dylib vulkan-sdk/lib/libVulkan.dylib install_name_tool -id "${PWD}"/vulkan-sdk/lib/libVulkan.dylib vulkan-sdk/lib/libVulkan.dylib
export VULKAN_SDK=${PWD}/vulkan-sdk export VULKAN_SDK="${PWD}/vulkan-sdk"
git submodule update --quiet --init asmjit 3rdparty/ffmpeg 3rdparty/pugixml 3rdparty/span 3rdparty/libpng 3rdparty/cereal 3rdparty/hidapi 3rdparty/libusb 3rdparty/xxHash 3rdparty/yaml-cpp 3rdparty/FAudio Vulkan/glslang # Pull all the submodules except llvm
# Note: Tried to use git submodule status, but it takes over 20 seconds
# shellcheck disable=SC2046
git submodule -q update --init $(awk '/path/ && !/llvm/ { print $3 }' .gitmodules)
mkdir build; cd build mkdir build && cd build || exit 1
cmake .. -DWITH_LLVM=OFF -DUSE_NATIVE_INSTRUCTIONS=OFF -G Ninja cmake .. -DWITH_LLVM=OFF -DUSE_NATIVE_INSTRUCTIONS=OFF -G Ninja
ninja ninja

40
.travis/deploy-linux.bash → .ci/deploy-linux.sh Normal file → Executable file
View File

@ -1,16 +1,19 @@
#!/bin/env bash -ex #!/bin/sh -ex
shopt -s nocasematch
cd build cd build || exit 1
if [ "$DEPLOY_APPIMAGE" = "true" ]; then if [ "$DEPLOY_APPIMAGE" = "true" ]; then
DESTDIR=appdir ninja install DESTDIR=appdir ninja install
curl -sLO "https://github.com/probonopd/linuxdeployqt/releases/download/continuous/linuxdeployqt-continuous-x86_64.AppImage" QT_APPIMAGE="linuxdeployqt.AppImage"
chmod a+x linuxdeployqt*.AppImage
./linuxdeployqt*.AppImage --appimage-extract curl -sL "https://github.com/probonopd/linuxdeployqt/releases/download/continuous/linuxdeployqt-continuous-x86_64.AppImage" > "$QT_APPIMAGE"
chmod a+x "$QT_APPIMAGE"
"./$QT_APPIMAGE" --appimage-extract
./squashfs-root/AppRun ./appdir/usr/share/applications/*.desktop -bundle-non-qt-libs ./squashfs-root/AppRun ./appdir/usr/share/applications/*.desktop -bundle-non-qt-libs
ls ./appdir/usr/lib/ ls ./appdir/usr/lib/
rm -r ./appdir/usr/share/doc rm -r ./appdir/usr/share/doc
rm ./appdir/usr/lib/libxcb* rm ./appdir/usr/lib/libxcb*
cp $(readlink -f /lib/x86_64-linux-gnu/libnsl.so.1) ./appdir/usr/lib/libnsl.so.1 cp "$(readlink -f /lib/x86_64-linux-gnu/libnsl.so.1)" ./appdir/usr/lib/libnsl.so.1
export PATH=/rpcs3/build/squashfs-root/usr/bin/:${PATH} export PATH=/rpcs3/build/squashfs-root/usr/bin/:${PATH}
# Embed newer libstdc++ for distros that don't come with it (ubuntu 16.04) # Embed newer libstdc++ for distros that don't come with it (ubuntu 16.04)
@ -32,25 +35,22 @@ if [ "$DEPLOY_APPIMAGE" = "true" ]; then
# Package it up and send it off # Package it up and send it off
./squashfs-root/usr/bin/appimagetool /rpcs3/build/appdir ./squashfs-root/usr/bin/appimagetool /rpcs3/build/appdir
ls ls
COMM_TAG="$(grep 'version{.*}' ../rpcs3/rpcs3_version.cpp | awk -F[{,] '{printf "%d.%d.%d", $2, $3, $4}')"
COMM_TAG="$(grep 'version{.*}' ../rpcs3/rpcs3_version.cpp | awk -F[\{,] '{printf "%d.%d.%d", $2, $3, $4}')"
COMM_COUNT="$(git rev-list --count HEAD)" COMM_COUNT="$(git rev-list --count HEAD)"
COMM_HASH="$(git rev-parse --short=8 HEAD)"
RPCS3_APPIMAGE="rpcs3-v${COMM_TAG}-${COMM_COUNT}-${COMM_HASH}_linux64.AppImage"
curl -sLO https://github.com/hcorion/uploadtool/raw/master/upload.sh curl -sLO https://github.com/hcorion/uploadtool/raw/master/upload.sh
mv ./RPCS3*.AppImage "$RPCS3_APPIMAGE"
if [[ -n "$BUILD_SOURCEVERSION" ]]; then
COMMIT_HASH=$BUILD_SOURCEVERSION
elif [[ -n "$TRAVIS_COMMIT" ]]; then
COMMIT_HASH=$TRAVIS_COMMIT
fi
mv ./RPCS3*.AppImage rpcs3-v${COMM_TAG}-${COMM_COUNT}-${COMMIT_HASH:0:8}_linux64.AppImage
# If we're building using Azure Pipelines, let's copy over the AppImage artifact # If we're building using Azure Pipelines, let's copy over the AppImage artifact
if [[ -n "$BUILD_ARTIFACTSTAGINGDIRECTORY" ]]; then if [ -n "$BUILD_ARTIFACTSTAGINGDIRECTORY" ]; then
cp ./rpcs3*.AppImage ~/artifacts cp "$RPCS3_APPIMAGE" ~/artifacts
fi fi
FILESIZE=($(stat -c %s ./rpcs3*.AppImage)) FILESIZE=$(stat -c %s ./rpcs3*.AppImage)
SHA256SUM=($(sha256sum ./rpcs3*.AppImage)) SHA256SUM=$(sha256sum ./rpcs3*.AppImage)
if [ -n "$GITHUB_TOKEN" ]; then if [ -n "$GITHUB_TOKEN" ]; then
unset TRAVIS_REPO_SLUG unset TRAVIS_REPO_SLUG
REPO_SLUG=RPCS3/rpcs3-binaries-linux \ REPO_SLUG=RPCS3/rpcs3-binaries-linux \

0
.travis/deploy-windows.sh → .ci/deploy-windows.sh Normal file → Executable file
View File

View File

@ -10,4 +10,4 @@ while IFS='=' read -r key val; do
# Skip over lines containing comments. # Skip over lines containing comments.
[ "${key##\#*}" ] || continue [ "${key##\#*}" ] || continue
echo "##vso[task.setvariable variable=$key]$val" echo "##vso[task.setvariable variable=$key]$val"
done < ".travis/azure-vars.env" done < ".ci/azure-vars.env"

6
.travis/setup-windows.sh → .ci/setup-windows.sh Normal file → Executable file
View File

@ -111,6 +111,6 @@ fi
# BUILD is the name of the release artifact # BUILD is the name of the release artifact
# AVVER is used for GitHub releases, it is the version number. # AVVER is used for GitHub releases, it is the version number.
BRANCH="${REPO_NAME}/${REPO_BRANCH}" BRANCH="${REPO_NAME}/${REPO_BRANCH}"
echo "BRANCH=$BRANCH" > .travis/azure-vars.env echo "BRANCH=$BRANCH" > .ci/azure-vars.env
echo "BUILD=$BUILD" >> .travis/azure-vars.env echo "BUILD=$BUILD" >> .ci/azure-vars.env
echo "AVVER=$AVVER" >> .travis/azure-vars.env echo "AVVER=$AVVER" >> .ci/azure-vars.env

View File

@ -3,6 +3,7 @@ TRAVIS_PULL_REQUEST
TRAVIS_BRANCH TRAVIS_BRANCH
TRAVIS_COMMIT TRAVIS_COMMIT
# Variables set by Azure Pipelines # Variables set by Azure Pipelines
IS_AZURE
BUILD_REASON BUILD_REASON
BUILD_SOURCEVERSION BUILD_SOURCEVERSION
BUILD_ARTIFACTSTAGINGDIRECTORY BUILD_ARTIFACTSTAGINGDIRECTORY

View File

@ -11,7 +11,7 @@ jobs:
cache: ccache cache: ccache
compiler: gcc compiler: gcc
install: "docker pull rpcs3/rpcs3-travis-xenial:1.2" install: "docker pull rpcs3/rpcs3-travis-xenial:1.2"
script: 'travis_wait docker run -v $(pwd):/rpcs3 -v "$HOME/.ccache":/root/.ccache --env-file .travis/travis.env rpcs3/rpcs3-travis-xenial:1.2 /bin/bash -ex /rpcs3/.travis/build-linux.bash' script: 'travis_wait docker run -v $(pwd):/rpcs3 -v "$HOME/.ccache":/root/.ccache --env-file .ci/travis.env rpcs3/rpcs3-travis-xenial:1.2 /rpcs3/.ci/build-linux.sh'
- os: linux - os: linux
dist: xenial dist: xenial
env: env:
@ -21,7 +21,7 @@ jobs:
cache: ccache cache: ccache
compiler: clang compiler: clang
install: "docker pull rpcs3/rpcs3-travis-xenial:1.2" install: "docker pull rpcs3/rpcs3-travis-xenial:1.2"
script: 'travis_wait docker run -v $(pwd):/rpcs3 -v "$HOME/.ccache":/root/.ccache --env-file .travis/travis.env rpcs3/rpcs3-travis-xenial:1.2 /bin/bash -ex /rpcs3/.travis/build-linux.bash' script: 'travis_wait docker run -v $(pwd):/rpcs3 -v "$HOME/.ccache":/root/.ccache --env-file .ci/travis.env rpcs3/rpcs3-travis-xenial:1.2 /rpcs3/.ci/build-linux.sh'
# - os: osx # - os: osx
# osx_image: xcode11.3 # osx_image: xcode11.3
# addons: # addons:
@ -31,7 +31,7 @@ jobs:
# - glew # - glew
# - ninja # - ninja
# - qt # - qt
# script: "/bin/bash -ex .travis/build-mac.bash" # script: "/bin/bash -ex .ci/build-mac.sh"
# cache: ccache # cache: ccache
allow_failures: allow_failures:
- os: osx - os: osx

View File

@ -20,6 +20,7 @@ jobs:
DEPLOY_APPIMAGE: true DEPLOY_APPIMAGE: true
variables: variables:
CCACHE_DIR: $(Pipeline.Workspace)/ccache CCACHE_DIR: $(Pipeline.Workspace)/ccache
IS_AZURE: true
pool: pool:
vmImage: 'ubuntu-latest' vmImage: 'ubuntu-latest'
steps: steps:
@ -33,11 +34,11 @@ jobs:
docker pull --quiet rpcs3/rpcs3-travis-xenial:1.2 docker pull --quiet rpcs3/rpcs3-travis-xenial:1.2
docker run \ docker run \
-v $(pwd):/rpcs3 \ -v $(pwd):/rpcs3 \
--env-file .travis/travis.env \ --env-file .ci/travis.env \
-v $CCACHE_DIR:/root/.ccache \ -v $CCACHE_DIR:/root/.ccache \
-v $BUILD_ARTIFACTSTAGINGDIRECTORY:/root/artifacts \ -v $BUILD_ARTIFACTSTAGINGDIRECTORY:/root/artifacts \
rpcs3/rpcs3-travis-xenial:1.2 \ rpcs3/rpcs3-travis-xenial:1.2 \
/bin/bash -ex /rpcs3/.travis/build-linux.bash /rpcs3/.ci/build-linux.sh
displayName: Docker setup and build displayName: Docker setup and build
- publish: $(Build.ArtifactStagingDirectory) - publish: $(Build.ArtifactStagingDirectory)
@ -64,10 +65,10 @@ jobs:
path: $(CACHE_DIR) path: $(CACHE_DIR)
displayName: Cache displayName: Cache
- bash: .travis/setup-windows.sh - bash: .ci/setup-windows.sh
displayName: Download and unpack dependencies displayName: Download and unpack dependencies
- bash: .travis/export-azure-vars.sh - bash: .ci/export-azure-vars.sh
displayName: Export Variables displayName: Export Variables
- task: VSBuild@1 - task: VSBuild@1
@ -78,7 +79,7 @@ jobs:
configuration: 'Release - LLVM' configuration: 'Release - LLVM'
displayName: Compile RPCS3 displayName: Compile RPCS3
- bash: .travis/deploy-windows.sh - bash: .ci/deploy-windows.sh
displayName: Pack up build artifacts displayName: Pack up build artifacts
- publish: $(Build.ArtifactStagingDirectory) - publish: $(Build.ArtifactStagingDirectory)