Skip to content

Commit

Permalink
fix: added github workflow and update pr template
Browse files Browse the repository at this point in the history
  • Loading branch information
EdsonAlcala committed Sep 6, 2024
1 parent ae2e686 commit 999229a
Show file tree
Hide file tree
Showing 7 changed files with 86 additions and 132 deletions.
32 changes: 23 additions & 9 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,13 @@
Thank you for your Pull Request. Please provide a description above and review
the requirements below.
Bug fixes and new features should include tests.
Bug fixes and new examples should include tests.
Contributors guide: https://github.com/alloy-rs/examples/blob/main/CONTRIBUTING.md
Contributors guide: https://github.com/Omni-rs/examples/blob/main/CONTRIBUTING.md
The contributors guide includes instructions for running rustfmt and building the
documentation.
The contributors guide includes instructions for running and building the documentation.
-->

<!-- ** Please select "Allow edits from maintainers" in the PR Options ** -->

## Motivation

<!--
Expand All @@ -27,7 +24,24 @@ Summarize the solution and provide any necessary context needed to understand
the code change.
-->

## PR Checklist
## Notes to reviewers

<!--
Include any notes to the reviewers about the code change.
-->

## How has it been tested?

<!--
Describe the tests that you ran to verify your changes. Provide instructions so
we can reproduce. Please also list any relevant details for your test
configuration.
-->

## Checklist

- [ ] Added Documentation
- [ ] Breaking changes
- [ ] Does the example follow the contributing guidelines?
- [ ] Does the example have a README.md?
- [ ] Does the example have tests?
- [ ] Updated README.md
- [ ] Does the Github workflow pass?
21 changes: 21 additions & 0 deletions .github/actions/install-just/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: 'Install Just'
description: 'Installs Just command runner with caching'
runs:
using: "composite"
steps:
- name: Cache Just
uses: actions/cache@v4
id: cache-just
with:
path: ~/.cargo/bin/just
key: ${{ runner.os }}-just-${{ hashFiles('**/justfile') }}

- name: Install Just
if: steps.cache-just.outputs.cache-hit != 'true'
uses: taiki-e/install-action@v2
with:
tool: just

- name: Verify Just Installation
run: just --version
shell: bash
12 changes: 12 additions & 0 deletions .github/actions/setup-rust/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: "Setup Rust Environment"
description: "Setup Rust environment with caching"
runs:
using: "composite"
steps:
- name: "${{ matrix.toolchain }}"
uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ matrix.toolchain }}
- uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
87 changes: 0 additions & 87 deletions .github/workflows/release.yml

This file was deleted.

63 changes: 27 additions & 36 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,51 +11,42 @@ env:
jobs:
clippy:
runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v4
- name: Run clippy
run: cargo clippy --all-targets -- -D clippy::all -D clippy::nursery
- uses: actions/checkout@v4
- uses: ./.github/actions/install-just
- run: just lint

cargo-fmt:
runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v4
- name: Run cargo fmt
run: cargo fmt --check

# there're sometimes warnings, which signal, that the generated doc
# won't look as expected, when rendered, and sometimes errors, which will prevent doc from being
# generated at release time altogether.
cargo-doc:
runs-on: ubuntu-20.04

- uses: actions/checkout@v4
- uses: ./.github/actions/install-just
- run: just fmt

build:
needs: [clippy, cargo-fmt]
strategy:
matrix:
platform: [ubuntu-latest, macos-latest]
toolchain: [stable, nightly]
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v4
- name: run cargo doc
run: RUSTDOCFLAGS="-D warnings" cargo doc
- uses: actions/checkout@v4
- uses: ./.github/actions/install-just
- uses: ./.github/actions/setup-rust
- run: just check

test:
needs: cargo-fmt
tests:
needs: [build]
strategy:
matrix:
platform: [ubuntu-latest, macos-latest]
toolchain: [stable]
toolchain: [stable, nightly]
runs-on: ${{ matrix.platform }}

steps:
- uses: actions/checkout@v2
- name: "${{ matrix.toolchain }}"
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.toolchain }}
default: true
- uses: Swatinem/rust-cache@v1
- name: Add wasm32 target
run: rustup target add wasm32-unknown-unknown
- name: Check with stable features
run: cargo check --verbose
- name: Run tests with unstable features
run: NEAR_RPC_TIMEOUT_SECS=100 cargo test --verbose --features unstable
- uses: actions/checkout@v4
- uses: ./.github/actions/install-just
- uses: ./.github/actions/setup-rust
- uses: foundry-rs/foundry-toolchain@v1
- name: Run all tests
run: just test-all
File renamed without changes.
3 changes: 3 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,6 @@ check-wasm:
# Run example
run PROJECT:
cargo test -p {{PROJECT}} -- --nocapture

test-all:
cargo test --workspace -- --nocapture

0 comments on commit 999229a

Please sign in to comment.