Skip to content

Platform agnostic sdk #1200

Platform agnostic sdk

Platform agnostic sdk #1200

Workflow file for this run

name: Build, lint and typecheck examples
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
branches: [ main, release** ]
pull_request:
branches: [ main, release** ]
# Don't run on draft PR's, see: https://github.com/orgs/community/discussions/25722#discussioncomment-3248917
types: [ opened, synchronize, reopened, ready_for_review ]
# Allows us to run the workflow manually from the Actions tab
workflow_dispatch:
env:
DUMMY: 1 # For cache busting.
NODE_VERSION: 18.16.0
RUST_VERSION: 1.65
RUST_FMT: nightly-2023-04-01-x86_64-unknown-linux-gnu
jobs:
deps:
if: github.event.pull_request.draft == false
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
with:
submodules: 'recursive'
- uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
cache: yarn
- name: Cache dependencies
id: yarn-cache
uses: actions/cache@v3
with:
path: |
./node_modules
./docs/node_modules
key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}-${{ env.DUMMY }}
restore-keys: |
${{ runner.os }}-yarn
- name: Get dependencies
run: yarn install --immutable
build:
if: github.event.pull_request.draft == false
runs-on: ubuntu-22.04
needs: deps
steps:
- uses: actions/checkout@v3
with:
submodules: 'recursive'
- uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
cache: yarn
- name: Cache GRPC
id: cache-grpc
uses: actions/cache@v3
with:
path: |
./packages/sdk/src/grpc-api
key: ${{ runner.os }}-grpc-${{ hashFiles('deps/concordium-base/concordium-grpc-api') }}-${{ env.DUMMY }}
restore-keys: ${{ runner.os }}-grpc
- name: Cache WebPack
uses: actions/cache@v3
with:
path: ./packages/web/.webpack-cache
# These two lines ensure that a fresh cache is generated after each run
key: ${{ runner.os }}-webpack-${{ github.run_id }}
restore-keys: ${{ runner.os }}-webpack
- name: Restore dependencies
uses: actions/cache/restore@v3
with:
path: |
./node_modules
./docs/node_modules
key: ${{ runner.os }}-yarn
- name: Install rust
run: rustup default ${{ env.RUST_VERSION }}
- uses: Swatinem/rust-cache@v2
with:
workspaces: |
packages/rust-bindings
deps/concordium-base/rust-src
deps/concordium-base/concordium-contracts-common
- name: Get wasm-pack
uses: jetli/[email protected]
with:
version: 'latest'
- name: Build
run: yarn build
- name: Store build-debug
uses: ./.github/actions/upload-artifact
with:
name: build-debug
# sdk/src is needed here because of sdk/src/grpc-api
path: |
./packages/rust-bindings/lib
./packages/sdk/lib
./packages/sdk/src
./packages/ccd-js-gen/lib
typecheck-examples:
runs-on: ubuntu-22.04
needs: build
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
cache: yarn
- name: Restore dependencies
uses: actions/cache/restore@v3
with:
path: |
./node_modules
./docs/node_modules
key: ${{ runner.os }}-yarn
- name: Get build-debug
uses: ./.github/actions/download-artifact
with:
name: build-debug
- name: Typecheck examples
run: yarn workspace @concordium/examples typecheck
tests:
runs-on: ubuntu-22.04
needs: build
defaults:
run:
working-directory: packages/sdk
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: 'recursive'
- uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
cache: yarn
- name: Restore dependencies
uses: actions/cache/restore@v3
with:
path: |
./node_modules
./docs/node_modules
key: ${{ runner.os }}-yarn
- name: Get build-debug
uses: ./.github/actions/download-artifact
with:
name: build-debug
- name: Run Tests
run: yarn test-ci
typedoc:
runs-on: ubuntu-22.04
needs: build
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
cache: yarn
- name: Restore dependencies
uses: actions/cache/restore@v3
with:
path: |
./node_modules
./docs/node_modules
key: ${{ runner.os }}-yarn
- name: Get build-debug
uses: ./.github/actions/download-artifact
with:
name: build-debug
- name: Build typedoc
run: yarn build:docs
lint:
runs-on: ubuntu-22.04
needs: build
if: github.event.pull_request.draft == false
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
cache: yarn
- name: Restore dependencies
uses: actions/cache/restore@v3
with:
path: |
./node_modules
./docs/node_modules
key: ${{ runner.os }}-yarn
- name: Get build-debug
uses: ./.github/actions/download-artifact
with:
name: build-debug
- name: Lint
run: yarn lint
markdown-lint:
runs-on: ubuntu-22.04
if: github.event.pull_request.draft == false
needs: deps
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
cache: yarn
- name: Restore dependencies
uses: actions/cache/restore@v3
with:
path: |
./node_modules
./docs/node_modules
key: ${{ runner.os }}-yarn
- name: Lint markdown
run: yarn markdown:lint
markdown-linkcheck:
runs-on: ubuntu-22.04
needs: deps
if: github.event.pull_request.draft == false
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
cache: yarn
- name: Restore dependencies
uses: actions/cache/restore@v3
with:
path: |
./node_modules
./docs/node_modules
key: ${{ runner.os }}-yarn
- name: Lint markdown
run: yarn markdown:linkcheck
rust_lint_fmt:
runs-on: ubuntu-22.04
if: github.event.pull_request.draft == false
defaults:
run:
working-directory: packages/rust-bindings
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: 'recursive'
- name: Install formatter
run: |
rustup default ${{ env.RUST_FMT }}
rustup component add rustfmt
- name: Format
run: cargo fmt -- --color=always --check
rust_lint_clippy:
runs-on: ubuntu-22.04
needs: rust_lint_fmt
if: github.event.pull_request.draft == false
defaults:
run:
working-directory: packages/rust-bindings
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: 'recursive'
- name: Install clippy
run: |
rustup default ${{ env.RUST_VERSION }}
rustup component add clippy
- uses: Swatinem/rust-cache@v2
with:
workspaces: |
packages/rust-bindings
deps/concordium-base/rust-src
deps/concordium-base/concordium-contracts-common
- name: Run clippy
run: cargo clippy --color=always --tests --benches -- -Dclippy::all