Skip to content

Commit

Permalink
github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
Carlos Rodriguez committed Mar 21, 2024
1 parent 9e3a5ce commit b7b0d89
Show file tree
Hide file tree
Showing 8 changed files with 235 additions and 69 deletions.
10 changes: 10 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: 2
updates:
- package-ecosystem: cargo
directory: "/"
schedule:
interval: weekly
day: monday
time: "15:00"
timezone: "Europe/Warsaw"
open-pull-requests-limit: 0
35 changes: 0 additions & 35 deletions .github/workflows/Release.yml

This file was deleted.

39 changes: 39 additions & 0 deletions .github/workflows/cw-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: CosmWasm Check
on:
pull_request:
paths:
- .github/workflows/cw-check.yml
- Cargo.toml
- Cargo.lock
- src/**

push:
branches: main
paths:
- .github/workflows/cw-check.yml
- Cargo.toml
- Cargo.lock
- src/**

jobs:
cw-check:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Git credentials
run:
git config --global --replace-all "url.https://${{ secrets.AUTH_TOKEN }}@github.com.insteadOf" ssh://[email protected]
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: wasm32-unknown-unknown
profile: minimal
override: true
- name: Cache Cargo registry
uses: Swatinem/rust-cache@v2
- name: Build rollkit-ibc CosmWasm contract
run: make build-cw

16 changes: 16 additions & 0 deletions .github/workflows/dependency_review.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: 'Dependency Review'
on: [pull_request]

permissions:
contents: read

jobs:
dependency-review:
runs-on: ubuntu-latest
steps:
- name: 'Checkout Repository'
uses: actions/checkout@v3
- name: 'Dependency Review'
uses: actions/dependency-review-action@v3
with:
fail-on-severity: critical
34 changes: 1 addition & 33 deletions .github/workflows/Basic.yml → .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,41 +2,9 @@

on: [push, pull_request]

name: Basic
name: lint

jobs:

test:
name: Test Suite
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v2

- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: 1.60.0
target: wasm32-unknown-unknown
override: true

- name: Run unit tests
uses: actions-rs/cargo@v1
with:
command: unit-test
args: --locked
env:
RUST_BACKTRACE: 1

- name: Compile WASM contract
uses: actions-rs/cargo@v1
with:
command: wasm
args: --locked
env:
RUSTFLAGS: "-C link-arg=-s"

lints:
name: Lints
runs-on: ubuntu-latest
Expand Down
131 changes: 131 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
name: Rust
on:
pull_request:
paths:
- .github/workflows/rust.yml
- Cargo.toml
- Cargo.lock
- clients/**
- modules/**
- mocks/**
push:
branches: main
paths:
- .github/workflows/rust.yml
- Cargo.toml
- Cargo.lock
- clients/**
- modules/**
- mocks/**

env:
CARGO_INCREMENTAL: 0
CARGO_PROFILE_DEV_DEBUG: 1
CARGO_PROFILE_RELEASE_DEBUG: 1
RUST_BACKTRACE: short
CARGO_NET_RETRY: 10
RUSTUP_MAX_RETRIES: 10

jobs:
cleanup-runs:
runs-on: ubuntu-latest
steps:
- uses: rokroskar/workflow-run-cleanup-action@master
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
if: ${{ !startsWith(github.ref, 'refs/tags/') && github.ref != 'refs/heads/main' }}

fmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1
with:
toolchain: nightly # Since fmt uses unstable features for organizing imports
components: rustfmt
override: true
- uses: Swatinem/rust-cache@v2
- uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check

doc_all_features:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Git credentials
run:
git config --global --replace-all "url.https://${{ secrets.AUTH_TOKEN }}@github.com.insteadOf" ssh://[email protected]
- uses: arduino/setup-protoc@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- uses: Swatinem/rust-cache@v2
- uses: actions-rs/cargo@v1
with:
command: doc
args: --all-features --no-deps --release

clippy_all_features:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Git credentials
run:
git config --global --replace-all "url.https://${{ secrets.AUTH_TOKEN }}@github.com.insteadOf" ssh://[email protected]
- uses: arduino/setup-protoc@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
components: clippy
override: true
- uses: Swatinem/rust-cache@v2
- uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --all-features --all-targets

clippy_no_default_features:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Git credentials
run:
git config --global --replace-all "url.https://${{ secrets.AUTH_TOKEN }}@github.com.insteadOf" ssh://[email protected]
- uses: arduino/setup-protoc@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
components: clippy
override: true
- uses: Swatinem/rust-cache@v2
- uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --no-default-features

test-stable:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- name: Set up Git credentials
run:
git config --global --replace-all "url.https://${{ secrets.AUTH_TOKEN }}@github.com.insteadOf" ssh://[email protected]
- uses: arduino/setup-protoc@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- uses: Swatinem/rust-cache@v2
- uses: actions-rs/cargo@v1
with:
command: test
args: --all-features --no-fail-fast --no-run
- uses: actions-rs/cargo@v1
with:
command: test
args: --all-features --no-fail-fast --workspace -- --nocapture

37 changes: 37 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Based on https://github.com/actions-rs/example/blob/master/.github/workflows/quickstart.yml

on: [push, pull_request]

name: build

jobs:
test:
name: Test Suite
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v2

- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: 1.60.0
target: wasm32-unknown-unknown
override: true

- name: Run unit tests
uses: actions-rs/cargo@v1
with:
command: unit-test
args: --locked
env:
RUST_BACKTRACE: 1

- name: Compile WASM contract
uses: actions-rs/cargo@v1
with:
command: wasm
args: --locked
env:
RUSTFLAGS: "-C link-arg=-s"
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ build-cw: ## Build the WASM file for the rollkit light client
@echo "Building the WASM file for the rollkit light client"
@RUSTFLAGS='-C link-arg=-s' cargo build --target wasm32-unknown-unknown --release --lib --locked
@mkdir -p contracts
@cp target/wasm32-unknown-unknown/release/rollkit-ibc.wasm contracts/
@cp target/wasm32-unknown-unknown/release/rollkit_ibc.wasm contracts/

optimize-contracts: ## Optimize WASM files in contracts directory
@echo "Optimizing WASM files..."
Expand Down

0 comments on commit b7b0d89

Please sign in to comment.