forked from liberland/liberland_substrate
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
137 additions
and
103 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,137 @@ | ||
name: Build and Check | ||
|
||
|
||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- master | ||
workflow_dispatch: | ||
inputs: | ||
pull_request: | ||
description: set to pull_request number to execute on external pr | ||
required: false | ||
|
||
jobs: | ||
####### Check files and formatting ####### | ||
|
||
set-tags: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
git_branch: ${{ steps.check-git-ref.outputs.git_branch }} | ||
git_ref: ${{ steps.check-git-ref.outputs.git_ref }} | ||
|
||
check-cargo-toml-format: | ||
name: "Check Cargo.toml files format" | ||
runs-on: self-hosted | ||
needs: ["set-tags"] | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
ref: ${{ needs.set-tags.outputs.git_ref }} | ||
# With rustup's nice new toml format, we just need to run rustup show to install the toolchain | ||
# https://github.com/actions-rs/toolchain/issues/126#issuecomment-782989659 | ||
- name: Setup Rust toolchain | ||
run: rustup show | ||
- name: Check Cargo.toml files format with toml_sort | ||
run: ./scripts/check-cargo-toml-files-format.sh | ||
|
||
check-rust-fmt: | ||
name: "Check with rustfmt" | ||
runs-on: ubuntu-latest | ||
needs: ["set-tags"] | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
ref: ${{ needs.set-tags.outputs.git_ref }} | ||
# With rustup's nice new toml format, we just need to run rustup show to install the toolchain | ||
# https://github.com/actions-rs/toolchain/issues/126#issuecomment-782989659 | ||
- name: Setup Rust toolchain | ||
run: rustup show | ||
- name: Format code with rustfmt | ||
run: cargo fmt -- --check | ||
|
||
|
||
cargo-clippy: | ||
runs-on: self-hosted | ||
needs: ["set-tags"] | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
ref: ${{ needs.set-tags.outputs.git_ref }} | ||
- name: Setup Rust toolchain | ||
run: rustup show | ||
- name: Clippy | ||
run: SKIP_WASM_BUILD=1 env -u RUSTFLAGS cargo clippy | ||
|
||
build: | ||
runs-on: self-hosted | ||
needs: ["set-tags"] | ||
env: | ||
CARGO_SCCACHE_COMMIT: bed5571c | ||
RUSTFLAGS: "-C opt-level=3 -D warnings" | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
ref: ${{ needs.set-tags.outputs.git_ref }} | ||
- uses: actions/cache@v2 | ||
with: | ||
path: ${{ runner.tool_cache }}/cargo-sccache-${CARGO_SCCACHE_COMMIT} | ||
key: ${{ runner.OS }}-sccache-bin-${{ env.CARGO_SCCACHE_COMMIT }}-v1 | ||
|
||
# With rustup's nice new toml format, we just need to run rustup show to install the toolchain | ||
# https://github.com/actions-rs/toolchain/issues/126#issuecomment-782989659 | ||
- name: Setup Rust toolchain | ||
run: rustup show | ||
- name: SCCache | ||
run: | | ||
# We altered the path to avoid old actions to overwrite it | ||
SCCACHE_PATH=${{ runner.tool_cache }}/cargo-sccache-${CARGO_SCCACHE_COMMIT} | ||
SCCACHE_BIN=${SCCACHE_PATH}/bin/sccache | ||
if [ ! -f $SCCACHE_BIN ]; then | ||
cargo install sccache --git https://github.com/purestake/sccache.git --rev $CARGO_SCCACHE_COMMIT --force --no-default-features --features=dist-client --root $SCCACHE_PATH | ||
fi | ||
ls -la $SCCACHE_BIN | ||
ps aux | grep sccache | ||
if [[ -z `pgrep sccache` ]]; then | ||
chmod +x $SCCACHE_BIN | ||
$SCCACHE_BIN --start-server | ||
fi | ||
$SCCACHE_BIN -s | ||
echo "RUSTC_WRAPPER=$SCCACHE_BIN" >> $GITHUB_ENV | ||
- name: Build Node | ||
run: | | ||
env | ||
cargo build --release --all | ||
- name: Unit tests | ||
run: | | ||
cargo install cargo-expand | ||
cargo test --release --all | ||
- name: Cargo check | ||
run: cargo check --release | ||
- name: Save binary | ||
run: | | ||
mkdir -p build | ||
cp target/release/substrate build/substrate; | ||
- name: Upload binary | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: substrate | ||
path: build | ||
- name: Save runtime wasm | ||
run: | | ||
mkdir -p runtimes | ||
cp target/release/wbuild/*/*.compact.compressed.wasm runtimes/; | ||
- name: Upload runtimes | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: runtimes | ||
path: runtimes | ||
|
||
|
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.