From 0db11de750a608aec0bae23f1f0431335f17c6bc Mon Sep 17 00:00:00 2001 From: illusion0001 <37698908+illusion0001@users.noreply.github.com> Date: Sun, 15 Sep 2024 07:22:25 -0500 Subject: [PATCH] GitHub Actions CI Port --- .ci/build-linux.sh | 4 +- .ci/setup-windows.sh | 18 +++-- .github/workflows/rpcs3.yml | 148 ++++++++++++++++++++++++++++++++++++ 3 files changed, 163 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/rpcs3.yml diff --git a/.ci/build-linux.sh b/.ci/build-linux.sh index 28d0d5d38e63..fea0e562fe32 100755 --- a/.ci/build-linux.sh +++ b/.ci/build-linux.sh @@ -11,6 +11,8 @@ git config --global --add safe.directory '*' # shellcheck disable=SC2046 git submodule -q update --init $(awk '/path/ && !/llvm/ && !/SPIRV/ { print $3 }' .gitmodules) +shellcheck .ci/*.sh + mkdir build && cd build || exit 1 if [ "$COMPILER" = "gcc" ]; then @@ -53,8 +55,6 @@ ninja; build_status=$?; cd .. -shellcheck .ci/*.sh - # If it compiled succesfully let's deploy. # Azure and Cirrus publish PRs as artifacts only. { [ "$CI_HAS_ARTIFACTS" = "true" ]; diff --git a/.ci/setup-windows.sh b/.ci/setup-windows.sh index ea2fd7e0b3bd..7e7b6d5077a9 100755 --- a/.ci/setup-windows.sh +++ b/.ci/setup-windows.sh @@ -103,16 +103,24 @@ COMM_HASH=$(git rev-parse --short=8 HEAD) # Format the above into filenames if [ -n "$PR_NUMBER" ]; then AVVER="${COMM_TAG}-${COMM_HASH}" - BUILD="rpcs3-v${AVVER}_win64.7z" + BUILD_RAW="rpcs3-v${AVVER}_win64" + BUILD="${BUILD_RAW}.7z" else AVVER="${COMM_TAG}-${COMM_COUNT}" - BUILD="rpcs3-v${AVVER}-${COMM_HASH}_win64.7z" + BUILD_RAW="rpcs3-v${AVVER}-${COMM_HASH}_win64" + BUILD="${BUILD_RAW}.7z" fi # BRANCH is used for experimental build warnings for pr builds, used in main_window.cpp. # BUILD is the name of the release artifact +# BUILD_RAW is just filename # AVVER is used for GitHub releases, it is the version number. BRANCH="${REPO_NAME}/${REPO_BRANCH}" -echo "BRANCH=$BRANCH" > .ci/ci-vars.env -echo "BUILD=$BUILD" >> .ci/ci-vars.env -echo "AVVER=$AVVER" >> .ci/ci-vars.env + +# SC2129 +{ + echo "BRANCH=$BRANCH" + echo "BUILD=$BUILD" + echo "BUILD_RAW=$BUILD_RAW" + echo "AVVER=$AVVER" +} >> .ci/ci-vars.env diff --git a/.github/workflows/rpcs3.yml b/.github/workflows/rpcs3.yml new file mode 100644 index 000000000000..a49b2332ee70 --- /dev/null +++ b/.github/workflows/rpcs3.yml @@ -0,0 +1,148 @@ +name: Build RPCS3 + +on: + push: + paths-ignore: + - '.cirrus.yml' + - '.azure-pipelines.yml' + - 'README.md' + pull_request: + paths-ignore: + - '.cirrus.yml' + - '.azure-pipelines.yml' + - 'README.md' + workflow_dispatch: + +concurrency: + group: ${{ github.ref }}-${{ github.event_name }} + cancel-in-progress: true + +env: + BUILD_REPOSITORY_NAME: ${{ github.repository }} + BUILD_SOURCEBRANCHNAME: ${{ github.ref_name }} + +jobs: + Linux_Build: + runs-on: ubuntu-latest + strategy: + matrix: + compiler: [clang, gcc] + env: + CCACHE_DIR: ${{ github.workspace }}/ccache + CI_HAS_ARTIFACTS: true + DEPLOY_APPIMAGE: true + APPDIR: "/rpcs3/build/appdir" + ARTDIR: "/root/artifacts" + RELEASE_MESSAGE: "/rpcs3/GitHubReleaseMessage-${{ matrix.compiler }}.txt" + COMPILER: ${{ matrix.compiler }} + + steps: + - name: Checkout repository + uses: actions/checkout@main + with: + submodules: recursive + fetch-depth: 0 + + - name: Setup Cache + uses: actions/cache@main + with: + path: ${{ env.CCACHE_DIR }} + key: ${{ runner.os }}-ccache-${{ matrix.compiler }} + + - name: Append Compiler version to appimage + run: | + file=".ci/deploy-linux.sh" + sed -i 's/RPCS3_APPIMAGE="rpcs3-v${COMM_TAG}-${COMM_COUNT}-${COMM_HASH}_linux64.AppImage"/RPCS3_APPIMAGE="rpcs3-v${COMM_TAG}-${COMM_COUNT}-${COMM_HASH}-${COMPILER}_linux64.AppImage"/g' $file + + - name: Docker setup and build + run: | + docker pull --quiet rpcs3/rpcs3-ci-focal:1.7 + docker run \ + -v $PWD:/rpcs3 \ + --env-file .ci/docker.env \ + -v ${{ env.CCACHE_DIR }}:/root/.ccache \ + -v ${{ github.workspace }}/artifacts:/root/artifacts \ + rpcs3/rpcs3-ci-focal:1.7 \ + /rpcs3/.ci/build-linux.sh + + - name: Upload artifacts + uses: actions/upload-artifact@main + with: + name: RPCS3 for Linux (${{ matrix.compiler }}) + path: ${{ github.workspace }}/build/*.AppImage + compression-level: 0 + + Windows_Build: + runs-on: windows-latest + env: + COMPILER: msvc + QT_VER_MAIN: '6' + QT_VER: '6.6.3' + QT_VER_MSVC: 'msvc2019' + QT_DATE: '202403191840' + VULKAN_VER: '1.3.268.0' + VULKAN_SDK_SHA: '8459ef49bd06b697115ddd3d97c9aec729e849cd775f5be70897718a9b3b9db5' + CACHE_DIR: ./cache + BUILD_ARTIFACTSTAGINGDIRECTORY: ${{ github.workspace }}\build + steps: + + - name: Checkout repository + uses: actions/checkout@main + with: + submodules: recursive + fetch-depth: 0 + + - name: Setup env + run: | + echo "QTDIR=C:\Qt\${{ env.QT_VER }}\${{ env.QT_VER_MSVC }}_64" >> ${{ github.env }} + echo "VULKAN_SDK=C:\VulkanSDK\${{ env.VULKAN_VER }}" >> ${{ github.env }} + + - name: Get Cache Keys + shell: bash + run: .ci/get_keys-windows.sh + + - name: Setup Cache + uses: actions/cache@main + with: + path: ${{ env.CACHE_DIR }} + key: ${{ runner.os }}-${{ env.COMPILER }}-${{ env.QT_VER }}-${{ env.VULKAN_SDK_SHA }}-llvm.lock-glslang.lock + restore-keys: ${{ runner.os }}-${{ env.COMPILER }} + + - name: Download and unpack dependencies + shell: bash + run: .ci/setup-windows.sh + + - name: Export Variables + run: | + Get-Content ".ci/ci-vars.env" | ForEach-Object { + # Skip over lines containing comments. + if ($_ -notmatch '^\s*#') + { + $line = $_ -split '=' + $key = $line[0] + $val = $line[1] + echo "$key=$val" >> $env:GITHUB_ENV + } + } + mkdir build + + - name: Add msbuild to PATH + uses: microsoft/setup-msbuild@main + + - name: Compile RPCS3 + run: msbuild rpcs3.sln /p:Configuration=Release /p:Platform=x64 + + - name: Pack up build artifacts + shell: bash + run: | + .ci/deploy-windows.sh + mkdir -p bin2/${{ env.BUILD_RAW }} + mv bin/* bin2/${{ env.BUILD_RAW }} + ls bin2 + + - name: Upload artifacts + uses: actions/upload-artifact@main + with: + name: RPCS3 for Windows (MSVC) + path: bin2 + if-no-files-found: error