From b4a1e4a3f0af86ebf1c5c8691fb2c870b58f1628 Mon Sep 17 00:00:00 2001 From: illusion0001 <37698908+illusion0001@users.noreply.github.com> Date: Wed, 12 Jun 2024 01:37:44 -0500 Subject: [PATCH] Update rpcs3.yml --- .github/workflows/rpcs3.yml | 166 ++++++++---------------------------- 1 file changed, 36 insertions(+), 130 deletions(-) diff --git a/.github/workflows/rpcs3.yml b/.github/workflows/rpcs3.yml index d102555596f4..f1ce4a1b9500 100644 --- a/.github/workflows/rpcs3.yml +++ b/.github/workflows/rpcs3.yml @@ -7,145 +7,51 @@ concurrency: cancel-in-progress: true jobs: - Linux_Build: - runs-on: ubuntu-latest - strategy: - matrix: - compiler: [clang, gcc] - env: - CCACHE_DIR: ${{ github.workspace }}/ccache - CI_HAS_ARTIFACTS: true - UPLOAD_COMMIT_HASH: d812f1254a1157c80fd402f94446310560f54e5f - UPLOAD_REPO_FULL_NAME: "RPCS3/rpcs3-binaries-linux" - DEPLOY_APPIMAGE: true - APPDIR: "/rpcs3/build/appdir" - ARTDIR: "/root/artifacts" - RELEASE_MESSAGE: "/rpcs3/GitHubReleaseMessage.txt" - - 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: 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 - retention-days: 1 - - 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 - UPLOAD_COMMIT_HASH: 7d09e3be30805911226241afbb14f8cdc2eb054e - UPLOAD_REPO_FULL_NAME: "RPCS3/rpcs3-binaries-win" - - 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" - echo "$key=$val" >> $env:GITHUB_ENV - } - } - echo "BUILD_ARTIFACTSTAGINGDIRECTORY=${{ github.workspace }}\build" >> $env:GITHUB_ENV - echo "ARTIFACT_DIR=${{ github.workspace }}\build" >> $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 - - - name: Upload artifacts - uses: actions/upload-artifact@main - with: - name: RPCS3 for Windows - path: ${{ github.workspace }}/build - retention-days: 1 - push_release: if: | github.ref_name == 'master' && github.event_name == 'push' - needs: [ Linux_Build, Windows_Build ] + # needs: [ Linux_Build, Windows_Build ] runs-on: ubuntu-latest permissions: contents: write steps: - name: Checkout uses: actions/checkout@main - - - name: Download artifacts - uses: actions/download-artifact@main - with: - merge-multiple: true - path: artifact - - - name: Create Release + - name: Delete artifacts env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: gh release create ${{ GITHUB.RUN_NUMBER }} artifact/*.* --target ${{ GITHUB.SHA }} -t ${{ GITHUB.RUN_NUMBER }} + run: | + # Why do we need a script for this? + # https://gist.github.com/DPatrickBoyd/afb54165df0f51903be3f0edea77f9cb + #!/bin/bash + + # Change the date under CUTOFF_DATE to change how far back you want to delete + # Install the GitHub CLI tool by following the instructions in the official documentation: https://cli.github.com/manual/installation + # Make sure you auth first to github with 'gh auth login' + + REPO_OWNER="illusion0001" + REPO_NAME="rpcs3" + CUTOFF_DATE=$(date --date='30 days ago' +'%Y-%m-%dT%H:%M:%SZ') + PAGE=1 + + while true; do + # Retrieve a page of artifacts + ART_EXIST=$(gh api repos/$REPO_OWNER/$REPO_NAME/actions/artifacts?per_page=100\&page=$PAGE | jq -r '.artifacts[]') + ARTIFACTS=$(gh api repos/$REPO_OWNER/$REPO_NAME/actions/artifacts?per_page=100\&page=$PAGE | jq -r '.artifacts[] | select(.created_at < "'"$CUTOFF_DATE"'") | .id') + echo $PAGE + # If there are no more artifacts, exit the loop + if [[ -z "$ART_EXIST" ]]; then + break + fi + + # Loop through the artifacts on this page and delete the old ones + for ARTIFACT_ID in $ARTIFACTS; do + ARTIFACT_NAME=$(gh api repos/$REPO_OWNER/$REPO_NAME/actions/artifacts/$ARTIFACT_ID | jq -r '.name') + echo "Deleting artifact $ARTIFACT_NAME (ID: $ARTIFACT_ID)..." + gh api repos/$REPO_OWNER/$REPO_NAME/actions/artifacts/$ARTIFACT_ID -X DELETE + done + + # Increment the page counter + PAGE=$((PAGE+1)) + done