From 39b49e46f265b41545c28a1b14e1ede85cb3921a Mon Sep 17 00:00:00 2001 From: PatTheMav Date: Fri, 2 Jun 2023 23:49:20 +0200 Subject: [PATCH] CI: Update workflow to package dSYMs --- .../action.yml | 56 ++++++-- .github/actions/build-macos-deps/action.yml | 63 -------- .github/workflows/main.yml | 136 ++++++++++++------ 3 files changed, 132 insertions(+), 123 deletions(-) rename .github/actions/{build-windows-deps => build-deps}/action.yml (58%) delete mode 100644 .github/actions/build-macos-deps/action.yml diff --git a/.github/actions/build-windows-deps/action.yml b/.github/actions/build-deps/action.yml similarity index 58% rename from .github/actions/build-windows-deps/action.yml rename to .github/actions/build-deps/action.yml index b892e2b8e..616a36561 100644 --- a/.github/actions/build-windows-deps/action.yml +++ b/.github/actions/build-deps/action.yml @@ -1,5 +1,5 @@ -name: 'Build Windows Dependencies' -description: 'Builds Windows dependencies for obs-deps with specified architecture, type, and build config' +name: 'Build Dependencies' +description: 'Builds dependencies for obs-deps with specified architecture, type, and build config' inputs: target: description: 'Build target for dependencies' @@ -21,18 +21,25 @@ runs: steps: - name: Environment Setup id: env-setup - shell: pwsh + shell: bash + working-directory: ${{ inputs.workingDirectory }} run: | - # Environment Setup - - $Content = Get-Content ${{ inputs.workingDirectory }}/deps.windows/*.ps1 - - $Sha256Hasher = [System.Security.Cryptography.HashAlgorithm]::Create('sha256') - $ContentHash = $Sha256Hasher.ComputeHash([System.Text.Encoding]::UTF8.GetBytes($Content)) + : Environment Setup + case "${RUNNER_OS}" in + macOS) + if ! type sha256sum > /dev/null 2>&1; then + brew install coreutils + fi + deps_hash=$(cat ${PWD}/deps.macos/*.zsh | sha256sum | cut -d " " -f 1) + ;; + Windows) + deps_hash=$(cat ${PWD}/deps.windows/*.ps1 | sha256sum | cut -d " " -f 1) + ;; + esac - "hash=$([System.BitConverter]::ToString($ContentHash).Replace('-','').SubString(0,9).ToLower())" >> $env:GITHUB_OUTPUT + echo "hash=${deps_hash:0:9}" >> $GITHUB_OUTPUT - - name: Restore Windows Dependencies from Cache + - name: Restore Dependencies from Cache id: deps-cache uses: actions/cache/restore@v3 with: @@ -42,12 +49,30 @@ runs: !${{ inputs.workingDirectory }}/*_build_temp/*.tar.gz !${{ inputs.workingDirectory }}/*_build_temp/*.tar.xz !${{ inputs.workingDirectory }}/*_build_temp/*.zip + !${{ inputs.workingDirectory }}/*_build_temp/qt* key: ${{ inputs.target }}-deps-${{ inputs.type }}-${{ inputs.config }}-${{ steps.env-setup.outputs.hash }} - - name: Install Windows Dependencies + - name: Build and Install Dependencies + if: runner.os == 'macOS' + shell: zsh --no-rcs --errexit --pipefail {0} + run: | + : Build and Install macOS Dependencies + + local -a build_args=( + --target ${{ inputs.target }} + --config ${{ inputs.config }} + --${{ inputs.type }} + ) + + if [[ '${{ steps.ffmpeg-cache.outputs.cache-hit }}' == 'true' ]] build_args+=(--skip-build --skip-unpack) + + ./build-deps.zsh ${build_args} + + - name: Build and Install Dependencies + if: runner.os == 'Windows' shell: pwsh run: | - # Install Windows Dependencies + # Build and Install Windows Dependencies $Params = @{ Target = '${{ inputs.target }}' @@ -59,9 +84,9 @@ runs: ./Build-Dependencies.ps1 @Params - - name: Save Windows Dependencies to Cache - uses: actions/cache/save@v3 + - name: Save Dependencies to Cache if: github.event_name == 'push' + uses: actions/cache/save@v3 with: path: | ${{ inputs.workingDirectory }}/*_build_temp/* @@ -69,4 +94,5 @@ runs: !${{ inputs.workingDirectory }}/*_build_temp/*.tar.gz !${{ inputs.workingDirectory }}/*_build_temp/*.tar.xz !${{ inputs.workingDirectory }}/*_build_temp/*.zip + !${{ inputs.workingDirectory }}/*_build_temp/qt* key: ${{ inputs.target }}-deps-${{ inputs.type }}-${{ inputs.config }}-${{ steps.env-setup.outputs.hash }} diff --git a/.github/actions/build-macos-deps/action.yml b/.github/actions/build-macos-deps/action.yml deleted file mode 100644 index 9f738494a..000000000 --- a/.github/actions/build-macos-deps/action.yml +++ /dev/null @@ -1,63 +0,0 @@ -name: 'Build macOS Dependencies' -description: 'Builds macOS dependencies for obs-deps with specified architecture, type, and build config' -inputs: - target: - description: 'Build target for dependencies' - required: true - type: - description: 'Build type (shared or static libraries)' - required: false - default: 'static' - config: - description: 'Build configuration' - required: false - default: 'Release' - cacheRevision: - description: 'Cache revision number to force creation of new cache generation' - required: false - default: '01' -runs: - using: 'composite' - steps: - - name: Environment Setup - id: deps-env-setup - shell: bash - run: | - case "${{ runner.os }}" in - Linux) - if ! type zsh > /dev/null 2>&1; then - sudo apt update - sudo apt install zsh - fi - ;; - macOS) - if ! type sha256sum > /dev/null 2>&1; then - brew install coreutils - fi - esac - - deps_hash=$(cat ${{ github.workspace }}/deps.macos/*.zsh | sha256sum | cut -d " " -f 1) - echo "hash=${deps_hash}" >> $GITHUB_OUTPUT - - - name: Restore macOS Dependencies from Cache - id: deps-cache - uses: actions/cache@v3 - with: - path: | - ${{ github.workspace }}/*_build_temp/* - !${{ github.workspace }}/*_build_temp/**/.git - !${{ github.workspace }}/*_build_temp/*.tar.gz - !${{ github.workspace }}/*_build_temp/*.tar.xz - !${{ github.workspace }}/*_build_temp/*.zip - !${{ github.workspace }}/*_build_temp/qt* - key: ${{ inputs.target }}-deps-${{ inputs.type }}-${{ steps.deps-env-setup.outputs.hash }}-${{ inputs.cacheRevision }} - - - name: Install macOS Dependencies - if: ${{ steps.deps-cache.outputs.cache-hit == 'true' }} - shell: zsh {0} - run: ./build-deps.zsh --skip-build --skip-unpack --target ${{ inputs.target }} --config ${{ inputs.config }} --${{ inputs.type }} - - - name: Build and Install macOS Dependencies - if: ${{ steps.deps-cache.outputs.cache-hit != 'true' }} - shell: zsh {0} - run: ./build-deps.zsh --target ${{ inputs.target }} --config ${{ inputs.config }} --${{ inputs.type }} diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 1acf81955..d30c0dfb5 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -122,9 +122,13 @@ jobs: target='${{ matrix.target }}' artifact_name="ffmpeg-${target}-${{ github.sha }}" file_name="${target%%-*}-ffmpeg-$(date +"%Y-%m-%d")-${target##*-}.tar.xz" + dsym_artifact_name="ffmpeg-${target}-dSYMs-${{ github.sha }}" + dsym_file_name="${target%%-*}-ffmpeg-$(date +"%Y-%m-%d")-${target##*-}-dSYMs.tar.xz" echo "artifactName=${artifact_name}" >> $GITHUB_OUTPUT echo "artifactFileName=${file_name}" >> $GITHUB_OUTPUT + echo "dsymArtifactName=${dsym_artifact_name}" >> $GITHUB_OUTPUT + echo "dsymArtifactFileName=${dsym_file_name}" >> $GITHUB_OUTPUT echo "ccacheDate=$(date +"%Y-%m-%d")" >> $GITHUB_OUTPUT - name: Restore Compilation Cache @@ -161,6 +165,13 @@ jobs: name: ${{ steps.setup.outputs.artifactName }} path: ${{ github.workspace }}/${{ matrix.target }}/${{ steps.setup.outputs.artifactFileName }} + - name: Publish Debug Symbol Artifacts + if: ${{ startsWith(matrix.os, 'macos') && success() && (github.event_name != 'pull_request' || steps.seekingTesters.outputs.found == 'true') }} + uses: actions/upload-artifact@v3 + with: + name: ${{ steps.setup.outputs.dsymArtifactName }} + path: ${{ github.workspace }}/${{ matrix.target }}/${{ steps.setup.outputs.dsymArtifactFileName }} + ffmpeg-package-universal: name: 'Build FFmpeg (Universal)' runs-on: macos-12 @@ -187,25 +198,32 @@ jobs: x86_64: 'ffmpeg-macos-x86_64-${{ github.sha }}' outputName: 'ffmpeg-macos-universal-${{ github.sha }}' + - name: Create universal dSYM package + if: ${{ success() && (github.event_name != 'pull_request' || steps.seekingTesters.outputs.found == 'true') }} + uses: ./.github/actions/create-universal + with: + arm64: 'ffmpeg-macos-arm64-dSYMs-${{ github.sha }}' + x86_64: 'ffmpeg-macos-x86_64-dSYMs-${{ github.sha }}' + outputName: 'ffmpeg-macos-universal-dSYMs-${{ github.sha }}' + macos-build: - name: 'Build macOS Dependencies' - runs-on: macos-12 + name: Build macOS Dependencies + runs-on: macos-13 + needs: pre-checks strategy: fail-fast: true matrix: target: [macos-arm64, macos-x86_64] include: - target: macos-arm64 - config: 'Release' - type: 'static' + config: Release + type: static - target: macos-x86_64 - config: 'Release' - type: 'static' - env: - CACHE_REVISION: '3' + config: Release + type: static defaults: run: - shell: zsh {0} + shell: zsh --no-rcs --errexit --pipefail {0} steps: - name: Checkout uses: actions/checkout@v3 @@ -213,6 +231,8 @@ jobs: - name: Setup Environment id: setup run: | + : Setup Environment + to_remove=() for formula (llvm gcc) { @@ -221,73 +241,80 @@ jobs: if (( #to_remove )) brew uninstall --ignore-dependencies ${to_remove} - target='${{ matrix.target }}' - artifact_name="deps-${target}-${{ github.sha }}" - file_name="${target%%-*}-deps-$(date +"%Y-%m-%d")-${target##*-}.tar.xz" + local -r date_string=$(date +"%Y-%m-%d") + local -r target='${{ matrix.target }}' + + artifact_name="deps-${target}-${{ needs.pre-checks.outputs.shortHash }}" + file_name="${target%%-*}-deps-${date_string}-${target##*-}.tar.xz" + dsym_artifact_name="deps-${target}-dSYMs-${{ needs.pre-checks.outputs.shortHash }}" + dsym_file_name="${target%%-*}-deps-${date_string}-${target##*-}-dSYMs.tar.xz" echo "artifactName=${artifact_name}" >> $GITHUB_OUTPUT echo "artifactFileName=${file_name}" >> $GITHUB_OUTPUT - echo "ccacheDate=$(date +"%Y-%m-%d")" >> $GITHUB_OUTPUT + echo "dsymArtifactName=${dsym_artifact_name}" >> $GITHUB_OUTPUT + echo "dsymArtifactFileName=${dsym_file_name}" >> $GITHUB_OUTPUT + echo "ccacheDate=${date_string}" >> $GITHUB_OUTPUT - name: Restore Compilation Cache id: ccache-cache - uses: actions/cache@v3 + uses: actions/cache/restore@v3 with: path: ${{ github.workspace }}/.ccache key: ${{ matrix.target }}-ccache-deps-${{ steps.setup.outputs.ccacheDate }} restore-keys: | ${{ matrix.target }}-ccache-deps- - - name: Check for GitHub Labels - id: seekingTesters - if: ${{ github.event_name == 'pull_request' }} - run: | - if [[ -n "$(curl -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" -s "${{ github.event.pull_request.url }}" | jq -e '.labels[] | select(.name == "Seeking Testers")')" ]]; then - echo "found=true" >> $GITHUB_OUTPUT - else - echo "found=false" >> $GITHUB_OUTPUT - fi - - name: Build macOS Dependencies - uses: ./.github/actions/build-macos-deps + uses: ./.github/actions/build-deps with: target: ${{ matrix.target }} type: ${{ matrix.type }} config: ${{ matrix.config }} - cacheRevision: ${{ env.CACHE_REVISION }} - name: Publish Build Artifacts - if: ${{ success() && (github.event_name != 'pull_request' || steps.seekingTesters.outputs.found == 'true') }} + if: github.event_name != 'pull_request' || fromJSON(needs.pre-checks.outputs.seekingTesters) uses: actions/upload-artifact@v3 with: name: ${{ steps.setup.outputs.artifactName }} path: ${{ github.workspace }}/${{ matrix.target }}/${{ steps.setup.outputs.artifactFileName }} + - name: Publish Debug Symbol Artifacts + if: github.event_name != 'pull_request' || fromJSON(needs.pre-checks.outputs.seekingTesters) + uses: actions/upload-artifact@v3 + with: + name: ${{ steps.setup.outputs.dsymArtifactName }} + path: ${{ github.workspace }}/${{ matrix.target }}/${{ steps.setup.outputs.dsymArtifactFileName }} + + - name: Save Compilation Cache + if: github.event_name == 'push' + uses: actions/cache/save@v3 + with: + path: ${{ github.workspace }}/.ccache + key: ${{ matrix.target }}-ccache-deps-${{ steps.setup.outputs.ccacheDate }} + macos-package-universal: - name: 'Build macOS Dependencies (Universal)' - runs-on: macos-12 - needs: [macos-build] + name: Build macOS Dependencies (Universal) + runs-on: macos-13 + needs: [pre-checks, macos-build] steps: - name: Checkout uses: actions/checkout@v3 - - name: Check for GitHub Labels - id: seekingTesters - if: ${{ github.event_name == 'pull_request' }} - run: | - if [[ -n "$(curl -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" -s "${{ github.event.pull_request.url }}" | jq -e '.labels[] | select(.name == "Seeking Testers")')" ]]; then - echo "found=true" >> $GITHUB_OUTPUT - else - echo "found=false" >> $GITHUB_OUTPUT - fi - - name: Create universal binary package - if: ${{ success() && (github.event_name != 'pull_request' || steps.seekingTesters.outputs.found == 'true') }} + if: github.event_name != 'pull_request' || fromJSON(needs.pre-checks.outputs.seekingTesters) + uses: ./.github/actions/create-universal + with: + arm64: deps-macos-arm64-${{ needs.pre-checks.outputs.shortHash }} + x86_64: deps-macos-x86_64-${{ needs.pre-checks.outputs.shortHash }} + outputName: deps-macos-universal-${{ needs.pre-checks.outputs.shortHash }} + + - name: Create universal dSYM package + if: github.event_name != 'pull_request' || fromJSON(needs.pre-checks.outputs.seekingTesters) uses: ./.github/actions/create-universal with: - arm64: 'deps-macos-arm64-${{ github.sha }}' - x86_64: 'deps-macos-x86_64-${{ github.sha }}' - outputName: 'deps-macos-universal-${{ github.sha }}' + arm64: deps-macos-arm64-dSYMs-${{ needs.pre-checks.outputs.shortHash }} + x86_64: deps-macos-x86_64-dSYMs-${{ needs.pre-checks.outputs.shortHash }} + outputName: deps-macos-universal-dSYMs-${{ needs.pre-checks.outputs.shortHash }} macos-qt6-build: name: Build Qt6 (macOS) @@ -315,9 +342,13 @@ jobs: local -r date_string=$(date +"%Y-%m-%d") artifact_name="qt6-macos-universal-${{ needs.pre-checks.outputs.shortHash }}" file_name="macos-deps-qt6-${date_string}-universal.tar.xz" + dsym_artifact_name="qt6-macos-universal-dSYMs-${{ needs.pre-checks.outputs.shortHash }}" + dsym_file_name="macos-deps-qt6-${date_string}-universal-dSYMs.tar.xz" print "artifactName=${artifact_name}" >> $GITHUB_OUTPUT print "artifactFileName=${file_name}" >> $GITHUB_OUTPUT + print "dsymArtifactName=${dsym_artifact_name}" >> $GITHUB_OUTPUT + print "dsymArtifactFileName=${dsym_file_name}" >> $GITHUB_OUTPUT print "ccacheDate=${date_string}" >> $GITHUB_OUTPUT - name: Restore Compilation Cache @@ -342,6 +373,13 @@ jobs: name: ${{ steps.setup.outputs.artifactName }} path: ${{ github.workspace }}/macos-universal/${{ steps.setup.outputs.artifactFileName }} + - name: Publish Debug Symbol Artifacts + if: github.event_name != 'pull_request' || fromJSON(needs.pre-checks.outputs.seekingTesters) + uses: actions/upload-artifact@v3 + with: + name: ${{ steps.setup.outputs.dsymArtifactName }} + path: ${{ github.workspace }}/macos-universal/${{ steps.setup.outputs.dsymArtifactFileName }} + - name: Save Compilation Cache if: github.event_name == 'push' uses: actions/cache/save@v3 @@ -374,6 +412,14 @@ jobs: target: ${{ matrix.target }} outputName: qt6-${{ matrix.target }}-${{ needs.pre-checks.outputs.shortHash }} + - name: Create single architecture dSYM package + if: github.event_name != 'pull_request' || fromJSON(needs.pre-checks.outputs.seekingTesters) + uses: ./.github/actions/create-single-arch + with: + base: qt6-macos-universal-dSYMs-${{ needs.pre-checks.outputs.shortHash }} + target: ${{ matrix.target }} + outputName: qt6-${{ matrix.target }}-dSYMs-${{ needs.pre-checks.outputs.shortHash }} + windows-build: name: Build Windows Dependencies runs-on: windows-2022 @@ -424,7 +470,7 @@ jobs: Remove-Item -Recurse -Force ${{ github.workspace }}/windows_build_temp - name: Build Windows Dependencies - uses: ./.github/actions/build-windows-deps + uses: ./.github/actions/build-deps with: target: ${{ matrix.target }} type: ${{ matrix.type }}