Skip to content
This repository has been archived by the owner on Mar 13, 2023. It is now read-only.

Commit

Permalink
Merge remote-tracking branch 'origin/master' into bump-deps
Browse files Browse the repository at this point in the history
  • Loading branch information
fewensa committed Dec 1, 2021
2 parents 2799b0a + b0359e2 commit a643f3d
Show file tree
Hide file tree
Showing 34 changed files with 183 additions and 292 deletions.
234 changes: 59 additions & 175 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,217 +1,100 @@
name: Unit/RPC/Runtime tests
name: Checks
on:
push:
branches:
- main
- master
paths:
- "**.rs"
- "**.toml"
- "**.lock"
- "**.json"
- "**.yml"
pull_request:
types: [opened, synchronize, ready_for_review]
branches:
- main
- master
paths:
- "**.rs"
- "**.toml"
- "**.lock"
- "**.json"
- "**.yml"
# issue_comment:
# types: [created, edited]

env:
OS: ubuntu-latest
RUST_TOOLCHAIN: nightly
RUST_BACKTRACE: full
RUSTC_WRAPPER: sccache
SCCACHE_LINK: https://github.com/mozilla/sccache/releases/download
SCCACHE_VERSION: v0.2.15
SCCACHE_DIR: /home/runner/.cache/sccache
NODE_VERSION: 10
GITHUB_CACHE_VERSION: 0
GITHUB_CACHE_VERSION: 1

jobs:
build-subalfred:
name: Build subalfred
basic-checks:
name: Task ${{ matrix.action }} ${{ matrix.task.target }}
if: github.event_name == 'push' || !github.event.pull_request.draft
runs-on: ubuntu-latest
strategy:
matrix:
action: [build, test]
task:
- target: drml
repository: darwinia-network/darwinia-common
- target: subalfred
repository: l2ust/subalfred
exclude:
- action: test
task:
target: subalfred

steps:
- name: Install Rust ${{ env.RUST_TOOLCHAIN }} toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ env.RUST_TOOLCHAIN }}
default: true

- name: Install sccache ${{ env.SCCACHE_VERSION }}
run: |
export SCCACHE_FILE=sccache-${{ env.SCCACHE_VERSION }}-x86_64-unknown-linux-musl
curl -L ${{ env.SCCACHE_LINK }}/${{ env.SCCACHE_VERSION }}/$SCCACHE_FILE.tar.gz | tar xz
sudo mv -f $SCCACHE_FILE/sccache /usr/bin
sudo chmod +x /usr/bin/sccache
- name: Fetch latest code
uses: actions/checkout@v2
with:
repository: l2ust/subalfred
ref: main
repository: ${{ matrix.task.repository }}

- name: Cache cargo registry
- name: Cache
uses: actions/cache@v2
continue-on-error: false
with:
path: |
~/.cargo/registry
~/.cargo/git
key: ${{ env.OS }}-cargo-build-${{ env.GITHUB_CACHE_VERSION }}-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ env.OS }}-cargo-build-${{ env.GITHUB_CACHE_VERSION }}-
- name: Save sccache
uses: actions/cache@v2
continue-on-error: false
with:
path: ${{ env.SCCACHE_DIR }}
key: ${{ env.OS }}-sccache-build-${{ env.GITHUB_CACHE_VERSION }}--${{ hashFiles('**/Cargo.lock') }}
target
key: ${{ matrix.action }}-${{ matrix.task.target }}-${{ env.GITHUB_CACHE_VERSION }}-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ env.OS }}-sccache-build-${{ env.GITHUB_CACHE_VERSION }}-
- name: Start sccache server
run: sccache --start-server

- name: Build
run: cargo b --locked

- name: Print sccache stats
run: sccache --show-stats
${{ matrix.action }}-${{ matrix.task.target }}-${{ env.GITHUB_CACHE_VERSION }}-
- name: Stop sccache server
run: sccache --stop-server || true
- name: Action ${{ matrix.action }}
run: cargo ${{ matrix.action }} --locked

- name: Compress subalfred
- name: Compress ${{ matrix.task.target }}
if: matrix.action != 'test'
run: |
cp target/debug/subalfred .
tar cf subalfred.tar.zst subalfred -I pzstd
mv target/debug/${{ matrix.task.target }} .
tar cf ${{ matrix.task.target }}.tar.zst ${{ matrix.task.target }} -I pzstd
- name: Upload subalfred
- name: Upload ${{ matrix.task.target }}
if: matrix.action != 'test'
uses: actions/upload-artifact@v2
with:
name: subalfred
path: subalfred.tar.zst

build-drml:
name: Build drml
if: github.event_name == 'push' || !github.event.pull_request.draft
runs-on: ubuntu-latest
steps:
- name: Install Rust ${{ env.RUST_TOOLCHAIN }} toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ env.RUST_TOOLCHAIN }}
default: true

- name: Install sccache ${{ env.SCCACHE_VERSION }}
run: |
export SCCACHE_FILE=sccache-${{ env.SCCACHE_VERSION }}-x86_64-unknown-linux-musl
curl -L ${{ env.SCCACHE_LINK }}/${{ env.SCCACHE_VERSION }}/$SCCACHE_FILE.tar.gz | tar xz
sudo mv -f $SCCACHE_FILE/sccache /usr/bin
sudo chmod +x /usr/bin/sccache
- name: Fetch latest code
uses: actions/checkout@v2

- name: Cache cargo registry
uses: actions/cache@v2
continue-on-error: false
with:
path: |
~/.cargo/registry
~/.cargo/git
key: ${{ env.OS }}-cargo-build-${{ env.GITHUB_CACHE_VERSION }}-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ env.OS }}-cargo-build-${{ env.GITHUB_CACHE_VERSION }}-
- name: Save sccache
uses: actions/cache@v2
continue-on-error: false
with:
path: ${{ env.SCCACHE_DIR }}
key: ${{ env.OS }}-sccache-build-${{ env.GITHUB_CACHE_VERSION }}-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ env.OS }}-sccache-build-${{ env.GITHUB_CACHE_VERSION }}-
- name: Start sccache server
run: sccache --start-server

- name: Build
run: cargo b --locked

- name: Print sccache stats
run: sccache --show-stats

- name: Stop sccache server
run: sccache --stop-server || true

- name: Compress drml
run: |
cp target/debug/drml .
tar cf drml.tar.zst drml -I pzstd
- name: Upload drml
uses: actions/upload-artifact@v2
with:
name: drml
path: drml.tar.zst

unit-tests:
name: Unit tests
if: github.event_name == 'push' || !github.event.pull_request.draft
runs-on: ubuntu-latest
steps:
- name: Install Rust ${{ env.RUST_TOOLCHAIN }} toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ env.RUST_TOOLCHAIN }}
default: true

- name: Install sccache ${{ env.SCCACHE_VERSION }}
run: |
export SCCACHE_FILE=sccache-${{ env.SCCACHE_VERSION }}-x86_64-unknown-linux-musl
curl -L ${{ env.SCCACHE_LINK }}/${{ env.SCCACHE_VERSION }}/$SCCACHE_FILE.tar.gz | tar xz
sudo mv -f $SCCACHE_FILE/sccache /usr/bin
sudo chmod +x /usr/bin/sccache
- name: Fetch latest code
uses: actions/checkout@v2

- name: Cache cargo registry
uses: actions/cache@v2
continue-on-error: false
with:
path: |
~/.cargo/registry
~/.cargo/git
key: ${{ env.OS }}-cargo-test-${{ env.GITHUB_CACHE_VERSION }}-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ env.OS }}-cargo-test-${{ env.GITHUB_CACHE_VERSION }}-
- name: Save sccache
uses: actions/cache@v2
continue-on-error: false
with:
path: ${{ env.SCCACHE_DIR }}
key: ${{ env.OS }}-sccache-test-${{ env.GITHUB_CACHE_VERSION }}-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ env.OS }}-sccache-test-${{ env.GITHUB_CACHE_VERSION }}-
- name: Start sccache server
run: sccache --start-server

- name: Test
run: cargo t --locked

- name: Print sccache stats
run: sccache --show-stats
name: ${{ matrix.task.target }}
path: ${{ matrix.task.target }}.tar.zst

- name: Stop sccache server
run: sccache --stop-server || true
- name: Purge large cache
if: matrix.task.target == 'drml' && matrix.action == 'build'
run: .maintain/purge-large-cache.sh

rpc-tests:
name: RPC tests
rpc-checks:
name: Task test RPC
if: github.event_name == 'push' || !github.event.pull_request.draft
needs: [build-drml]
needs: [basic-checks]
runs-on: ubuntu-latest
steps:
- name: Download drml
Expand Down Expand Up @@ -246,10 +129,10 @@ jobs:
npm test
code-checks:
name: Code checks
name: Task check code
if: github.event_name == 'push' || !github.event.pull_request.draft
# if: github.event.issue.pull_request && contains(github.event.comment.body, '/bot check') && contains(github.event.comment.body, 'code')
needs: [build-subalfred]
needs: [basic-checks]
runs-on: ubuntu-latest
steps:
- name: Download subalfred
Expand All @@ -269,10 +152,10 @@ jobs:
run: subalfred ci default-features -p ../darwinia-common

runtime-checks:
name: Runtime checks
name: Task check runtime
if: github.event_name == 'push' || !github.event.pull_request.draft
# if: github.event.issue.pull_request && contains(github.event.comment.body, '/bot check') && contains(github.event.comment.body, 'runtime')
needs: [build-drml, build-subalfred]
needs: [basic-checks]
runs-on: ubuntu-latest
steps:
- name: Download drml
Expand Down Expand Up @@ -357,12 +240,13 @@ jobs:
```
</details>
clean-artifacts:
name: Clean artifacts
housekeeping-checks:
name: Task check housekeeping
if: always()
needs: [code-checks, runtime-checks]
needs: [rpc-checks, code-checks, runtime-checks]
steps:
- uses: geekyeggo/delete-artifact@v1
- name: Clean artifacts
uses: geekyeggo/delete-artifact@v1
with:
name: |
drml
Expand Down
7 changes: 7 additions & 0 deletions .maintain/purge-large-cache.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/sh

cargo clean -p drml 2> /dev/null || true
cargo clean -p drml-service 2> /dev/null || true
cargo clean -p pangoro-runtime 2> /dev/null || true
cargo clean -p pangolin-runtime 2> /dev/null || true
rm -rf target/debug/wbuild 2> /dev/null || true
Loading

0 comments on commit a643f3d

Please sign in to comment.