Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
158 changes: 70 additions & 88 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,91 +1,73 @@
name: Lint

on: [pull_request]

jobs:
lint:
name: "Lint"
runs-on: blacksmith-2vcpu-ubuntu-2404
permissions:
contents: read

steps:
name: Lint
on: [pull_request]
jobs:
lint:
name: "Lint"
runs-on: blacksmith-2vcpu-ubuntu-2404
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Cache Git submodules
id: cache-submodules
uses: actions/cache@v4
with:
path: submodules
key: ${{ runner.os }}-submodules-${{ hashFiles('.gitmodules') }}

- name: Checkout submodules
if: steps.cache-submodules.outputs.cache-hit != 'true'
run: git submodule update --init --recursive

- name: Cache Forge build
id: cache-forge
uses: actions/cache@v4
with:
path: abi
key: ${{ runner.os }}-forge-${{ hashFiles('.gitmodules', 'bun.lock') }}

- name: Cache Cargo
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}

- name: Install Foundry
if: steps.cache-forge.outputs.cache-hit != 'true'
uses: foundry-rs/foundry-toolchain@v1
with:
version: stable

- name: Install Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest

- name: Cache Bun dependencies
uses: actions/cache@v4
with:
path: |
~/.bun/install/cache
~/.bun/install/global
node_modules
key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lock') }}

- name: Install Task
uses: arduino/setup-task@v2
with:
version: 3.x
repo-token: ${{ secrets.GITHUB_TOKEN }}

- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
components: rustfmt, clippy
override: true

- name: Setup dependencies
run: task setup-ci BUILD_ABI=${{ steps.cache-forge.outputs.cache-hit != 'true' }}

- name: Check formatting
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check

- name: Run clippy
uses: actions-rs/cargo@v1
with:
command: clippy
args: --all-targets -- -D warnings
submodules: recursive

- name: Cache Forge build
id: cache-forge
uses: actions/cache@v4
with:
path: abi
key: ${{ runner.os }}-forge-${{ hashFiles('.gitmodules', 'bun.lock', 'submodules/poa-middleware/package-lock.json') }}

- name: Cache Cargo
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}

- name: Install Foundry
if: steps.cache-forge.outputs.cache-hit != 'true'
uses: foundry-rs/foundry-toolchain@v1
with:
version: stable

- name: Install Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest

- name: Install Task
uses: arduino/setup-task@v2
with:
version: 3.x
repo-token: ${{ secrets.GITHUB_TOKEN }}

- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
components: rustfmt, clippy
override: true

- name: Setup dependencies
run: task setup-ci BUILD_ABI=${{ steps.cache-forge.outputs.cache-hit != 'true' }}

- name: Check formatting
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check

- name: Run clippy
uses: actions-rs/cargo@v1
with:
command: clippy
args: --all-targets -- -D warnings
220 changes: 101 additions & 119 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,119 +1,101 @@
name: Publish Projects

on:
push:
tags:
- "v*"

jobs:
publish_wit:
name: "Publish WIT"
runs-on: blacksmith-4vcpu-ubuntu-2404
steps:
- name: Checkout
uses: actions/checkout@v4

# Caches
- name: Cache Git submodules
id: cache-submodules
uses: actions/cache@v4
with:
path: submodules
key: ${{ runner.os }}-submodules-${{ hashFiles('.gitmodules') }}

- name: Checkout submodules
if: steps.cache-submodules.outputs.cache-hit != 'true'
run: git submodule update --init --recursive

- name: Cache Forge build
id: cache-forge
uses: actions/cache@v4
with:
path: abi
key: ${{ runner.os }}-forge-${{ hashFiles('.gitmodules', 'bun.lock') }}

- name: Cache Cargo
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}

- name: Cache Target
uses: actions/cache@v4
with:
path: |
target/
key: ${{ runner.os }}-target-${{ hashFiles('**/Cargo.lock', 'projects/*/component/Cargo.toml','projects/*/component/src/**/*.rs') }}

- name: Cache Bun dependencies
uses: actions/cache@v4
with:
path: |
~/.bun/install/cache
~/.bun/install/global
node_modules
key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lock') }}

- name: Install Foundry
if: steps.cache-forge.outputs.cache-hit != 'true'
uses: foundry-rs/foundry-toolchain@v1
with:
version: stable

- name: Install Bun
if: steps.cache-forge.outputs.cache-hit != 'true'
uses: oven-sh/setup-bun@v2
with:
bun-version: latest

- name: Install Task
uses: arduino/setup-task@v2
with:
version: 3.x
repo-token: ${{ secrets.GITHUB_TOKEN }}

- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
target: wasm32-wasip2
override: true

- name: Install cargo binstall
uses: cargo-bins/cargo-binstall@main

- name: Install wkg
run: cargo binstall wkg

- name: Setup wkg
run: wkg config --default-registry wa.dev

- name: Setup dependencies
run: task setup-ci BUILD_ABI=${{ steps.cache-forge.outputs.cache-hit != 'true' }}

- name: Setup environment
run: cp .env.example .env

# Publish components
- name: Create warg config directory and write config.json and authentication flat-files
env: # https://docs.github.com/en/actions/security-for-github-actions/security-guides/using-secrets-in-github-actions#example-using-bash
WA_DEV_AUTH_TOKEN: ${{ secrets.WA_DEV_AUTH_TOKEN }}
WA_DEV_SIGNING_KEY: ${{ secrets.WA_DEV_SIGNING_KEY }}
# wkg cannot set the warg configuration for authentication at this time.
# This is a workaround to set the warg configuration without installing the `warg-cli`.
run: |
cat > wkg-config.toml << EOF
default_registry = "wavs.wa.dev"

[registry."wavs.wa.dev".warg]
auth_token = "$WA_DEV_AUTH_TOKEN"
signing_key = "$WA_DEV_SIGNING_KEY"
EOF

- name: Publish components
run: task publish VERSION="${GITHUB_REF_NAME#v}" FLAGS="--config wkg-config.toml"
name: Publish Projects

on:
push:
tags:
- "v*"

jobs:
publish_wit:
name: "Publish WIT"
runs-on: blacksmith-4vcpu-ubuntu-2404
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive

# Caches
- name: Cache Forge build
id: cache-forge
uses: actions/cache@v4
with:
path: abi
key: ${{ runner.os }}-forge-${{ hashFiles('.gitmodules', 'bun.lock', 'submodules/poa-middleware/package-lock.json') }}

- name: Cache Cargo
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}

- name: Cache Target
uses: actions/cache@v4
with:
path: |
target/
key: ${{ runner.os }}-target-${{ hashFiles('**/Cargo.lock', 'projects/*/component/Cargo.toml','projects/*/component/src/**/*.rs') }}

- name: Install Foundry
if: steps.cache-forge.outputs.cache-hit != 'true'
uses: foundry-rs/foundry-toolchain@v1
with:
version: stable

- name: Install Bun
if: steps.cache-forge.outputs.cache-hit != 'true'
uses: oven-sh/setup-bun@v2
with:
bun-version: latest

- name: Install Task
uses: arduino/setup-task@v2
with:
version: 3.x
repo-token: ${{ secrets.GITHUB_TOKEN }}

- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
target: wasm32-wasip2
override: true

- name: Install cargo binstall
uses: cargo-bins/cargo-binstall@main

- name: Install wkg
run: cargo binstall wkg

- name: Setup wkg
run: wkg config --default-registry wa.dev

- name: Setup dependencies
run: task setup-ci BUILD_ABI=${{ steps.cache-forge.outputs.cache-hit != 'true' }}

- name: Setup environment
run: cp .env.example .env

# Publish components
- name: Create warg config directory and write config.json and authentication flat-files
env: # https://docs.github.com/en/actions/security-for-github-actions/security-guides/using-secrets-in-github-actions#example-using-bash
WA_DEV_AUTH_TOKEN: ${{ secrets.WA_DEV_AUTH_TOKEN }}
WA_DEV_SIGNING_KEY: ${{ secrets.WA_DEV_SIGNING_KEY }}
# wkg cannot set the warg configuration for authentication at this time.
# This is a workaround to set the warg configuration without installing the `warg-cli`.
run: |
cat > wkg-config.toml << EOF
default_registry = "wavs.wa.dev"

[registry."wavs.wa.dev".warg]
auth_token = "$WA_DEV_AUTH_TOKEN"
signing_key = "$WA_DEV_SIGNING_KEY"
EOF

- name: Publish components
run: task publish VERSION="${GITHUB_REF_NAME#v}" FLAGS="--config wkg-config.toml"
Loading
Loading