Skip to content

Commit

Permalink
CI: Build separation (#188)
Browse files Browse the repository at this point in the history
MERGE AFTER
#198

---------

Co-authored-by: Raid Ateir <ateirraid@gmail.com>
  • Loading branch information
rakanalh and Raid5594 authored Dec 29, 2023
1 parent a627182 commit b7e4ee1
Show file tree
Hide file tree
Showing 7 changed files with 162 additions and 781 deletions.
7 changes: 7 additions & 0 deletions .gitguardian.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Required, otherwise ggshield considers the file to use the deprecated v1 format
version: 2

secret:
# Exclude files and paths by globbing
ignored-paths:
- node/service/chain-specs/example.json
52 changes: 0 additions & 52 deletions .github/workflows/check.yaml

This file was deleted.

143 changes: 97 additions & 46 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -1,58 +1,109 @@
name: CI
name: PR

# Controls when the action will run.
on:
pull_request:
branches:
- dev
- master
- 'feature/**'
- 'release/**'
- 'hotfix/**'
types:
- opened
- synchronize
- edited

env:
PROFILE: release
# Triggers the workflow on push or pull request events but only for the master branch
push:
branches: [ '**' ]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

permissions:
id-token: write
contents: read

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
build:
runs-on: ubuntu-latest
concurrency: dev
format:
name: Check Lints
runs-on: ubuntu-22.04
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3

- name: Cache cargo registry
uses: actions/cache@v3
continue-on-error: false
- name: Install nightly toolchain
uses: actions-rs/toolchain@v1
with:
path: |
~/.cargo/registry
~/.cargo/git
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
- name: Configure AWS credentials ORG
uses: aws-actions/configure-aws-credentials@v1
toolchain: nightly-2022-10-09
override: true
components: rustfmt
- name: Check TOML
uses: dprint/check@v2.2
- name: Check Format
run: |
cargo fmt -- --check
check:
name: Cargo check
needs: format
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Install linux dependencies
run: sudo apt update && sudo apt install -y cargo clang libssl-dev llvm libudev-dev protobuf-compiler
- name: Install nightly toolchain
uses: actions-rs/toolchain@v1
with:
aws-access-key-id: ${{ secrets.ORG_AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.ORG_AWS_SECRET_ACCESS_KEY }}
aws-region: us-west-2
toolchain: nightly-2022-10-09
override: true
target: wasm32-unknown-unknown
- name: Rust Cache
uses: Swatinem/rust-cache@v2
- name: Check Build
run: |
SKIP_WASM_BUILD=1 cargo check --release
- name: Check Build for Benchmarking
run: >
pushd node &&
cargo check --features=runtime-benchmarks --release
- name: Login to Amazon ECR ORG
id: login-ecr-org
uses: aws-actions/amazon-ecr-login@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
clippy:
name: Run Clippy
needs: format
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Install linux dependencies
run: sudo apt update && sudo apt install -y cargo clang libssl-dev llvm libudev-dev protobuf-compiler
- name: Install nightly toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: nightly-2022-10-09
override: true
target: wasm32-unknown-unknown
components: clippy
- name: Rust Cache
uses: Swatinem/rust-cache@v2
- name: Check with Clippy
run: |
cargo clippy --no-deps --all-targets --features runtime-benchmarks --workspace -- --deny warnings
- name: Build and push docker image to ECR Docker
uses: docker/build-push-action@v4
tests:
name: Run tests
needs: format
# The type of runner that the job will run on
runs-on: ["self-hosted", "cere-network-memory-large"]
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
- name: Install linux dependencies
run: sudo apt update && sudo apt install -y cargo clang libssl-dev llvm libudev-dev protobuf-compiler
- name: Install nightly toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: nightly-2022-10-09
override: true
target: wasm32-unknown-unknown
- name: Rust Cache
uses: Swatinem/rust-cache@v2
- name: Run cargo-tarpaulin
uses: actions-rs/tarpaulin@v0.1
with:
version: '0.22.0'
args: '--verbose --locked --no-fail-fast --workspace --features runtime-benchmarks --out "Xml"'
- name: Upload coverage report
uses: actions/upload-artifact@v3
with:
context: .
file: Dockerfile.tests
push: false
build-args: |
"ECR_REGISTRY=${{ steps.login-ecr-org.outputs.registry }}"
name: tarpaulin coverage
path: ./tarpaulin-report.xml
2 changes: 1 addition & 1 deletion .github/workflows/dev.yaml → .github/workflows/e2e.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Release to dev
name: E2E
on:
push:
branches:
Expand Down
57 changes: 57 additions & 0 deletions .github/workflows/ecr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: ECR

on:
pull_request:
branches:
- dev
- master
- 'release/**'
- 'hotfix/**'
types:
- opened
- synchronize
- edited

env:
PROFILE: release

jobs:
build:
runs-on: ubuntu-latest
concurrency: dev
steps:
- uses: actions/checkout@v3

- name: Cache cargo registry
uses: actions/cache@v3
continue-on-error: false
with:
path: |
~/.cargo/registry
~/.cargo/git
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
- name: Configure AWS credentials ORG
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.ORG_AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.ORG_AWS_SECRET_ACCESS_KEY }}
aws-region: us-west-2

- name: Login to Amazon ECR ORG
id: login-ecr-org
uses: aws-actions/amazon-ecr-login@v1

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Build and push docker image to ECR Docker
uses: docker/build-push-action@v4
with:
context: .
file: Dockerfile.tests
push: false
build-args: |
"ECR_REGISTRY=${{ steps.login-ecr-org.outputs.registry }}"
Loading

0 comments on commit b7e4ee1

Please sign in to comment.