Update combined dependencies #1197
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: PR Build | |
on: | |
workflow_dispatch: | |
pull_request: | |
jobs: | |
build-and-upload: | |
runs-on: ${{ matrix.image }} | |
strategy: | |
matrix: | |
include: | |
- image: macos-latest | |
id: macos | |
platform: macos | |
node: macOS | |
arch: '' # x64 | |
- image: windows-latest | |
id: windows | |
platform: windows | |
node: Windows | |
arch: '' # x64 | |
- image: ubuntu-latest | |
id: linux | |
platform: linux | |
node: Linux | |
arch: amd64 | |
- image: [self-hosted, macos, arm64] | |
id: macos-arm64 | |
platform: macos | |
node: macOS_ARM64 | |
arch: arm64 | |
- image: [self-hosted, linux, arm64] | |
id: linux-arm64 | |
platform: linux | |
node: Linux_ARM64 | |
arch: arm64 | |
outputs: | |
version: ${{ steps.package-version.outputs.version }} | |
steps: | |
- id: timestamp | |
run: echo "::set-output name=timestamp::$(date +'%s')" | |
- name: Check out Git repository | |
uses: actions/checkout@v2 | |
- name: Install Node.js, NPM | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '16' | |
cache: 'yarn' | |
- name: Get Smapp version | |
id: cur-package-version | |
uses: tyankatsu0105/read-package-version-actions@v1 | |
- name: Set package.json version | |
if: github.event_name == 'pull_request' | |
uses: HarmvZ/set-package-json-version-action@v0.1.2 | |
with: | |
version: ${{ steps.cur-package-version.outputs.version }}-pr.${{ github.event.pull_request.number }} | |
- name: yarn install | |
run: | | |
yarn config set network-timeout 300000 | |
yarn install --prefer-offline | |
- name: yarn lint | |
run: yarn lint | |
# Download go-spacemesh | |
- name: Get specified Go-spacemesh version | |
id: latestNode | |
run: echo "::set-output name=version::$(cat ./node/use-version)" | |
- 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 | |
- 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 }}/${{ matrix.node }}.zip" | |
- name: Check for go-spacemesh release archive existence | |
if: steps.cache-gospacemesh.outputs.cache-hit != 'true' | |
run: | | |
[[ $( curl -I -L -w "%{http_code}" -o ${{ matrix.platform == 'windows' && 'NUL' || '/dev/null'}} ${{steps.node-link.outputs.link}} ) == "200" ]] && | |
echo "Atifacts found: ${{steps.node-link.outputs.link}}" && exit 0 || | |
echo "Not found: ${{steps.node-link.outputs.link}}" && exit 1 | |
shell: bash | |
- id: platform | |
run: | | |
echo "::set-output name=dir::${{ matrix.platform == 'windows' && 'windows' || matrix.platform == 'macos' && 'mac' || 'linux'}}" | |
echo "::set-output name=ext::${{ matrix.platform == 'windows' && '.exe' || ''}}" | |
echo "::set-output name=rm_flag::${{ matrix.platform == 'windows' && '-Recurse -Force' || '-rf' }}" | |
- name: Download go-spacemesh release archive | |
if: steps.cache-gospacemesh.outputs.cache-hit != 'true' | |
run: | | |
curl -L --output ./node/release.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/release.zip 'go-spacemesh*' '*.dylib' 'Molt*' '*.so' '*.dll' '*.lib' '*.h' 'profiler*' -r -y | |
- name: Set CHMOD on Go-Spacemesh and libs | |
if: matrix.platform != 'windows' | |
run: chmod -R +x ./node/${{ steps.platform.outputs.dir }}/* | |
- name: Disable quarantine for Go-Spacemesh and libs (macOS x64) | |
if: matrix.id == 'macos' | |
run: sudo xattr -rd com.apple.quarantine ./node/${{ steps.platform.outputs.dir }}/* | |
- name: Disable quarantine for Go-Spacemesh and libs (macOS ARM64) | |
if: matrix.id == 'macos-arm64' | |
run: sudo /Users/aviv/xattr.sh | |
- name: ls ./node | |
run: | | |
7z l ./node/release.zip | |
ls ${{matrix.platform != 'windows' && '-la' || ''}} ./node/${{ steps.platform.outputs.dir }}/ | |
- name: Install libOpenCL.so | |
if: matrix.id == 'linux' | |
run: | | |
sudo apt update | |
sudo apt install ocl-icd-opencl-dev | |
# Run tests | |
- name: yarn test | |
if: matrix.id == 'macos' | |
run: yarn test --forceExit | |
# Build | |
- name: yarn build | |
run: yarn build | |
env: | |
SENTRY_DSN: ${{ secrets.SENTRY_DSN }} | |
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} | |
SENTRY_ENV: pr-builds | |
# Create binaries | |
- if: matrix.platform == 'linux' | |
name: Build linux app | |
run: | | |
echo "USE_SYSTEM_FPM?$(echo $USE_SYSTEM_FPM)" | |
yarn package-linux | |
env: | |
SENTRY_DSN: ${{ secrets.SENTRY_DSN }} | |
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} | |
SENTRY_ENV: pr-builds | |
USE_SYSTEM_FPM: ${{ matrix.id == 'linux-arm64' && 'true' }} | |
- if: matrix.platform == 'windows' | |
name: Build windows app | |
run: yarn package-win | |
env: | |
DONT_SIGN_APP: true # Do not sign the development artifacts | |
SENTRY_DSN: ${{ secrets.SENTRY_DSN }} | |
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} | |
SENTRY_ENV: pr-builds | |
- if: matrix.platform == 'macos' | |
name: Build mac app | |
run: yarn package-mac | |
env: | |
DONT_SIGN_APP: true # Do not sign the development artifacts | |
SENTRY_DSN: ${{ secrets.SENTRY_DSN }} | |
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} | |
SENTRY_ENV: pr-builds | |
- name: ls ./release | |
run: ls ${{matrix.platform != 'windows' && '-la' || ''}} ./release | |
# Upload artifacts to GCS | |
- name: get-smapp-version | |
id: package-version | |
uses: tyankatsu0105/read-package-version-actions@v1 | |
- name: Smapp version | |
run: | | |
echo "Version: ${{ steps.package-version.outputs.version }}" | |
- name: Set up GCloud SDK | |
uses: google-github-actions/setup-gcloud@v0 | |
with: | |
project_id: ${{ secrets.GCP_PROJECT_ID }} | |
service_account_key: ${{ secrets.GCP_SA_KEY }} | |
export_default_credentials: true | |
- if: matrix.platform == 'macos' | |
name: upload macos build | |
uses: google-github-actions/upload-cloud-storage@v0 | |
env: | |
preSuffix: ${{ matrix.arch != '' && '-' || '' }} | |
with: | |
path: ./release/Spacemesh-${{ steps.package-version.outputs.version }}${{ env.preSuffix }}${{ matrix.arch }}.dmg | |
destination: ${{ secrets.GCP_BUCKET }}/pr-${{ github.sha }} | |
- if: matrix.platform == 'windows' | |
name: upload windows build | |
uses: google-github-actions/upload-cloud-storage@v0 | |
with: | |
path: ./release/Spacemesh Setup ${{ steps.package-version.outputs.version }}.exe | |
destination: ${{ secrets.GCP_BUCKET }}/pr-${{ github.sha }} | |
- if: matrix.platform == 'linux' | |
name: upload linux build | |
uses: google-github-actions/upload-cloud-storage@v0 | |
env: | |
preSuffix: ${{ matrix.arch != '' && '_' || '' }} | |
with: | |
path: ./release/spacemesh_app_${{ steps.package-version.outputs.version }}${{ env.preSuffix }}${{ matrix.arch }}.deb | |
destination: ${{ secrets.GCP_BUCKET }}/pr-${{ github.sha }} | |
- if: matrix.platform == 'linux' | |
name: upload linux build | |
uses: google-github-actions/upload-cloud-storage@v0 | |
env: | |
arch: ${{ matrix.arch == 'arm64' && '-arm64' || '' }} | |
with: | |
path: ./release/Spacemesh-${{ steps.package-version.outputs.version }}${{ env.arch }}.AppImage | |
destination: ${{ secrets.GCP_BUCKET }}/pr-${{ github.sha }} | |
post-links: | |
runs-on: ubuntu-latest | |
needs: build-and-upload | |
steps: | |
- name: Links to artifacts | |
run: | | |
echo "Windows (x64): https://storage.googleapis.com/smapp/pr-${{ github.sha }}/Spacemesh%20Setup%20${{ needs.build-and-upload.outputs.version }}.exe" | |
echo "macOS (x64): https://storage.googleapis.com/smapp/pr-${{ github.sha }}/Spacemesh-${{ needs.build-and-upload.outputs.version }}.dmg" | |
echo "macOS (arm64): https://storage.googleapis.com/smapp/pr-${{ github.sha }}/Spacemesh-${{ needs.build-and-upload.outputs.version }}-arm64.dmg" | |
echo "Linux (deb, amd64): https://storage.googleapis.com/smapp/pr-${{ github.sha }}/spacemesh_app_${{ needs.build-and-upload.outputs.version }}_amd64.deb" | |
echo "Linux (AppImage, amd64): https://storage.googleapis.com/smapp/pr-${{ github.sha }}/Spacemesh-${{ needs.build-and-upload.outputs.version }}.AppImage" | |
echo "Linux (deb, arm64): https://storage.googleapis.com/smapp/pr-${{ github.sha }}/spacemesh_app_${{ needs.build-and-upload.outputs.version }}_arm64.deb" | |
echo "Linux (AppImage, arm64): https://storage.googleapis.com/smapp/pr-${{ github.sha }}/Spacemesh-${{ needs.build-and-upload.outputs.version }}-arm64.AppImage" | |
- name: Post links to PR | |
if: github.event_name == 'pull_request' | |
uses: mshick/add-pr-comment@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
message: | | |
## Compiled Binaries | |
- Windows: [x64](https://storage.googleapis.com/smapp/pr-${{ github.sha }}/Spacemesh%20Setup%20${{ needs.build-and-upload.outputs.version }}.exe) | |
- macOS: [x64](https://storage.googleapis.com/smapp/pr-${{ github.sha }}/Spacemesh-${{ needs.build-and-upload.outputs.version }}.dmg) [arm64](https://storage.googleapis.com/smapp/pr-${{ github.sha }}/Spacemesh-${{ needs.build-and-upload.outputs.version }}-arm64.dmg) | |
- Linux | |
- AppImage [x64](https://storage.googleapis.com/smapp/pr-${{ github.sha }}/Spacemesh-${{ needs.build-and-upload.outputs.version }}.AppImage) [arm64](https://storage.googleapis.com/smapp/pr-${{ github.sha }}/Spacemesh-${{ needs.build-and-upload.outputs.version }}-arm64.AppImage) | |
- deb [x64](https://storage.googleapis.com/smapp/pr-${{ github.sha }}/spacemesh_app_${{ needs.build-and-upload.outputs.version }}_amd64.deb) [arm64](https://storage.googleapis.com/smapp/pr-${{ github.sha }}/spacemesh_app_${{ needs.build-and-upload.outputs.version }}_arm64.deb) |