Skip to content

Commit

Permalink
Merge branch 'research/docs' of https://github.com/Analog-Labs/timechain
Browse files Browse the repository at this point in the history
 into research/docs
  • Loading branch information
taniasaleem committed Jun 28, 2024
2 parents 9459b15 + 1ad1778 commit df6ee0e
Show file tree
Hide file tree
Showing 77 changed files with 10,673 additions and 3,992 deletions.
65 changes: 65 additions & 0 deletions .github/workflows/build-chronicle.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Compile chronicle

on:
pull_request:
paths-ignore:
- 'contracts/**'
- 'docker/**'
- 'docs/**'
- 'node/**'
- 'infra/**'
- 'js/**'
- 'scripts/**'
- 'tester/**'
- 'utils/**'
- '**/*.md'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build-chronicle:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
profile:
- production
- testnet
steps:
- name: Install dependencies
run: sudo apt-get update && sudo apt-get install -y musl-tools protobuf-compiler
- name: Checkout sources
uses: actions/checkout@v4
with:
submodules: recursive
- name: Install rust toolchain
run : rustup show
- name: Setup and cache sccache
uses: visvirial/[email protected]
with:
cache-key: sccache-chronicle-${{ matrix.profile }}
- name: Cache cargo registry and index
uses: actions/cache@v4
with:
path: |
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
key: cargo-cache-chronicle-${{ hashFiles('Cargo.lock') }}
restore-keys: cargo-cache-chronicle-
- name: Cache cargo build output
uses: actions/cache@v4
with:
path: target
key: cargo-build-chronicle-${{ matrix.profile }}-${{ hashFiles('Cargo.lock') }}
restore-keys: cargo-build-chronicle-${{ matrix.profile }}-
- name: Build chronicle
run: cargo build --package chronicle --profile ${{ matrix.profile }}
- name: Upload chronicle
uses: actions/upload-artifact@v4
with:
name: chronicle.${{ matrix.profile }}
if-no-files-found: error
path: target/${{ matrix.profile }}/chronicle
6 changes: 3 additions & 3 deletions .github/workflows/build-docker-tester.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
##########################################################
#
# Workflow for building the tester image. It's a CLI tool
# used in deployment scripts and apps. The tester CLI
# image includes the tester binary and the compiled
# used in deployment scripts and apps. The tester CLI
# image includes the tester binary and the compiled
# contracts.
#
##########################################################
Expand Down Expand Up @@ -73,7 +73,7 @@ jobs:
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
- name: Build contracts
run: forge build --root analog-gmp --optimize --optimizer-runs=200000 --use=0.8.24 --force
run: forge build --root analog-gmp --optimize --optimizer-runs=200000 --evm-version=shanghai --use=0.8.25 --force
- name: Build tester
run: cargo build --release -p tester
- name: Copy contracts
Expand Down
32 changes: 32 additions & 0 deletions .github/workflows/build-docs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Generate docs

on:
pull_request:
paths-ignore:
- 'docker/**'
- 'infra/**'
- 'js/**'
- 'scripts/**'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build-docs:
runs-on: ubuntu-latest
steps:
- name: Install dependencies
run: sudo apt-get update && sudo apt-get install -y protobuf-compiler
- name: Checkout sources
uses: actions/checkout@v4
- name: Install rust toolchain
run : rustup show
- name: Build docs
run: cargo doc --no-deps --document-private-items --workspace
- name: Upload tester
uses: actions/upload-artifact@v4
with:
name: docs
if-no-files-found: error
path: target/doc
79 changes: 79 additions & 0 deletions .github/workflows/build-node.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: Compile node

on:
pull_request:
paths-ignore:
- 'chronicle/**'
- 'contracts/**'
- 'docker/**'
- 'docs/**'
- 'infra/**'
- 'js/**'
- 'lib/**'
- 'scripts/**'
- 'tc-subxt/**'
- 'tester/**'
- 'tss/**'
- 'utils/**'
- '**/*.md'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
setup:
runs-on: [ self-hosted-timechain ]
steps:
- name: Install rust toolchain
run : rustup show
- name: Checkout sources
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
submodules: recursive
- name: Cache cargo registry and index
uses: actions/cache@v4
with:
path: |
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
key: cargo-cache-timechain-${{ hashFiles('Cargo.lock') }}
restore-keys: cargo-cache-timechain-

build-node:
runs-on: [ self-hosted-timechain ]
needs: [ setup ]
strategy:
fail-fast: false
matrix:
include:
- profile: production
features: default
- profile: testnet
features: default
- profile: testnet
features: development
steps:
- name: Checkout sources
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
submodules: recursive
- name: Cache cargo build output
uses: actions/cache@v4
with:
path: target
key: cargo-build-timenode-${{ matrix.profile }}-${{ hashFiles('Cargo.lock') }}
restore-keys: cargo-build-timenode-${{ matrix.profile }}-
- name: Build timechain node
env:
SKIP_WASM_BUILD: true
run: cargo build --package timechain-node --profile ${{ matrix.profile }} --features ${{ matrix.features }}
- name: Upload timechain node
uses: actions/upload-artifact@v4
with:
name: timenode.${{ matrix.profile }}.${{ matrix.features }}
if-no-files-found: error
path: target/${{ matrix.profile }}/timechain-node
159 changes: 113 additions & 46 deletions .github/workflows/build-runtime.yaml
Original file line number Diff line number Diff line change
@@ -1,55 +1,122 @@
name: Build runtime artifacts
name: Compile runtimes

on:
push:
branches:
- "ci/runtime/**"
pull_request:
paths-ignore:
- 'chronicle/**'
- 'contracts/**'
- 'docker/**'
- 'docs/**'
- 'infra/**'
- 'js/**'
- 'lib/**'
- 'scripts/**'
- 'tc-subxt/**'
- 'tester/**'
- 'tss/**'
- 'utils/**'
- '**/*.md'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
set-tags:
name: Get & set tags
runs-on: ubuntu-latest
outputs:
commit_hash: ${{ steps.get-sha.outputs.sha }}
commit_hash8: ${{ steps.get-sha.outputs.sha8 }}
setup:
runs-on: [ self-hosted-timechain ]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Get SHA
id: get-sha
run: |
sha=$(git log -1 --format='%H')
echo "sha=$sha" >> $GITHUB_OUTPUT
echo "sha8=$(git log -1 --format='%H' | cut -c1-8)" >> $GITHUB_OUTPUT
echo "SHA commit:" $sha
- name: Install rust toolchain
run : rustup show
- name: Checkout sources
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
submodules: recursive
- name: Cache cargo registry and index
uses: actions/cache@v4
with:
path: |
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
key: cargo-cache-timechain-${{ hashFiles('Cargo.lock') }}
restore-keys: cargo-cache-timechain-

build-runtime:
name: Build runtimes
needs: ["set-tags"]
runs-on: ubuntu-latest
runs-on: [ self-hosted-timechain ]
needs: [ setup ]
strategy:
fail-fast: false
matrix:
include:
- package: timechain-runtime
features: default
crate: timechain_runtime
- package: timechain-runtime
features: development
crate: timechain_runtime
steps:
- name: Fetch latest code
uses: actions/checkout@v3

- name: Build timechain runtime
id: srtool_build
uses: chevdor/[email protected]
with:
image: analoglabs/srtool
tag: 1.75.0
chain: timechain
runtime_dir: "runtime"
- name: Checkout sources
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
submodules: recursive
- name: Cache cargo build output
uses: actions/cache@v4
with:
path: target
key: cargo-build-${{ matrix.package }}-${{ matrix.features }}-${{ hashFiles('Cargo.lock') }}
restore-keys: cargo-build-${{ matrix.package }}-${{ matrix.features }}-
- name: Build timechain runtime
run: cargo build --package ${{ matrix.package }} --profile release --features ${{ matrix.features }}
- name: Upload timechain runtime
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.package }}.${{ matrix.features }}.wasm
if-no-files-found: error
path: target/release/wbuild/${{ matrix.package }}/${{ matrix.crate }}.compact.compressed.wasm
- name: Upload timechain metadata
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.package }}.${{ matrix.features }}.scale
if-no-files-found: error
path: target/release/wbuild/${{ matrix.package }}/${{ matrix.crate }}.metadata.scale

- name: Srtool summary
run: |
echo '${{ steps.srtool_build.outputs.json }}' | jq . > timechain-srtool-digest.json
cat timechain-srtool-digest.json
echo "Runtime location: ${{ steps.srtool_build.outputs.wasm_compressed }}"
- name: Upload timechain runtime artifacts
uses: actions/upload-artifact@v3
with:
name: timechain-runtime
path: |
${{ steps.srtool_build.outputs.wasm_compressed }}
timechain-srtool-digest.json
update-metadata:
runs-on: [ self-hosted-timechain ]
needs: [ build-runtime ]
if: ${{ always() }}
continue-on-error: true
steps:
- name: Checkout sources
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
- name: Download and update Testnet Metadata
id: download-testnet-default-metadata
uses: actions/download-artifact@v4
continue-on-error: true
with:
name: timechain-runtime.default.scale
- name: Download and Testnet Metadata
if: steps.download-testnet-default-metadata.outcome == 'success'
run: mv timechain_runtime.metadata.scale config/subxt/testnet.default.scale
- name: Download Development Metadata
id: download-testnet-development-metadata
uses: actions/download-artifact@v4
continue-on-error: true
with:
name: timechain-runtime.development.scale
- name: Update Development Metadata
if: steps.download-testnet-development-metadata.outcome == 'success'
run: mv timechain_runtime.metadata.scale config/subxt/testnet.development.scale
- name: Commit any changes to the metadata
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
if ! git diff --quiet; then
git config user.email "[email protected]"
git config user.name "Metadata Update Bot"
git commit -am "tc-subxt: Automated metadata update"
git push
fi
Loading

0 comments on commit df6ee0e

Please sign in to comment.