From 5684b5909fac35266dd1abac86667a0d0ea7c320 Mon Sep 17 00:00:00 2001 From: Zion Nimchuk Date: Wed, 5 Jan 2022 00:32:13 -0800 Subject: [PATCH] Move binary release deployment from Azure to Cirrus --- .ci/build-mac.sh | 55 ++++++++++---------------------------- .ci/deploy-linux.sh | 2 +- .ci/deploy-mac.sh | 56 +++++++++++++++++++++++++++++++++++++++ .ci/export-azure-vars.sh | 2 +- .ci/export-cirrus-vars.sh | 2 +- .ci/setup-windows.sh | 6 ++--- .cirrus.yml | 37 ++++++++++++++++++-------- azure-pipelines.yml | 27 ++++++++++++------- 8 files changed, 119 insertions(+), 68 deletions(-) create mode 100755 .ci/deploy-mac.sh diff --git a/.ci/build-mac.sh b/.ci/build-mac.sh index ff24f1cf29..222607e94e 100755 --- a/.ci/build-mac.sh +++ b/.ci/build-mac.sh @@ -20,50 +20,23 @@ git submodule update --init --recursive --depth 1 ln -s "$VULKAN_SDK/lib/libMoltenVK.dylib" "$VULKAN_SDK/lib/libvulkan.dylib" sed -i '' "s/extern const double NSAppKitVersionNumber;/const double NSAppKitVersionNumber = 1343;/g" 3rdparty/hidapi/hidapi/mac/hid.c -cd .. mkdir build && cd build || exit 1 -cmake -DUSE_DISCORD_RPC=OFF -DUSE_VULKAN=ON -DUSE_ALSA=OFF -DUSE_PULSE=OFF -DUSE_AUDIOUNIT=ON \ --G Ninja -DLLVM_CCACHE_BUILD=OFF -DLLVM_TARGETS_TO_BUILD="X86" -DLLVM_BUILD_RUNTIME=OFF -DLLVM_BUILD_TOOLS=OFF \ --DLLVM_INCLUDE_DOCS=OFF -DLLVM_INCLUDE_EXAMPLES=OFF -DLLVM_INCLUDE_TESTS=OFF -DLLVM_INCLUDE_TOOLS=OFF \ --DLLVM_INCLUDE_UTILS=OFF -DLLVM_USE_PERF=OFF -DLLVM_ENABLE_Z3_SOLVER=OFF \ --DCMAKE_CXX_STANDARD=20 -DUSE_NATIVE_INSTRUCTIONS=OFF \ -../cirrus-ci-build/ -ninja -cd ../cirrus-ci-build/ -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_HASH="$(git rev-parse --short=8 HEAD)" -cd ../build/bin +cmake .. \ + -DUSE_DISCORD_RPC=OFF -DUSE_VULKAN=ON -DUSE_ALSA=OFF -DUSE_PULSE=OFF -DUSE_AUDIOUNIT=ON \ + -DLLVM_CCACHE_BUILD=OFF -DLLVM_TARGETS_TO_BUILD="X86" -DLLVM_BUILD_RUNTIME=OFF -DLLVM_BUILD_TOOLS=OFF \ + -DLLVM_INCLUDE_DOCS=OFF -DLLVM_INCLUDE_EXAMPLES=OFF -DLLVM_INCLUDE_TESTS=OFF -DLLVM_INCLUDE_TOOLS=OFF \ + -DLLVM_INCLUDE_UTILS=OFF -DLLVM_USE_PERF=OFF -DLLVM_ENABLE_Z3_SOLVER=OFF \ + -DUSE_NATIVE_INSTRUCTIONS=OFF \ + -G Ninja -mkdir "rpcs3.app/Contents/lib/" -cp "/usr/local/opt/llvm/lib/libc++abi.1.0.dylib" "rpcs3.app/Contents/lib/libc++abi.1.dylib" -rm -rf "rpcs3.app/Contents/Frameworks/QtPdf.framework" \ -"rpcs3.app/Contents/Frameworks/QtQml.framework" \ -"rpcs3.app/Contents/Frameworks/QtQmlModels.framework" \ -"rpcs3.app/Contents/Frameworks/QtQuick.framework" \ -"rpcs3.app/Contents/Frameworks/QtVirtualKeyboard.framework" \ -"rpcs3.app/Contents/Plugins/platforminputcontexts" \ -"rpcs3.app/Contents/Plugins/virtualkeyboard" +ninja; build_status=$?; -mv rpcs3.app RPCS3_.app -mv RPCS3_.app RPCS3.app +cd .. -echo "[InternetShortcut]" > Quickstart.url -echo "URL=https://rpcs3.net/quickstart" >> Quickstart.url -echo "IconIndex=0" >> Quickstart.url +{ [ "$CI_HAS_ARTIFACTS" = "true" ]; +} && SHOULD_DEPLOY="true" || SHOULD_DEPLOY="false" -create-dmg --volname RPCS3 \ ---window-size 800 400 \ ---icon-size 100 \ ---icon rpcs3.app 200 190 \ ---add-file Quickstart.url Quickstart.url 400 20 \ ---hide-extension rpcs3.app \ ---hide-extension Quickstart.url \ ---app-drop-link 600 185 \ ---skip-jenkins \ -"$ARTDIR/rpcs3-v${COMM_TAG}-${COMM_COUNT}-${COMM_HASH}_macos.dmg" \ -RPCS3.app - -7z a -mx9 rpcs3-v"${COMM_TAG}"-"${COMM_COUNT}"-"${COMM_HASH}"_macos.7z RPCS3.app -mv rpcs3-v"${COMM_TAG}"-"${COMM_COUNT}"-"${COMM_HASH}"_macos.7z "$ARTDIR" +if [ "$build_status" -eq 0 ] && [ "$SHOULD_DEPLOY" = "true" ]; then + .ci/deploy-mac.sh +fi \ No newline at end of file diff --git a/.ci/deploy-linux.sh b/.ci/deploy-linux.sh index a4678ec02f..c71c2b5f73 100755 --- a/.ci/deploy-linux.sh +++ b/.ci/deploy-linux.sh @@ -42,7 +42,7 @@ if [ "$DEPLOY_APPIMAGE" = "true" ]; then ls - COMM_TAG="$(grep 'version{.*}' ../rpcs3/rpcs3_version.cpp | awk -F[\{,] '{printf "%d.%d.%d", $2, $3, $4}')" + COMM_TAG=$(awk '/version{.*}/ { printf("%d.%d.%d", $5, $6, $7) }' ../rpcs3/rpcs3_version.cpp) 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" diff --git a/.ci/deploy-mac.sh b/.ci/deploy-mac.sh new file mode 100755 index 0000000000..0bd2e7e4b9 --- /dev/null +++ b/.ci/deploy-mac.sh @@ -0,0 +1,56 @@ +#!/bin/sh -ex + +cd build || exit 1 + +# Gather explicit version number and number of commits +COMM_TAG=$(awk '/version{.*}/ { printf("%d.%d.%d", $5, $6, $7) }' ../rpcs3/rpcs3_version.cpp) +COMM_COUNT=$(git rev-list --count HEAD) +COMM_HASH=$(git rev-parse --short=8 HEAD) + +AVVER="${COMM_TAG}-${COMM_COUNT}" + +# AVVER is used for GitHub releases, it is the version number. +echo "AVVER=$AVVER" >> ../.ci/ci-vars.env + +cd bin +mkdir "rpcs3.app/Contents/lib/" +cp "/usr/local/opt/llvm/lib/libc++abi.1.0.dylib" "rpcs3.app/Contents/lib/libc++abi.1.dylib" +rm -rf "rpcs3.app/Contents/Frameworks/QtPdf.framework" \ +"rpcs3.app/Contents/Frameworks/QtQml.framework" \ +"rpcs3.app/Contents/Frameworks/QtQmlModels.framework" \ +"rpcs3.app/Contents/Frameworks/QtQuick.framework" \ +"rpcs3.app/Contents/Frameworks/QtVirtualKeyboard.framework" \ +"rpcs3.app/Contents/Plugins/platforminputcontexts" \ +"rpcs3.app/Contents/Plugins/virtualkeyboard" + +# Need to do this rename hack due to case insensitive filesystem +mv rpcs3.app RPCS3_.app +mv RPCS3_.app RPCS3.app + +echo "[InternetShortcut]" > Quickstart.url +echo "URL=https://rpcs3.net/quickstart" >> Quickstart.url +echo "IconIndex=0" >> Quickstart.url + +DMG_FILEPATH="$BUILD_ARTIFACTSTAGINGDIRECTORY/rpcs3-v${COMM_TAG}-${COMM_COUNT}-${COMM_HASH}_macos.dmg" + +create-dmg --volname RPCS3 \ +--window-size 800 400 \ +--icon-size 100 \ +--icon rpcs3.app 200 190 \ +--add-file Quickstart.url Quickstart.url 400 20 \ +--hide-extension rpcs3.app \ +--hide-extension Quickstart.url \ +--app-drop-link 600 185 \ +--skip-jenkins \ +"$DMG_FILEPATH" \ +RPCS3.app + +7z a -mx9 rpcs3-v"${COMM_TAG}"-"${COMM_COUNT}"-"${COMM_HASH}"_macos.7z RPCS3.app + +FILESIZE=$(stat -f %z "$DMG_FILEPATH") +SHA256SUM=$(shasum -a 256 "$DMG_FILEPATH" | awk '{ print $1 }') +cd .. +echo "${SHA256SUM};${FILESIZE}B" > "$RELEASE_MESSAGE" +cd bin + +mv ./rpcs3*_macos.7z "$ARTDIR" diff --git a/.ci/export-azure-vars.sh b/.ci/export-azure-vars.sh index 7ab0515200..033dd41cc8 100755 --- a/.ci/export-azure-vars.sh +++ b/.ci/export-azure-vars.sh @@ -10,4 +10,4 @@ while IFS='=' read -r key val; do # Skip over lines containing comments. [ "${key##\#*}" ] || continue echo "##vso[task.setvariable variable=$key]$val" -done < ".ci/azure-vars.env" +done < ".ci/ci-vars.env" diff --git a/.ci/export-cirrus-vars.sh b/.ci/export-cirrus-vars.sh index 9269ea89aa..561e77e92f 100644 --- a/.ci/export-cirrus-vars.sh +++ b/.ci/export-cirrus-vars.sh @@ -10,4 +10,4 @@ while IFS='=' read -r key val; do # Skip over lines containing comments. [ "${key##\#*}" ] || continue export "$key"="$val" -done < ".ci/azure-vars.env" +done < ".ci/ci-vars.env" diff --git a/.ci/setup-windows.sh b/.ci/setup-windows.sh index de96bb1530..4b1e5ca963 100755 --- a/.ci/setup-windows.sh +++ b/.ci/setup-windows.sh @@ -114,6 +114,6 @@ fi # BUILD is the name of the release artifact # AVVER is used for GitHub releases, it is the version number. BRANCH="${REPO_NAME}/${REPO_BRANCH}" -echo "BRANCH=$BRANCH" > .ci/azure-vars.env -echo "BUILD=$BUILD" >> .ci/azure-vars.env -echo "AVVER=$AVVER" >> .ci/azure-vars.env +echo "BRANCH=$BRANCH" > .ci/ci-vars.env +echo "BUILD=$BUILD" >> .ci/ci-vars.env +echo "AVVER=$AVVER" >> .ci/ci-vars.env diff --git a/.cirrus.yml b/.cirrus.yml index 523090e02c..a4ae6df519 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -4,7 +4,7 @@ env: SYSTEM_PULLREQUEST_SOURCEBRANCH: $CIRRUS_BRANCH SYSTEM_PULLREQUEST_PULLREQUESTID: $CIRRUS_PR BUILD_SOURCEVERSION: $CIRRUS_CHANGE_IN_REPO -# RPCS3_TOKEN: ENCRYPTED[13a0f18de9285e6c880e3aecbb54258245a74872af7d0fcb92447fa1200ceb6a4dc8acc880ddbf5e653d46336563ca72] # Replace this when we're using Cirrus for master releases!! + RPCS3_TOKEN: ENCRYPTED[!ae41646bdbbd52b490521e11e95583983708ac43befebf6b556767cac37bd8be65fb2a51ef2f215befbd487c24c3e67a!] windows_task: matrix: @@ -52,11 +52,11 @@ windows_task: artifacts: name: Artifact path: "*.7z*" -# push_script: | -# if [ "$CIRRUS_REPO_OWNER" = "RPCS3" ] && [ -z "$CIRRUS_PR" ] && [ "$CIRRUS_BRANCH" = "master" ]; then -# source './.ci/export-cirrus-vars.sh' -# './.ci/github-upload.sh' -# fi; + push_script: | + if [ "$CIRRUS_REPO_OWNER" = "RPCS3" ] && [ -z "$CIRRUS_PR" ] && [ "$CIRRUS_BRANCH" = "master" ]; then + source './.ci/export-cirrus-vars.sh' + './.ci/github-upload.sh' + fi; linux_task: container: @@ -65,6 +65,7 @@ linux_task: memory: 16G env: BUILD_ARTIFACTSTAGINGDIRECTORY: ${CIRRUS_WORKING_DIR}/artifacts + ARTDIR: ${CIRRUS_WORKING_DIR}/artifacts/ CCACHE_DIR: "/tmp/ccache_dir" CCACHE_MAXSIZE: 300M CI_HAS_ARTIFACTS: true @@ -72,7 +73,6 @@ linux_task: UPLOAD_REPO_FULL_NAME: "rpcs3/rpcs3-binaries-linux" DEPLOY_APPIMAGE: true APPDIR: "./appdir" - ARTDIR: ${CIRRUS_WORKING_DIR}/artifacts/ RELEASE_MESSAGE: "../GitHubReleaseMessage.txt" ccache_cache: folder: "/tmp/ccache_dir" @@ -92,10 +92,16 @@ linux_task: artifacts: name: Artifact path: "artifacts/*" -# push_script: | -# if [ "$CIRRUS_REPO_OWNER" = "RPCS3" ] && [ -z "$CIRRUS_PR" ] && [ "$CIRRUS_BRANCH" = "master" ] && [ "$COMPILER" = "gcc" ]; then -# '.ci/github-upload.sh' -# fi; + push_script: | + if [ "$CIRRUS_REPO_OWNER" = "RPCS3" ] && [ -z "$CIRRUS_PR" ] && [ "$CIRRUS_BRANCH" = "master" ] && [ "$COMPILER" = "gcc" ]; then + COMM_TAG=$(awk '/version{.*}/ { printf("%d.%d.%d", $5, $6, $7) }' ./rpcs3/rpcs3_version.cpp) + COMM_COUNT=$(git rev-list --count HEAD) + COMM_HASH=$(git rev-parse --short=8 HEAD) + + export AVVER="${COMM_TAG}-${COMM_COUNT}" + + .ci/github-upload.sh + fi; freebsd_task: matrix: @@ -124,10 +130,19 @@ macos_task: - mkdir artifacts - ".ci/build-mac.sh" env: + BUILD_ARTIFACTSTAGINGDIRECTORY: ${CIRRUS_WORKING_DIR}/artifacts ARTDIR: ${CIRRUS_WORKING_DIR}/artifacts/ CCACHE_DIR: "/tmp/ccache_dir" CCACHE_MAXSIZE: 300M CI_HAS_ARTIFACTS: true + UPLOAD_COMMIT_HASH: 51ae32f468089a8169aaf1567de355ff4a3e0842 + UPLOAD_REPO_FULL_NAME: "rpcs3/rpcs3-binaries-mac" + RELEASE_MESSAGE: "../GitHubReleaseMessage.txt" artifacts: name: Artifact path: "artifacts/rpcs3-*_macos.*" + push_script: | + if [ "$CIRRUS_REPO_OWNER" = "RPCS3" ] && [ -z "$CIRRUS_PR" ] && [ "$CIRRUS_BRANCH" = "master" ]; then + source './.ci/export-cirrus-vars.sh' + .ci/github-upload.sh + fi; diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 47b86931c8..f94c9c010d 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -49,11 +49,18 @@ jobs: condition: succeeded() artifact: RPCS3 for Linux ($(COMPILER)) - - bash: .ci/github-upload.sh - condition: and(ne(variables['Build.Reason'], 'PullRequest'), eq(variables['Build.Repository.Name'], 'RPCS3/rpcs3'), eq(variables['Build.SourceBranch'], 'refs/heads/master'), eq(variables['COMPILER'], 'gcc')) - displayName: Push build to GitHub - env: - RPCS3_TOKEN: $(RPCS3-Token) + # - bash: | + # COMM_TAG=$(awk '/version{.*}/ { printf("%d.%d.%d", $5, $6, $7) }' ./rpcs3/rpcs3_version.cpp) + # COMM_COUNT=$(git rev-list --count HEAD) + # COMM_HASH=$(git rev-parse --short=8 HEAD) + + # export AVVER="${COMM_TAG}-${COMM_COUNT}" + + # .ci/github-upload.sh + # condition: and(ne(variables['Build.Reason'], 'PullRequest'), eq(variables['Build.Repository.Name'], 'RPCS3/rpcs3'), eq(variables['Build.SourceBranch'], 'refs/heads/master'), eq(variables['COMPILER'], 'gcc')) + # displayName: Push build to GitHub + # env: + # RPCS3_TOKEN: $(RPCS3-Token) - job: Windows_Build variables: @@ -114,8 +121,8 @@ jobs: condition: succeeded() artifact: RPCS3 for Windows - - bash: .ci/github-upload.sh - condition: and(ne(variables['Build.Reason'], 'PullRequest'), eq(variables['Build.Repository.Name'], 'RPCS3/rpcs3'), eq(variables['Build.SourceBranch'], 'refs/heads/master')) - displayName: Push build to GitHub - env: - RPCS3_TOKEN: $(RPCS3-Token) + # - bash: .ci/github-upload.sh + # condition: and(ne(variables['Build.Reason'], 'PullRequest'), eq(variables['Build.Repository.Name'], 'RPCS3/rpcs3'), eq(variables['Build.SourceBranch'], 'refs/heads/master')) + # displayName: Push build to GitHub + # env: + # RPCS3_TOKEN: $(RPCS3-Token)