Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge InvArch into main and restructure workspace #133

Merged
merged 13 commits into from
Nov 9, 2023
Merged
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
129 changes: 102 additions & 27 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,45 +2,120 @@ name: Checks

on:
push:
branches: [ main, development ]
branches:
- main
pull_request:
branches: [ main, development ]
branches:
- main
paths:
- '.github/workflows/build.yml'

env:
CARGO_TERM_COLOR: always

jobs:
build:
get_changed_files:
runs-on: ubuntu-latest
name: Get Changed Files
outputs:
all_modified_files: ${{ steps.changed-files.outputs.all_modified_files }}
steps:

- name: Free disk space
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf "/usr/local/share/boost"
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
df -h

- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Setup for checks
run: sudo apt install -y git clang curl libssl-dev llvm libudev-dev protobuf-compiler
- name: Changed Files
id: changed-files
uses: tj-actions/changed-files@v40
with:
fetch_depth: 0
dir_names: true
dir_names_max_depth: 1

- name: Install & display rust toolchain
run: rustup show
build_tinkernet:
runs-on: ubuntu-latest
name: Build Tinkernet

needs: get_changed_files
if:
contains(needs.get_changed_files.outputs.all_modified_files, 'tinkernet')

defaults:
run:
working-directory: ./tinkernet

steps:
- uses: actions/checkout@v4

- name: Free disk space
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf "/usr/local/share/boost"
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
df -h

- name: Setup for checks
run: sudo apt install -y git clang curl libssl-dev llvm libudev-dev protobuf-compiler

- name: Install & display rust toolchain
run: rustup show

- uses: Swatinem/rust-cache@v2
with:
workspaces: "tinkernet"

- name: Build
run: cargo build --verbose

- name: Run tests
run: cargo test --verbose

- name: Run clippy
run: cargo clippy -- -D warnings

- name: Run cargofmt
run: cargo fmt --all -- --check

build_invarch:
runs-on: ubuntu-latest
name: Build InvArch

needs: get_changed_files
if:
contains(needs.get_changed_files.outputs.all_modified_files, 'invarch')

defaults:
run:
working-directory: ./invarch

steps:
- uses: actions/checkout@v4

- name: Free disk space
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf "/usr/local/share/boost"
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
df -h

- name: Setup for checks
run: sudo apt install -y git clang curl libssl-dev llvm libudev-dev protobuf-compiler

- name: Install & display rust toolchain
run: rustup show

- name: Check targets are installed correctly
run: rustup target list --installed
- uses: Swatinem/rust-cache@v2
with:
workspaces: "invarch"

- name: Build
run: cargo build --verbose
- name: Build
run: cargo build --verbose

- name: Run tests
run: cargo test --verbose
- name: Run tests
run: cargo test --verbose

- name: Run clippy
run: cargo clippy -- -D warnings
- name: Run clippy
run: cargo clippy -- -D warnings

- name: Run cargofmt
run: cargo +stable fmt --all -- --check
- name: Run cargofmt
run: cargo fmt --all -- --check
47 changes: 23 additions & 24 deletions .github/workflows/release-binary.yml
Original file line number Diff line number Diff line change
@@ -1,49 +1,48 @@
name: Release binary to existing tag

on: workflow_dispatch
on:
workflow_dispatch:
inputs:
# Get name of the chain
chain:
description: Chain (default = tinkernet)
required: true
default: tinkernet
type: choice
options:
- tinkernet
- invarch

jobs:
build_binary:
runs-on: ubuntu-latest
steps:

- name: Checkout
uses: actions/checkout@v3
with:
submodules: true

- name: Free disk space
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf "/usr/local/share/boost"
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
df -h

- name: Checkout
uses: actions/checkout@v3
with:
submodules: true

- name: Setup for checks
run: sudo apt install -y git clang curl libssl-dev llvm libudev-dev protobuf-compiler

- name: Install & display rust toolchain
run: rustup show
run: cd ${{ github.event.inputs.chain }} && rustup show

- name: Check targets are installed correctly
run: rustup target list --installed

- name: Build binary
run: cargo build --release
run: cd ${{ github.event.inputs.chain }} && cargo build --release

- name: Add binary to release
uses: djnicholson/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
tag-name: ${{ github.ref_name }}
asset-name: 'invarch-collator'
file: 'target/release/invarch-collator'

- name: Add spec file to release
uses: djnicholson/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
tag-name: ${{ github.ref_name }}
asset-name: 'tinker-raw.json'
file: 'res/tinker/tinker-raw.json'
asset-name: '${{ github.event.inputs.chain }}-collator'
file: '${{ github.event.inputs.chain }}/target/release/${{ github.event.inputs.chain }}-collator'
18 changes: 7 additions & 11 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,11 @@ on:
inputs:
# Get name of the chain
chain:
description: Chain Runtime (default = tinkernet)
description: Chain Runtime (default = tinkernet)
required: true
default: tinkernet
type: choice
options:
- brainstorm
- tinkernet
- invarch
# Get the scope of release note
Expand All @@ -47,29 +46,25 @@ jobs:
name: Build and publish ${{ github.event.inputs.chain }}
runs-on: ubuntu-latest
steps:

- name: Free disk space
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf "/usr/local/share/boost"
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
df -h

# Checkout the codebase
- name: Checkout Codebase
uses: actions/checkout@v3
with:
submodules: true

- name: Install deps
run: sudo apt -y install protobuf-compiler

- name: Install & display rust toolchain
run: rustup show

- name: Check targets are installed correctly
run: rustup target list --installed
- name: Install & display rust toolchain
run: cd ${{ github.event.inputs.chain }} && rustup show

# Build WASM with Substrate Runtime Tool
- name: Srtool build
Expand All @@ -79,6 +74,7 @@ jobs:
BUILD_OPTS: ""
with:
chain: ${{ github.event.inputs.chain }}
runtime_dir: ${{ matrix.chain }}/runtime
tag: ${{ github.event.inputs.srtool_image }}

# Output the build summary
Expand All @@ -102,7 +98,7 @@ jobs:
subwasm --json info ${{ steps.srtool_build.outputs.wasm_compressed }} > ${{ github.event.inputs.chain }}-subwam-info.json
subwasm info ${{ steps.srtool_build.outputs.wasm_compressed }} > ${{ github.event.inputs.chain }}-subwam-info.txt
cat ${{ github.event.inputs.chain }}-subwam-info.txt

- name: Archive Artifacts for ${{ github.event.inputs.chain }}
uses: actions/upload-artifact@v2
with:
Expand Down
Loading
Loading