Skip to content

Commit

Permalink
chore(.github): revamp workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
pandres95 committed Jan 12, 2025
1 parent 7676d14 commit fd0cf10
Show file tree
Hide file tree
Showing 6 changed files with 140 additions and 67 deletions.
40 changes: 29 additions & 11 deletions .github/workflows/benchmarking.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,32 @@ on:

jobs:
build:
name: Build Target
runs-on: [self-hosted, builder]
runs-on: ubuntu-latest
steps:
- name: Setup Ubuntu dependencies
shell: bash
run: sudo apt update && sudo apt install -y protobuf-compiler

- uses: actions/checkout@v4
- uses: actions/cache@v4

- name: Rust Cache
uses: swatinem/rust-cache@v2
with:
cache-on-failure: true
cache-all-crates: true
key: build

- name: Release build with runtime-benchmarks
uses: actions-rs/cargo@v1
with:
path: target
key: ${{ runner.os }}-target-cache
- run: just build-local runtime-benchmarks
command: build
args: --release --features runtime-benchmarks

- uses: actions/upload-artifact@v4
with:
name: ${{ github.run_number }}-virto-node
path: ./target/release/virto-node
name: ${{ github.run_number }}-runtime
path: ./target/release/wbuild/kreivo-runtime/kreivo_runtime.compact.compressed.wasm

benchmark:
name: Run Benchmarks
needs: build
Expand All @@ -28,18 +40,24 @@ jobs:
pull-requests: write
steps:
- uses: actions/checkout@v4
- run: |

- name: Create `target/release` folder
run: |
mkdir -p .benchmarking-logs target/release
- uses: actions/download-artifact@v4
with:
name: ${{ github.run_number }}-virto-node
name: ${{ github.run_number }}-runtime
path: ./target/release

- run: |
just benchmarks
- uses: actions/upload-artifact@v4
with:
name: ${{ github.run_id }}-benchmark_logs
path: ./.benchmarking-logs

- uses: peter-evans/create-pull-request@v6
with:
add-paths: runtime/kreivo/src/weights
Expand Down
28 changes: 0 additions & 28 deletions .github/workflows/check-pr.yml

This file was deleted.

91 changes: 91 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
name: Lint, check, clippy and test

on:
push:
branches: [ main ]
pull_request:
types: [ opened, synchronize, reopened, ready_for_review ]

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Nightly with rustfmt
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
components: rustfmt

- name: Check formatting
run: cargo +nightly fmt --all -- --check

check:
needs: lint
runs-on: ubuntu-latest
steps:
- name: Setup Ubuntu dependencies
shell: bash
run: sudo apt update && sudo apt install -y protobuf-compiler

- uses: actions/checkout@v4

- name: Rust Cache
uses: swatinem/rust-cache@v2
with:
cache-on-failure: true
cache-all-crates: true
key: check

- name: Check Build
run: |
cargo check --release --locked --all-features --workspace
clippy:
needs: lint
runs-on: ubuntu-latest
permissions:
checks: write
env:
SKIP_WASM_BUILD: 1
steps:
- name: Setup Ubuntu dependencies
shell: bash
run: sudo apt update && sudo apt install -y protobuf-compiler

- uses: actions/checkout@v4

- name: Rust Cache
uses: swatinem/rust-cache@v2
with:
cache-on-failure: true
cache-all-crates: true
key: check

- name: Annotate with Clippy warnings
uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --release --locked --all-features --workspace -- --deny warnings

test:
needs: lint
runs-on: ubuntu-latest
steps:
- name: Setup Ubuntu dependencies
shell: bash
run: sudo apt update && sudo apt install -y protobuf-compiler

- uses: actions/checkout@v4

- name: Rust Cache
uses: swatinem/rust-cache@v2
with:
cache-on-failure: true
cache-all-crates: true
key: test

- name: Run tests
run: cargo test --release --locked --all-features --workspace
20 changes: 20 additions & 0 deletions .github/workflows/lint-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: "Lint PR"

on:
pull_request_target:
types:
- opened
- edited
- synchronize

permissions:
pull-requests: read

jobs:
lint:
name: Validate PR title for conventional commit compliance
runs-on: ubuntu-latest
steps:
- uses: amannn/action-semantic-pull-request@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
13 changes: 0 additions & 13 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,3 @@ jobs:
with:
files: |
release/*
container:
name: Containerize & Publish
needs: build
runs-on: [self-hosted, builder]
steps:
- name: Login to registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | podman login ghcr.io -u ${{ github.actor }} --password-stdin

- name: Publish image
run: |
podman push ghcr.io/virto-network/virto:$(just version)
podman push ghcr.io/virto-network/virto:latest
15 changes: 0 additions & 15 deletions .github/workflows/rust.yml

This file was deleted.

0 comments on commit fd0cf10

Please sign in to comment.