Conversion helpers #978
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: 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: | |
NODE_VERSION: 18.16.0 | |
RUST_VERSION: 1.65 | |
RUST_FMT: nightly-2023-04-01-x86_64-unknown-linux-gnu | |
jobs: | |
build: | |
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 GRPC | |
id: cache-grpc | |
uses: actions/cache@v3 | |
with: | |
path: | | |
./packages/common/grpc | |
./packages/nodejs/grpc | |
key: ${{ runner.os }}-grpc-${{ hashFiles('deps/concordium-base/concordium-grpc-api') }} | |
- 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: Get dependencies | |
run: yarn install --immutable | |
- name: Install rust | |
run: rustup default ${{ env.RUST_VERSION }} | |
- uses: Swatinem/rust-cache@v2 | |
with: | |
workspaces: | | |
packages/rust-bindings | |
deps/concordium-deps | |
- name: Get wasm-pack | |
uses: jetli/[email protected] | |
with: | |
version: 'latest' | |
- name: Build GRPC bindings | |
if: steps.cache-grpc.outputs.cache-hit != 'true' | |
run: | | |
mkdir -p packages/common/grpc | |
mkdir -p packages/nodejs/grpc | |
yarn workspace @concordium/common-sdk generate | |
yarn workspace @concordium/node-sdk generate | |
- name: Build | |
run: yarn build:dev | |
- name: Store build-debug | |
uses: ./.github/actions/upload-artifact | |
with: | |
name: build-debug | |
path: | | |
./node_modules/@concordium | |
./packages/rust-bindings/pkg | |
./packages/common/lib | |
./packages/nodejs/lib | |
./packages/common/grpc | |
./packages/nodejs/grpc | |
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: Get build-debug | |
uses: ./.github/actions/download-artifact | |
with: | |
name: build-debug | |
- name: Get dependencies | |
run: yarn install --immutable | |
- name: Typecheck examples | |
run: yarn workspace @concordium/examples typecheck | |
common-tests: | |
runs-on: ubuntu-22.04 | |
needs: build | |
defaults: | |
run: | |
working-directory: packages/common | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
cache: yarn | |
- name: Get build-debug | |
uses: ./.github/actions/download-artifact | |
with: | |
name: build-debug | |
- name: Get dependencies | |
run: yarn install --immutable | |
- name: Run Tests | |
run: yarn test | |
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: Get build-debug | |
uses: ./.github/actions/download-artifact | |
with: | |
name: build-debug | |
- name: Get dependencies | |
run: yarn install --immutable | |
- name: Build typedoc | |
run: yarn typedoc | |
lint: | |
runs-on: ubuntu-22.04 | |
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: Install dependencies | |
run: yarn install --immutable | |
- name: Lint | |
run: yarn lint | |
markdown-lint: | |
runs-on: ubuntu-22.04 | |
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: Install dependencies | |
run: yarn install --immutable | |
- name: Lint markdown | |
run: yarn markdown:lint | |
markdown-linkcheck: | |
runs-on: ubuntu-22.04 | |
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: Install dependencies | |
run: yarn install --immutable | |
- 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 | |
- 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-deps | |
- name: Run clippy | |
run: cargo clippy --color=always --tests --benches -- -Dclippy::all |