Skip to content

Update to vega 0.74.3 #1709

Update to vega 0.74.3

Update to vega 0.74.3 #1709

Workflow file for this run

name: Build binaries
on:
push:
branches:
- develop
- main
pull_request:
branches:
- develop
- main
permissions:
id-token: write
contents: read
checks: write
env:
WAILS_VERSION: v2.8.0
NODE_VERSION: 18.12.0
GO_VERSION: 1.21.7
jobs:
download-frontend:
name: Download frontend dependencies
runs-on: macos-latest
steps:
- name: Check out repository
uses: actions/checkout@v3
- name: Set up Node ${{ env.NODE_VERSION }}
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
cache: yarn
cache-dependency-path: frontend/yarn.lock
- name: Verify if frontend modules are cached
uses: actions/cache@v3
id: cache-frontend-modules
with:
path: frontend/node_modules
key: node-modules-cache-${{ runner.os }}-${{ hashFiles('frontend/yarn.lock') }}
enableCrossOsArchive: true
- name: Install missing frontend dependencies
if: steps.cache-frontend-modules.outputs.cache-hit != 'true'
working-directory: frontend
run: yarn install --frozen-lockfile
- name: Check lint
working-directory: frontend
run: yarn lint:check
- name: Check formatting
working-directory: frontend
run: yarn format:check
# TEMPORARY SOLUTION
# See https://github.com/vegaprotocol/vegawallet-desktop/issues/619
hash-frontend:
needs: download-frontend
name: Hash frontend
runs-on: macos-latest
outputs:
for-mainnet: ${{ steps.for-mainnet.outputs.hash }}
for-fairground: ${{ steps.for-fairground.outputs.hash }}
steps:
- name: Check out repository
uses: actions/checkout@v3
- name: Generate hash for mainnet
id: for-mainnet
run: python3 ./ci/deterministic-hash.py mainnet >> "$GITHUB_OUTPUT"
- name: Generate hash for fairground
id: for-fairground
run: python3 ./ci/deterministic-hash.py fairground >> "$GITHUB_OUTPUT"
build-frontend:
needs: hash-frontend
name: Build frontend
runs-on: macos-latest
strategy:
matrix:
network:
- mainnet
- fairground
steps:
- name: Check out repository
uses: actions/checkout@v3
- name: Resolve cache key for compiled frontend
id: cache-key-compiled-frontend
shell: bash
run: |
[[ "${{ matrix.network }}" = 'mainnet' ]] && hash="${{ needs.hash-frontend.outputs.for-mainnet }}" || hash="${{ needs.hash-frontend.outputs.for-fairground }}"
echo "key=frontend-${{ matrix.network }}-$hash" >> "$GITHUB_OUTPUT"
- name: Verify if compiled frontend is cached
uses: actions/cache@v3
id: cache-compiled-frontend
with:
path: frontend/dist
key: ${{ steps.cache-key-compiled-frontend.outputs.key }}
enableCrossOsArchive: true
- name: Set up Node ${{ env.NODE_VERSION }}
uses: actions/setup-node@v3
if: steps.cache-compiled-frontend.outputs.cache-hit != 'true'
with:
node-version: ${{ env.NODE_VERSION }}
cache: yarn
cache-dependency-path: frontend/yarn.lock
- name: Restore frontend node_modules from cache
uses: actions/cache/restore@v3
if: steps.cache-compiled-frontend.outputs.cache-hit != 'true'
with:
path: frontend/node_modules
key: node-modules-cache-${{ runner.os }}-${{ hashFiles('frontend/yarn.lock') }}
fail-on-cache-miss: true
- name: Build frontend
if: steps.cache-compiled-frontend.outputs.cache-hit != 'true'
working-directory: frontend
env:
VITE_FEATURE_MODE: ${{ matrix.network }}
run: yarn build
download-backend:
name: Download backend dependencies (${{ matrix.os }}, ${{ matrix.arch }})
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- macos-latest
- windows-latest
- ubuntu-latest
arch:
- amd64
- arm64
exclude:
- os: ubuntu-latest
arch: arm64
- os: windows-latest
arch: arm64
steps:
- name: Check out repository
uses: actions/checkout@v3
- name: Set up Go ${{ env.GO_VERSION }}
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}
- name: Install missing Golang dependencies
run: go mod download
- name: Locate Wails on Windows
if: ${{ runner.os == 'Windows' }}
shell: bash
run: echo "WAILS_BIN=$(go env GOPATH)\bin\wails.exe" >> $GITHUB_ENV
- name: Locate Wails on Unix
if: ${{ runner.os != 'Windows' }}
shell: bash
run: echo "WAILS_BIN=$(go env GOPATH)/bin/wails" >> $GITHUB_ENV
- name: Verify if Wails is cached
uses: actions/cache@v3
id: cache-wails
with:
path: ${{ env.WAILS_BIN }}
key: wails-cache-${{ runner.os }}-${{ matrix.arch }}-${{ env.WAILS_VERSION }}
- name: Install Wails ${{ env.WAILS_VERSION }}
if: steps.cache-wails.outputs.cache-hit != 'true'
run: go install github.com/wailsapp/wails/v2/cmd/wails@${{ env.WAILS_VERSION }}
build-application:
needs:
- hash-frontend
- build-frontend
- download-backend
name: Build application (${{ matrix.network }}, ${{ matrix.os }}, ${{ matrix.arch }})
runs-on: ${{ matrix.os }}
env:
CGO_ENABLED: 1
strategy:
matrix:
os:
- macos-latest
- windows-latest
- ubuntu-latest
arch:
- amd64
- arm64
network:
- mainnet
- fairground
include:
- os: ubuntu-latest
platform: linux
- os: macos-latest
platform: darwin
- os: windows-latest
platform: windows
exclude:
- os: ubuntu-latest
arch: arm64
steps:
- name: Check out repository
uses: actions/checkout@v3
- name: Install Wails dependencies for Linux
if: ${{ runner.os == 'linux' }}
run: |
sudo apt-get update
sudo apt-get install build-essential libgtk-3-dev libwebkit2gtk-4.0-dev
- name: Set up Go ${{ env.GO_VERSION }}
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}
- name: Locate Wails on Windows
if: ${{ runner.os == 'Windows' }}
shell: bash
run: echo "WAILS_BIN=$(go env GOPATH)\bin\wails.exe" >> $GITHUB_ENV
- name: Locate Wails on Unix
if: ${{ runner.os != 'Windows' }}
shell: bash
run: echo "WAILS_BIN=$(go env GOPATH)/bin/wails" >> $GITHUB_ENV
- name: Restore Wails from cache
uses: actions/cache/restore@v3
with:
path: ${{ env.WAILS_BIN }}
key: wails-cache-${{ runner.os }}-${{ matrix.arch }}-${{ env.WAILS_VERSION }}
fail-on-cache-miss: true
- name: Resolve cache key for compiled frontend
id: cache-key-compiled-frontend
shell: bash
run: |
[[ "${{ matrix.network }}" = 'mainnet' ]] && hash="${{ needs.hash-frontend.outputs.for-mainnet }}" || hash="${{ needs.hash-frontend.outputs.for-fairground }}"
echo "key=frontend-${{ matrix.network }}-$hash" >> "$GITHUB_OUTPUT"
- name: Restore compiled frontend from cache
uses: actions/cache/restore@v3
with:
path: frontend/dist
key: ${{ steps.cache-key-compiled-frontend.outputs.key }}
fail-on-cache-miss: true
enableCrossOsArchive: true
- name: Prepare ${{ matrix.network }} bundle
shell: bash
env:
WALLET_OPTIMIZED_FOR: ${{ matrix.network }}
run: ./prepare.sh
- name: Build binary for ${{ matrix.platform }}
env:
VITE_FEATURE_MODE: ${{ matrix.network }}
# -s to skip building the frontend because it has already been compiled
# in a previous job.
# -skipbindings to skip generating the bindings because it's already
# committed.
# -nosyncgomod Don't sync go.mod
run: wails build -s -skipbindings -nosyncgomod -platform=${{ matrix.platform }}/${{ matrix.arch }} -tags ${{ matrix.network }}
# This is done after the application has been compiled because the backend
# code embed the frontend within itself. Without it, it will raise an error:
#
# pattern frontend/dist: no matching files found
#
- name: Tests backend
if: ${{ matrix.arch == 'amd64' }}
run: go test -tags ${{ matrix.network }} -v ./...
e2e-test:
needs:
- download-frontend
- download-backend
name: Run end-to-end tests
runs-on: macos-latest
strategy:
matrix:
mode:
- dev
- mainnet
- fairground
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Go ${{ env.GO_VERSION }}
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}
- name: Locate Wails on macOS
shell: bash
run: echo "WAILS_BIN=$(go env GOPATH)/bin/wails" >> $GITHUB_ENV
- name: Restore Wails from cache
uses: actions/cache/restore@v3
with:
path: ${{ env.WAILS_BIN }}
key: wails-cache-${{ runner.os }}-amd64-${{ env.WAILS_VERSION }}
fail-on-cache-miss: true
- name: Set up Node ${{ env.NODE_VERSION }}
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
cache: yarn
cache-dependency-path: frontend/yarn.lock
- name: Restore frontend node_modules from cache
uses: actions/cache/restore@v3
with:
path: frontend/node_modules
key: node-modules-cache-${{ runner.os }}-${{ hashFiles('frontend/yarn.lock') }}
fail-on-cache-miss: true
- name: Setup Playwright browsers
working-directory: frontend
run: yarn playwright install --with-deps chromium
- name: Run e2e tests - ${{ matrix.mode }} mode
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
working-directory: frontend
run: yarn e2e:run:${{ matrix.mode }}
- name: Show test summary
if: success() || failure()
uses: dorny/test-reporter@v1
with:
name: UI Tests - ${{ matrix.mode }}
path: frontend/automation/test-results/junit-report/report.xml
reporter: java-junit
- name: Store test report
if: always()
uses: actions/upload-artifact@v3
with:
name: test-results-${{ matrix.mode }}
path: frontend/automation/test-results