From 1d63c75dc808eb48da685b5786e446bbe2a7e986 Mon Sep 17 00:00:00 2001 From: brusher_ru Date: Thu, 8 Feb 2024 16:49:41 +0700 Subject: [PATCH] feat(CI): integrate downloading & bundling quicksync tool --- .github/workflows/pr-build.yml | 29 +++++++++++++++++++++++++++-- .github/workflows/release.yml | 29 +++++++++++++++++++++++++++-- node/use-version-quicksync | 1 + 3 files changed, 55 insertions(+), 4 deletions(-) create mode 100644 node/use-version-quicksync diff --git a/.github/workflows/pr-build.yml b/.github/workflows/pr-build.yml index 3622ebe9a..a62fe1365 100644 --- a/.github/workflows/pr-build.yml +++ b/.github/workflows/pr-build.yml @@ -16,26 +16,31 @@ jobs: platform: macos node: mac-amd64 arch: '' # x64 + quicksync: macos - image: windows-latest id: windows platform: windows node: win-amd64 arch: '' # x64 + quicksync: windows - image: ubuntu-latest id: linux platform: linux node: linux-amd64 arch: amd64 + quicksync: linux - image: [smapp] id: macos-arm64 platform: macos node: mac-arm64 arch: arm64 + quicksync: macos-m1 - image: [self-hosted, linux, arm64] id: linux-arm64 platform: linux node: linux-arm64 arch: arm64 + quicksync: linux-arm64 outputs: version: ${{ steps.package-version.outputs.version }} @@ -88,14 +93,18 @@ jobs: id: latestNode run: echo "::set-output name=version::$(cat ./node/use-version)" + - name: Get specified Quicksync version + id: latestQuicksync + run: echo "::set-output name=version::$(cat ./node/use-version-quicksync)" + - id: cache-gospacemesh uses: actions/cache@v3 with: path: | ./node/* !./node/use-version - key: ${{ matrix.node }}-${{ hashFiles('./node/use-version') }}-cache - restore-keys: ${{ matrix.node }}-${{ hashFiles('./node/use-version') }}-cache + key: ${{ matrix.node }}-${{ hashFiles('./node/use-version') }}-${{ hashFiles('./node/use-version-quicksync') }} + restore-keys: ${{ matrix.node }}-${{ hashFiles('./node/use-version') }}-${{ hashFiles('./node/use-version-quicksync') }} - name: Prepare link to go-spacemesh release archive if: steps.cache-gospacemesh.outputs.cache-hit != 'true' @@ -103,6 +112,12 @@ jobs: run: | echo "::set-output name=link::https://storage.googleapis.com/go-spacemesh-release-builds/${{ steps.latestNode.outputs.version }}/go-spacemesh-${{ steps.latestNode.outputs.version }}-${{ matrix.node }}.zip" + - name: Prepare link to quicksync release archive + if: steps.cache-gospacemesh.outputs.cache-hit != 'true' + id: quicksync-link + run: | + echo "::set-output name=link::https://github.com/spacemeshos/quicksync-rs/releases/download/${{ steps.latestQuicksync.outputs.version }}/quicksync-${{ matrix.quicksync }}-${{ steps.latestQuicksync.outputs.version }}.zip" + - name: Check for go-spacemesh release archive existence if: steps.cache-gospacemesh.outputs.cache-hit != 'true' run: | @@ -127,6 +142,16 @@ jobs: run: | 7z e -onode/${{ steps.platform.outputs.dir }}/ ./node/release.zip 'go-spacemesh*' '*.dylib' 'Molt*' '*.so' '*.dll' '*.lib' '*.h' 'profiler*' -r -y + - name: Download quicksync tool + if: steps.cache-gospacemesh.outputs.cache-hit != 'true' + run: | + curl -L -H "Authorization: token ${{ secrets.PERSONAL_ACCESS_TOKEN }}" --output ./node/quicksync.zip --create-dirs ${{steps.node-link.outputs.link}} + + - name: Unzip archive & get rid of redundant files + if: steps.cache-gospacemesh.outputs.cache-hit != 'true' + run: | + 7z e -onode/${{ steps.platform.outputs.dir }}/ ./node/quicksync.zip 'quicksync*' -r -y + - name: Set CHMOD on Go-Spacemesh and libs if: matrix.platform != 'windows' run: chmod -R +x ./node/${{ steps.platform.outputs.dir }}/* diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 674caf8d7..3833aefd7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -17,26 +17,31 @@ jobs: platform: macos node: mac-amd64 arch: '' # x64 + quicksync: macos - image: windows-latest id: windows platform: windows node: win-amd64 arch: '' # x64 + quicksync: windows - image: ubuntu-latest id: linux platform: linux node: linux-amd64 arch: amd64 + quicksync: linux - image: [smapp] id: macos-arm64 platform: macos node: mac-arm64 arch: arm64 + quicksync: macos-m1 - image: [self-hosted, linux, arm64] id: linux-arm64 platform: linux node: linux-arm64 arch: arm64 + quicksync: linux-arm64 outputs: tagName: ${{ steps.tagName.outputs.tag }} @@ -93,6 +98,10 @@ jobs: id: latestNode run: echo "::set-output name=version::$(cat ./node/use-version)" + - name: Get specified Quicksync version + id: latestQuicksync + run: echo "::set-output name=version::$(cat ./node/use-version-quicksync)" + - name: Restore go-spacemesh from cache id: cache-gospacemesh uses: actions/cache@v3 @@ -100,8 +109,8 @@ jobs: path: | ./node/* !./node/use-version - key: ${{ matrix.node }}-${{ hashFiles('./node/use-version') }}-4 - restore-keys: ${{ matrix.node }}-${{ hashFiles('./node/use-version') }}-4 + key: ${{ matrix.node }}-${{ hashFiles('./node/use-version') }}-${{ hashFiles('./node/use-version-quicksync') }} + restore-keys: ${{ matrix.node }}-${{ hashFiles('./node/use-version') }}-${{ hashFiles('./node/use-version-quicksync') }} - name: Prepare link to go-spacemesh release archive if: steps.cache-gospacemesh.outputs.cache-hit != 'true' @@ -109,6 +118,12 @@ jobs: run: | echo "::set-output name=link::https://storage.googleapis.com/go-spacemesh-release-builds/${{ steps.latestNode.outputs.version }}/go-spacemesh-${{ steps.latestNode.outputs.version }}-${{ matrix.node }}.zip" + - name: Prepare link to quicksync release archive + if: steps.cache-gospacemesh.outputs.cache-hit != 'true' + id: quicksync-link + run: | + echo "::set-output name=link::https://github.com/spacemeshos/quicksync-rs/releases/download/${{ steps.latestQuicksync.outputs.version }}/quicksync-${{ matrix.quicksync }}-${{ steps.latestQuicksync.outputs.version }}.zip" + - name: Check for go-spacemesh release archive existence if: steps.cache-gospacemesh.outputs.cache-hit != 'true' run: | @@ -134,6 +149,16 @@ jobs: run: | 7z e -onode/${{ steps.platform.outputs.dir }}/ ./node/release.zip 'go-spacemesh*' '*.dylib' 'Molt*' '*.so' '*.dll' '*.lib' '*.h' 'profiler*' -r + - name: Download quicksync tool + if: steps.cache-gospacemesh.outputs.cache-hit != 'true' + run: | + curl -L -H "Authorization: token ${{ secrets.PERSONAL_ACCESS_TOKEN }}" --output ./node/quicksync.zip --create-dirs ${{steps.node-link.outputs.link}} + + - name: Unzip archive & get rid of redundant files + if: steps.cache-gospacemesh.outputs.cache-hit != 'true' + run: | + 7z e -onode/${{ steps.platform.outputs.dir }}/ ./node/quicksync.zip 'quicksync*' -r -y + - name: Set CHMOD on Go-Spacemesh and libs if: matrix.platform != 'windows' run: chmod -R +x ./node/${{ steps.platform.outputs.dir }}/* diff --git a/node/use-version-quicksync b/node/use-version-quicksync new file mode 100644 index 000000000..9ff151c5b --- /dev/null +++ b/node/use-version-quicksync @@ -0,0 +1 @@ +v0.1.0 \ No newline at end of file