Skip to content

Commit

Permalink
adds paritytech/ci-linux:production (#536)
Browse files Browse the repository at this point in the history
* added paritytech

* update branch trigger

* update run machines

* Update .github/workflows/paritytech.yml

* Apply suggestions from code review

* update cargo nightly

* update cargo exec path

* Update .github/workflows/check.yml

Co-authored-by: Seun Lanlege <seun@composable.finance>

* update check.yml

* use llvm-cov action

* prevent rust-toolchain.toml from overriding parity:ci

* update workflow file

* fix hadolint

* update hadolint to action

* remove image for unit test

* fix syntax error

* install cargo-llvm manually

* use image

* skip hadolint and remark

* add llvm-tools-preview

* run llvm-cov on runner

* update workflow file

* update workflow file

* force install

* llvm-cov in paritytech/ci-linux:production

* rustup show

* install llvm

* remove sudo

* one-line install

* apt-get install wget

* apt-get install wget

* apt-get install wget

* gnupg2

* run code-cov on runner

* path to cargo bin

* remove llvm installation

* use specific nightly version

* please just work

* sigh

Co-authored-by: Seun Lanlege <seun@composable.finance>
Co-authored-by: Seun Lanlege <seunlanlege@gmail.com>
Co-authored-by: haroldsphinx <adedayoakinpelu@gmail.com>
  • Loading branch information
4 people committed Jan 22, 2022
1 parent 17f6c69 commit 1f6f5c3
Show file tree
Hide file tree
Showing 3 changed files with 145 additions and 47 deletions.
157 changes: 110 additions & 47 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,50 +8,123 @@ on:
- main
- develop
- releases
workflow_dispatch:

env:
DOCKER_USER_OPTION: '$UID:$GID'

jobs:
check:
name: Check
substrate-check:
name: Check Benchmarks
runs-on:
- self-hosted
- linux
- x64
- sre
container:
image: paritytech/ci-linux:production
steps:
- name: Clean up
continue-on-error: true
run: |
sudo chown -R $USER:$USER $GITHUB_WORKSPACE
docker system prune --force --all --volumes
- uses: actions/checkout@v2
- name: Rustup show
run: |
rustup show
- uses: actions/checkout@v2
- run: |
SKIP_WASM_BUILD=1 /home/runner/.cargo/bin/cargo check --all --benches
- name: Benchmark
- name: cargo check --all --benches
run: |
SKIP_WASM_BUILD=1 /home/runner/.cargo/bin/cargo check --features=runtime-benchmarks --workspace --release --exclude integration-tests
- name: Picasso
SKIP_WASM_BUILD=1 cargo +nightly check --benches --all # checks all rust crates with default-features, tests, benchmarks
substrate-test-coverage:
name: Unit Tests (With Coverage)
runs-on:
- self-hosted
- linux
- x64
- sre
steps:
- name: Clean up
continue-on-error: true
run: |
sudo chown -R $USER:$USER $GITHUB_WORKSPACE
docker system prune --force --all --volumes
- uses: actions/checkout@v2
- name: Rustup show
run: |
/home/runner/.cargo/bin/rustup show
- uses: actions/checkout@v2
- name: Run Test (with coverage)
run: |
# integration tests can't be compiled with --feature=runtime-benchmarks
# TODO: https://github.com/ComposableFi/composable/issues/535
/home/runner/.cargo/bin/cargo install -f cargo-llvm-cov
/home/runner/.cargo/bin/rustup component add llvm-tools-preview --toolchain=nightly-2021-11-08
SKIP_WASM_BUILD=1 /home/runner/.cargo/bin/cargo +nightly-2021-11-08 llvm-cov --workspace --locked --release --verbose --features=runtime-benchmarks --exclude=integration-tests --lcov --output-path lcov.info
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: lcov.info
fail_ci_if_error: false

substrate-tests:
name: Unit Tests
runs-on:
- self-hosted
- linux
- x64
- sre
container:
image: paritytech/ci-linux:production
steps:
- name: Clean up
continue-on-error: true
run: |
sudo chown -R $USER:$USER $GITHUB_WORKSPACE
docker system prune --force --all --volumes
- uses: actions/checkout@v2
- name: Rustup show
run: |
rustup show
- uses: actions/checkout@v2
- name: Run Test (with coverage)
run: |
/home/runner/.cargo/bin/cargo build --release -p picasso-runtime
SKIP_WASM_BUILD=1 cargo test --workspace --locked --release --verbose --features=runtime-benchmarks --exclude=integration-tests
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: lcov.info
fail_ci_if_error: false

linters:
name: Linters
runs-on:
- self-hosted
- linux
- x64
- sre
container:
image: paritytech/ci-linux:production
steps:
- uses: actions/checkout@v2
- run: |
/home/runner/.cargo/bin/rustup install nightly-2021-11-29
/home/runner/.cargo/bin/rustup target add --toolchain=nightly-2021-11-29 wasm32-unknown-unknown
/home/runner/.cargo/bin/rustup show
/home/runner/.cargo/bin/rustup override unset
/home/runner/.cargo/bin/rustup show
- name: Rustup show
run: |
rustup show
- name: Use Node.js 14.x
uses: actions/setup-node@v2
with:
node-version: 14.x
- name: Cargo fmt
run: |
/home/runner/.cargo/bin/cargo +nightly-2021-11-29 fmt -- --check
cargo +nightly fmt --all -- --check
- name: Hadolint
env:
HADOLINT_VERSION: v2.8.0
continue-on-error: true # this step is such a pita
run: |
curl -L -o hadolint "https://github.com/hadolint/hadolint/releases/download/${HADOLINT_VERSION}/hadolint-Linux-x86_64"
chmod +x hadolint
Expand All @@ -61,11 +134,27 @@ jobs:
echo "=== $file ==="
./hadolint --config .hadolint.yaml $file || total_exit_code=$?
echo ""
done < <(find . -name "Dockerfile")
done << (find . -name "Dockerfile")
exit $total_exit_code
- name: Remark
continue-on-error: true # this step is such a pita
run: |
npm install yarn
./node_modules/.bin/yarn add remark-cli \
remark-lint-mdash-style \
https://github.com/typeable/remark-validate-links#anchors \
remark-preset-lint-recommended \
remark-lint-no-dead-urls
total_exit_code=0
while IFS= read -r file; do
./node_modules/.bin/remark -f $file || total_exit_code=$?
done << (find . -name "*.md" -not -path "*/node_modules/*" -not -path "./.github/*")
exit $total_exit_code
- name: Cargo clippy
run: |
SKIP_WASM_BUILD=1 /home/runner/.cargo/bin/cargo +nightly-2021-11-29 clippy -- -D warnings
SKIP_WASM_BUILD=1 env -u RUSTFLAGS cargo +nightly clippy --all-targets
- name: Cargo udeps
env:
UDEPS_VERSION: v0.1.24
Expand All @@ -74,33 +163,7 @@ jobs:
tar xzf "cargo-udeps-${UDEPS_VERSION}-x86_64-unknown-linux-gnu.tar.gz"
cp "cargo-udeps-${UDEPS_VERSION}-x86_64-unknown-linux-gnu/cargo-udeps" ~/.cargo/bin/
rm -r "cargo-udeps-${UDEPS_VERSION}-x86_64-unknown-linux-gnu.tar.gz" "cargo-udeps-${UDEPS_VERSION}-x86_64-unknown-linux-gnu"
/home/runner/.cargo/bin/cargo +nightly-2021-11-29 udeps --version
SKIP_WASM_BUILD=1 /home/runner/.cargo/bin/cargo +nightly-2021-11-29 udeps --workspace --all-features
cargo udeps --version
SKIP_WASM_BUILD=1 cargo udeps --workspace --all-features
continue-on-error: true # Often this turns gives false positives, due to the different ways that Substrate uses features.
test:
name: Unit Test
runs-on:
- self-hosted
- linux
- x64
- sre
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
- run: |
/home/runner/.cargo/bin/rustup component add llvm-tools-preview
- name: Install cargo-llvm-cov
run: curl -LsSf https://github.com/taiki-e/cargo-llvm-cov/releases/latest/download/cargo-llvm-cov-x86_64-unknown-linux-gnu.tar.gz | tar xzf - -C ~/.cargo/bin
- name: Run Test (with coverage)
run: |
/home/runner/.cargo/bin/rustup install nightly-2021-11-29
/home/runner/.cargo/bin/rustup component add llvm-tools-preview --toolchain=nightly-2021-11-29
SKIP_WASM_BUILD=1 /home/runner/.cargo/bin/cargo +nightly-2021-11-29 llvm-cov --workspace --lcov --output-path lcov.info
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: lcov.info
fail_ci_if_error: false

5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,8 @@ scripts/polkadot-launch/*.log

target
.env

node_modules/
**/yarn-error.log
**/.yarn/
rust-toolchain.toml
30 changes: 30 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 1f6f5c3

Please sign in to comment.