Skip to content

Commit

Permalink
feat(CI): integrate downloading & bundling quicksync tool
Browse files Browse the repository at this point in the history
  • Loading branch information
brusherru committed Feb 8, 2024
1 parent 4f8e9ed commit 1d63c75
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 4 deletions.
29 changes: 27 additions & 2 deletions .github/workflows/pr-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down Expand Up @@ -88,21 +93,31 @@ 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'
id: node-link
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: |
Expand All @@ -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 }}/*
Expand Down
29 changes: 27 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down Expand Up @@ -93,22 +98,32 @@ 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
with:
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'
id: node-link
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: |
Expand All @@ -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 }}/*
Expand Down
1 change: 1 addition & 0 deletions node/use-version-quicksync
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v0.1.0

0 comments on commit 1d63c75

Please sign in to comment.