Skip to content

Show a user's unstaked tokens on the validators page #328

Show a user's unstaked tokens on the validators page

Show a user's unstaked tokens on the validators page #328

Workflow file for this run

name: Turbo CI
on:
workflow_call:
workflow_dispatch:
pull_request:
push:
branches:
- main
# this is pretty verbose and repetitive, but github workflows require it
# the first action is commented, most of those comments apply to all actions
# every 'turbo' call is cached and essentially no-op if the inputs match
# tried to make wasm compile conditional, but that turned out to be complex.
# cache should make it decently fast.
# pnpm cached by lock hash
# turbo cached by cargo lock, pnpm lock in that order
# mostly, compiled wasm will restore from turbo cache
# rust cache only used in rust jobs
jobs:
check-needs-wasm-test:
outputs:
needs-wasm-test: ${{ github.event_name == 'workflow_dispatch' || github.run_attempt > 1 || github.ref == 'refs/heads/main' || steps.run-wasm-diff-main.outcome == 'failure' }}
name: Diff
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: git fetch origin main:main
continue-on-error: true
- run: git fetch origin ${{ github.head_ref }}:${{ github.head_ref }}
continue-on-error: true
- id: run-wasm-diff-main
run: git diff main --exit-code packages/wasm/crate
continue-on-error: true
- run: exit 0 # always succeed
turbo-compile:
name: Compile
uses: ./.github/workflows/compile-wasm.yml
turbo-test-rust:
name: 'test:rust'
needs: [check-needs-wasm-test, turbo-build]
# crate tests are expensive. only run if wasm changed, rerun, or manual dispatch
if: ${{ !cancelled() && needs.check-needs-wasm-test.outputs.needs-wasm-test }}
runs-on: buildjet-16vcpu-ubuntu-2204 # buildjet for rust, github standard for everything else
steps:
- uses: actions/checkout@v4
- id: test-rust
uses: actions/cache@v3 # turbo cache, shared between buildjet and github
with:
path: .turbo
key: ${{ runner.os }}-turbo-${{ hashFiles('**/Cargo.lock') }}-${{ hashFiles('pnpm-lock.yaml') }}-${{ github.ref }}-${{ github.sha }}-test:rust
restore-keys: |
${{ runner.os }}-turbo-${{ hashFiles('**/Cargo.lock') }}-${{ hashFiles('pnpm-lock.yaml') }}-${{ github.ref }}-${{ github.sha }}-built
${{ runner.os }}-turbo-${{ hashFiles('**/Cargo.lock') }}-${{ hashFiles('pnpm-lock.yaml') }}-${{ github.ref }}
${{ runner.os }}-turbo-${{ hashFiles('**/Cargo.lock') }}-${{ hashFiles('pnpm-lock.yaml') }}
${{ runner.os }}-turbo-${{ hashFiles('**/Cargo.lock') }}
${{ runner.os }}-turbo-
- uses: pnpm/action-setup@v2
- uses: buildjet/setup-node@v4 # node cache, distinct between buildjet and github
with:
node-version: '21'
cache: 'pnpm'
- run: pnpm install --frozen-lockfile
- run: pnpm turbo telemetry disable
- uses: dtolnay/rust-toolchain@stable # rust only on buildjet
with:
targets: wasm32-unknown-unknown
- uses: Swatinem/rust-cache@v2.7.3 # rust cache
with:
shared-key: wasm
cache-provider: 'buildjet'
workspaces: 'packages/wasm/crate'
- uses: jetli/wasm-pack-action@v0.4.0 # preinstall wasm-pack
with:
version: 'latest'
- uses: browser-actions/setup-firefox@v1 # wasm tests in ffx
- run: pnpm turbo test:rust --cache-dir=.turbo # test wasm
- run: cargo tree --invert mio --edges features # debug tree
if: failure()
working-directory: packages/wasm/crate
turbo-lint:
name: Lint
runs-on: ubuntu-latest # github default for ts, rust uses buildjet
needs: turbo-compile
steps:
- uses: actions/checkout@v4
- id: lint
uses: actions/cache@v3 # turbo cache, shared between buildjet and github
with:
path: .turbo
key: ${{ runner.os }}-turbo-${{ hashFiles('**/Cargo.lock') }}-${{ hashFiles('pnpm-lock.yaml') }}-${{ github.ref }}-${{ github.sha }}-lint
restore-keys: |
${{ runner.os }}-turbo-${{ hashFiles('**/Cargo.lock') }}-${{ hashFiles('pnpm-lock.yaml') }}
${{ runner.os }}-turbo-${{ hashFiles('**/Cargo.lock') }}
- uses: pnpm/action-setup@v2
- uses: actions/setup-node@v4 # node cache, distinct between buildjet and github
with:
node-version: '21'
cache: 'pnpm'
- run: pnpm install --frozen-lockfile
- run: pnpm turbo telemetry disable
- run: pnpm format-check
- run: pnpm turbo lint --cache-dir=.turbo
turbo-build:
name: Build
runs-on: ubuntu-latest
needs: turbo-compile
steps:
- uses: actions/checkout@v4
- id: built
uses: actions/cache@v3
with:
path: .turbo
key: ${{ runner.os }}-turbo-${{ hashFiles('**/Cargo.lock') }}-${{ hashFiles('pnpm-lock.yaml') }}-${{ github.ref }}-${{ github.sha }}-built
restore-keys: |
${{ runner.os }}-turbo-${{ hashFiles('**/Cargo.lock') }}-${{ hashFiles('pnpm-lock.yaml') }}
${{ runner.os }}-turbo-${{ hashFiles('**/Cargo.lock') }}
- uses: pnpm/action-setup@v2
- uses: actions/setup-node@v4
with:
node-version: '21'
cache: 'pnpm'
- run: pnpm install --frozen-lockfile
- run: pnpm turbo telemetry disable
- run: pnpm turbo build --cache-dir=.turbo
turbo-test:
strategy:
matrix:
test: ['test', 'test:browser'] # all typescript tests
name: ${{ matrix.test }}
runs-on: ubuntu-latest
needs: turbo-build
steps:
- uses: actions/checkout@v4
- id: tested
uses: actions/cache@v3
with:
path: .turbo
key: ${{ runner.os }}-turbo-${{ hashFiles('**/Cargo.lock') }}-${{ hashFiles('pnpm-lock.yaml') }}-${{ github.ref }}-${{ github.sha }}-${{ matrix.test }}
restore-keys: |
${{ runner.os }}-turbo-${{ hashFiles('**/Cargo.lock') }}-${{ hashFiles('pnpm-lock.yaml') }}-${{ github.ref }}-${{ github.sha }}-built
${{ runner.os }}-turbo-${{ hashFiles('**/Cargo.lock') }}-${{ hashFiles('pnpm-lock.yaml') }}
${{ runner.os }}-turbo-${{ hashFiles('**/Cargo.lock') }}
- uses: pnpm/action-setup@v2
- uses: actions/setup-node@v4
with:
node-version: '21'
cache: 'pnpm'
- run: pnpm install --frozen-lockfile
- run: pnpm turbo telemetry disable
- run: pnpm turbo ${{ matrix.test }} --cache-dir=.turbo