CI: Move linux unit test to separate build step

This commit is contained in:
Megamouse 2025-04-29 21:14:09 +02:00
parent b25276deec
commit d504e3220c
6 changed files with 85 additions and 20 deletions

View file

@ -6,13 +6,26 @@ fi
shellcheck .ci/*.sh shellcheck .ci/*.sh
RPCS3_DIR=$(pwd)
# If we're building using a CI, let's use the runner's directory
if [ -n "$BUILDDIR" ]; then
BUILD_DIR="$BUILDDIR"
else
BUILD_DIR="$RPCS3_DIR/build"
fi
git config --global --add safe.directory '*' git config --global --add safe.directory '*'
# Pull all the submodules except llvm, opencv, sdl and curl # Pull all the submodules except llvm, opencv, sdl and curl
# shellcheck disable=SC2046 # shellcheck disable=SC2046
git submodule -q update --init $(awk '/path/ && !/llvm/ && !/opencv/ && !/libsdl-org/ && !/curl/ { print $3 }' .gitmodules) git submodule -q update --init $(awk '/path/ && !/llvm/ && !/opencv/ && !/libsdl-org/ && !/curl/ { print $3 }' .gitmodules)
mkdir build && cd build || exit 1 if [ ! -d "$BUILD_DIR" ]; then
mkdir "$BUILD_DIR" || exit 1
fi
cd "$BUILD_DIR" || exit 1
if [ "$COMPILER" = "gcc" ]; then if [ "$COMPILER" = "gcc" ]; then
# These are set in the dockerfile # These are set in the dockerfile
@ -27,7 +40,7 @@ fi
export LINKER_FLAG="-fuse-ld=${LINKER}" export LINKER_FLAG="-fuse-ld=${LINKER}"
cmake .. \ cmake "$RPCS3_DIR" \
-DCMAKE_INSTALL_PREFIX=/usr \ -DCMAKE_INSTALL_PREFIX=/usr \
-DUSE_NATIVE_INSTRUCTIONS=OFF \ -DUSE_NATIVE_INSTRUCTIONS=OFF \
-DUSE_PRECOMPILED_HEADERS=OFF \ -DUSE_PRECOMPILED_HEADERS=OFF \
@ -43,13 +56,13 @@ cmake .. \
-DOpenGL_GL_PREFERENCE=LEGACY \ -DOpenGL_GL_PREFERENCE=LEGACY \
-DLLVM_DIR=/opt/llvm/lib/cmake/llvm \ -DLLVM_DIR=/opt/llvm/lib/cmake/llvm \
-DSTATIC_LINK_LLVM=ON \ -DSTATIC_LINK_LLVM=ON \
-DBUILD_RPCS3_TESTS="${RUN_UNIT_TESTS}" \ -DBUILD_RPCS3_TESTS="${BUILD_UNIT_TESTS}" \
-DRUN_RPCS3_TESTS="${RUN_UNIT_TESTS}" \ -DRUN_RPCS3_TESTS="${RUN_UNIT_TESTS}" \
-G Ninja -G Ninja
ninja; build_status=$?; ninja; build_status=$?;
cd .. cd "$RPCS3_DIR"
# If it compiled succesfully let's deploy. # If it compiled succesfully let's deploy.
# Azure and Cirrus publish PRs as artifacts only. # Azure and Cirrus publish PRs as artifacts only.

View file

@ -6,6 +6,15 @@ fi
shellcheck .ci/*.sh shellcheck .ci/*.sh
RPCS3_DIR=$(pwd)
# If we're building using a CI, let's use the runner's directory
if [ -n "$BUILDDIR" ]; then
BUILD_DIR="$BUILDDIR"
else
BUILD_DIR="$RPCS3_DIR/build"
fi
git config --global --add safe.directory '*' git config --global --add safe.directory '*'
# Pull all the submodules except llvm, opencv, sdl and curl # Pull all the submodules except llvm, opencv, sdl and curl
@ -13,7 +22,11 @@ git config --global --add safe.directory '*'
# shellcheck disable=SC2046 # shellcheck disable=SC2046
git submodule -q update --init $(awk '/path/ && !/llvm/ && !/opencv/ && !/libsdl-org/ && !/curl/ { print $3 }' .gitmodules) git submodule -q update --init $(awk '/path/ && !/llvm/ && !/opencv/ && !/libsdl-org/ && !/curl/ { print $3 }' .gitmodules)
mkdir build && cd build || exit 1 if [ ! -d "$BUILD_DIR" ]; then
mkdir "$BUILD_DIR" || exit 1
fi
cd "$BUILD_DIR" || exit 1
if [ "$COMPILER" = "gcc" ]; then if [ "$COMPILER" = "gcc" ]; then
# These are set in the dockerfile # These are set in the dockerfile
@ -34,7 +47,7 @@ fi
export LINKER_FLAG="-fuse-ld=${LINKER}" export LINKER_FLAG="-fuse-ld=${LINKER}"
cmake .. \ cmake "$RPCS3_DIR" \
-DCMAKE_INSTALL_PREFIX=/usr \ -DCMAKE_INSTALL_PREFIX=/usr \
-DUSE_NATIVE_INSTRUCTIONS=OFF \ -DUSE_NATIVE_INSTRUCTIONS=OFF \
-DUSE_PRECOMPILED_HEADERS=OFF \ -DUSE_PRECOMPILED_HEADERS=OFF \
@ -54,19 +67,20 @@ cmake .. \
-DOpenGL_GL_PREFERENCE=LEGACY \ -DOpenGL_GL_PREFERENCE=LEGACY \
-DLLVM_DIR=/opt/llvm/lib/cmake/llvm \ -DLLVM_DIR=/opt/llvm/lib/cmake/llvm \
-DSTATIC_LINK_LLVM=ON \ -DSTATIC_LINK_LLVM=ON \
-DBUILD_RPCS3_TESTS="${RUN_UNIT_TESTS}" \ -DBUILD_RPCS3_TESTS="${BUILD_UNIT_TESTS}" \
-DRUN_RPCS3_TESTS="${RUN_UNIT_TESTS}" \ -DRUN_RPCS3_TESTS="${RUN_UNIT_TESTS}" \
-G Ninja -G Ninja
ninja; build_status=$?; ninja; build_status=$?;
cd .. cd "$RPCS3_DIR"
# If it compiled succesfully let's deploy. # If it compiled succesfully let's deploy.
# Azure and Cirrus publish PRs as artifacts only. # Azure and Cirrus publish PRs as artifacts only.
{ [ "$CI_HAS_ARTIFACTS" = "true" ]; # { [ "$CI_HAS_ARTIFACTS" = "true" ];
} && SHOULD_DEPLOY="true" || SHOULD_DEPLOY="false" # } && SHOULD_DEPLOY="true" || SHOULD_DEPLOY="false"
if [ "$build_status" -eq 0 ] && [ "$SHOULD_DEPLOY" = "true" ]; then if [ "$build_status" -eq 0 ] && [ "$SHOULD_DEPLOY" = "true" ]; then
.ci/deploy-linux.sh "x86_64" echo "deploy-linux placeholder"
# .ci/deploy-linux.sh "x86_64"
fi fi

View file

@ -1,6 +1,27 @@
#!/bin/sh -ex #!/bin/sh -ex
cd build || exit 1 RPCS3_DIR=$(pwd)
echo "pwd = $RPCS3_DIR"
ls -la -F
# If we're building using a CI, let's use the runner's directory
if [ -n "$BUILDDIR" ]; then
BUILD_DIR="$BUILDDIR"
else
BUILD_DIR="$RPCS3_DIR/build"
fi
echo "BUILD_DIR = $BUILD_DIR"
cd "$BUILD_DIR" || exit 1
echo "pwd = $(pwd)"
ls -la -F
echo "cd $RPCS3_DIR/rpcs3"
cd "$RPCS3_DIR/rpcs3"
echo "pwd = $(pwd)"
ls -la -F
CPU_ARCH="${1:-x86_64}" CPU_ARCH="${1:-x86_64}"

View file

@ -3,11 +3,14 @@ CI_HAS_ARTIFACTS
BUILD_REASON BUILD_REASON
BUILD_SOURCEVERSION BUILD_SOURCEVERSION
BUILD_ARTIFACTSTAGINGDIRECTORY BUILD_ARTIFACTSTAGINGDIRECTORY
BUILD_BUILDDIRECTORY
BUILD_REPOSITORY_NAME BUILD_REPOSITORY_NAME
BUILD_SOURCEBRANCHNAME BUILD_SOURCEBRANCHNAME
APPDIR APPDIR
ARTDIR ARTDIR
BUILDDIR
RELEASE_MESSAGE RELEASE_MESSAGE
BUILD_UNIT_TESTS
RUN_UNIT_TESTS RUN_UNIT_TESTS
# Variables for build matrix # Variables for build matrix
COMPILER COMPILER

View file

@ -19,6 +19,7 @@ env:
BUILD_SOURCEBRANCHNAME: ${{ github.ref_name }} BUILD_SOURCEBRANCHNAME: ${{ github.ref_name }}
BUILD_SOURCEVERSION: ${{ github.sha }} BUILD_SOURCEVERSION: ${{ github.sha }}
BUILD_ARTIFACTSTAGINGDIRECTORY: ${{ github.workspace }}/artifacts/ BUILD_ARTIFACTSTAGINGDIRECTORY: ${{ github.workspace }}/artifacts/
BUILD_BUILDDIRECTORY: ${{ github.workspace }}/rpcs3_build/
jobs: jobs:
Linux_Build: Linux_Build:
@ -52,11 +53,13 @@ jobs:
DEPLOY_APPIMAGE: true DEPLOY_APPIMAGE: true
APPDIR: "/rpcs3/build/appdir" APPDIR: "/rpcs3/build/appdir"
ARTDIR: "/root/artifacts" ARTDIR: "/root/artifacts"
BUILDDIR: "/root/rpcs3_build"
RELEASE_MESSAGE: "/rpcs3/GitHubReleaseMessage.txt" RELEASE_MESSAGE: "/rpcs3/GitHubReleaseMessage.txt"
COMPILER: ${{ matrix.compiler }} COMPILER: ${{ matrix.compiler }}
UPLOAD_COMMIT_HASH: ${{ matrix.UPLOAD_COMMIT_HASH }} UPLOAD_COMMIT_HASH: ${{ matrix.UPLOAD_COMMIT_HASH }}
UPLOAD_REPO_FULL_NAME: ${{ matrix.UPLOAD_REPO_FULL_NAME }} UPLOAD_REPO_FULL_NAME: ${{ matrix.UPLOAD_REPO_FULL_NAME }}
RUN_UNIT_TESTS: github.event_name == 'pull_request' && 'ON' || 'OFF' BUILD_UNIT_TESTS: github.event_name == 'pull_request' && 'ON' || 'OFF'
RUN_UNIT_TESTS: 'OFF'
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@main uses: actions/checkout@main
@ -79,15 +82,26 @@ jobs:
--env-file .ci/docker.env \ --env-file .ci/docker.env \
-v ${{ env.CCACHE_DIR }}:/root/.ccache \ -v ${{ env.CCACHE_DIR }}:/root/.ccache \
-v ${{ env.BUILD_ARTIFACTSTAGINGDIRECTORY }}:${{ env.ARTDIR }} \ -v ${{ env.BUILD_ARTIFACTSTAGINGDIRECTORY }}:${{ env.ARTDIR }} \
-v ${{ env.BUILD_BUILDDIRECTORY }}:${{ env.BUILDDIR }} \
${{ matrix.docker_img }} \ ${{ matrix.docker_img }} \
${{ matrix.build_sh }} ${{ matrix.build_sh }}
- name: Upload artifacts - name: Unit tests
uses: actions/upload-artifact@main if: github.event_name == 'pull_request'
with: working-directory: ${{ github.workspace }}
name: RPCS3 for Linux (${{ runner.arch }}, ${{ matrix.compiler }}) run: |
path: ${{ env.BUILD_ARTIFACTSTAGINGDIRECTORY }}/*.AppImage ls -la -F
compression-level: 0 ls -la -F rpcs3
mkdir -p my_symlinks
ln -s ${{ env.BUILDDIR }} my_symlinks/build
ctest -j -VV -C Release --test-dir my_symlinks/build --output-on-failure
# - name: Upload artifacts
# uses: actions/upload-artifact@main
# with:
# name: RPCS3 for Linux (${{ runner.arch }}, ${{ matrix.compiler }})
# path: ${{ env.BUILD_ARTIFACTSTAGINGDIRECTORY }}/*.AppImage
# compression-level: 0
- name: Deploy master build to GitHub Releases - name: Deploy master build to GitHub Releases
if: | if: |

View file

@ -124,7 +124,7 @@ namespace fmt
EXPECT_EQ(lowercase, to_lower_res); EXPECT_EQ(lowercase, to_lower_res);
EXPECT_EQ(""s, fmt::to_upper("")); EXPECT_EQ(""s, fmt::to_upper(""));
EXPECT_EQ(uppercase, fmt::to_upper(uppercase)); EXPECT_EQ(uppercase, fmt::to_lower(uppercase));
EXPECT_EQ(uppercase, to_upper_res); EXPECT_EQ(uppercase, to_upper_res);
} }