Skip to content

Commit 360ea28

Browse files
committed
chore: Merge from main
2 parents 9f4b587 + ee3bd2d commit 360ea28

42 files changed

Lines changed: 5305 additions & 150 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
name: Cache
3+
description: Caches cargo dependencies
4+
inputs:
5+
components:
6+
description: Additional Rust components to install (comma separated). rustfmt and clippy are always included.
7+
required: false
8+
default: ''
9+
outputs:
10+
cache-hit:
11+
description: Cache Hit
12+
value: ${{ steps.cache.outputs.cache-hit }}
13+
runs:
14+
using: composite
15+
steps:
16+
- name: setup rust tool chain
17+
uses: dtolnay/rust-toolchain@1.86.0 # v1.86.0
18+
with:
19+
components: ${{ (inputs.components != '') && format('{0}, rustfmt, clippy', inputs.components) || 'rustfmt, clippy' }}
20+
- name: Restore cargo dependencies from cache
21+
uses: Swatinem/rust-cache@f0deed1e0edfc6a9be95417288c0e1099b1eeec3 # v2.7.7
22+
id: cache

.github/codecov.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
coverage:
3+
range: 90..100
4+
round: down
5+
precision: 1
6+
status:
7+
project:
8+
default:
9+
target: 80%
10+
threshold: 1%
11+
flags:
12+
- integration
13+
- properties
14+
- unittests
15+
patch:
16+
default:
17+
target: 90%
18+
threshold: 1%

.github/dependabot.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
---
2+
version: 2
3+
# opt in to updates for ecosystems that are not yet GA.
4+
enable-beta-ecosystems: true
5+
updates:
6+
# Maintain dependencies for GitHub Actions
7+
- package-ecosystem: github-actions
8+
directory: /
9+
schedule:
10+
interval: monthly
11+
commit-message:
12+
# Prefix all commit messages with "chore(deps): "
13+
prefix: 'chore(deps): '
14+
15+
# Maintain dependencies for cargo
16+
- package-ecosystem: cargo
17+
directory: /
18+
schedule:
19+
interval: monthly
20+
ignore:
21+
- dependency-name: '*'
22+
update-types:
23+
- version-update:semver-major
24+
commit-message:
25+
# Prefix all commit messages
26+
prefix: 'chore(deps): '
27+
labels:
28+
- dependabot
29+
- dependencies
30+
# Allow up to 10 open pull requests for testing
31+
open-pull-requests-limit: 5
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"LABEL": {
3+
"name": "PR title checker needs attention",
4+
"color": "EEEEEE"
5+
},
6+
"CHECKS": {
7+
"regexp": "^(fix|feat|docs|chore|refactor|style|ci|revert|test)!?(\\(.*\\))?!?:.*"
8+
},
9+
"MESSAGES": {
10+
"success": "PR title is valid",
11+
"failure": "PR title is invalid",
12+
"notice": "Title needs to pass regex '^(fix|feat|docs|chore|refactor|style|ci|revert|test)!?(\\(.*\\))?!?:.*"
13+
}
14+
}

.github/pull_request_template.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Summary
2+
3+
## Testing Process
4+
5+
## Checklist
6+
7+
- [ ] Add a reference to related issues in the PR description.
8+
- [ ] Add unit tests if applicable.

.github/workflows/ci.yaml

Lines changed: 206 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,206 @@
1+
---
2+
name: CI
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
types:
8+
- opened
9+
- synchronize
10+
- reopened
11+
- ready_for_review
12+
paths-ignore:
13+
- docs/**
14+
- '**.md'
15+
- .github/**
16+
- .gitignore
17+
push:
18+
branches:
19+
- main
20+
paths-ignore:
21+
- docs/**
22+
- '**.md'
23+
- .github/**
24+
# run concurrency group for the workflow
25+
concurrency:
26+
group: ${{ github.workflow }}-${{ github.ref }}
27+
cancel-in-progress: true
28+
jobs:
29+
changed_files:
30+
if: ${{ github.event.pull_request.draft == false }}
31+
runs-on: ubuntu-latest
32+
name: Test changed-files
33+
outputs:
34+
changed-rust-files: ${{ steps.changed-files-yaml.outputs.code_any_changed }}
35+
changed-lockfile-files: ${{ steps.changed-files-yaml.outputs.lockfile_any_changed }}
36+
changed-docker-files: ${{ steps.changed-files-yaml.outputs.docker_any_changed }}
37+
changed-tests-files: ${{ steps.changed-files-yaml.outputs.tests_any_changed }}
38+
steps:
39+
# Checkout the repository
40+
- name: Harden the runner (Audit all outbound calls)
41+
uses: step-security/harden-runner@ec9f2d5744a09debf3a187a3f4f675c53b671911 # v2.13.0
42+
with:
43+
egress-policy: audit
44+
- name: Checkout Code
45+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
46+
- name: Get changed files
47+
id: changed-files-yaml
48+
uses: tj-actions/changed-files@ed68ef82c095e0d48ec87eccea555d944a631a4c # v46.0.5
49+
with:
50+
files_yaml: |
51+
code:
52+
- '**/*.rs'
53+
- 'rustfmt.toml'
54+
- 'rust-toolchain.toml'
55+
lockfile:
56+
- 'Cargo.lock'
57+
- 'Cargo.toml'
58+
docker:
59+
- 'Dockerfile.development'
60+
- 'Dockerfile.production'
61+
- 'docker-compose.yml'
62+
- 'Cargo.lock'
63+
- 'Cargo.toml'
64+
tests:
65+
- '**/*.rs'
66+
- tests/**/*.json
67+
ci:
68+
if: ${{ github.event.pull_request.draft == false && always() }}
69+
permissions:
70+
contents: none
71+
name: CI
72+
needs:
73+
- msrv
74+
- rustfmt
75+
- clippy
76+
runs-on: ubuntu-latest
77+
steps:
78+
- name: Harden the runner (Audit all outbound calls)
79+
uses: step-security/harden-runner@ec9f2d5744a09debf3a187a3f4f675c53b671911 # v2.13.0
80+
with:
81+
egress-policy: audit
82+
- name: Failed
83+
run: exit 1
84+
if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')
85+
msrv:
86+
if: ${{ github.event.pull_request.draft == false && github.event_name != 'push' && (needs.changed_files.outputs.changed-rust-files == 'true' || needs.changed_files.outputs.changed-lockfile-files == 'true') }}
87+
runs-on: ubuntu-latest
88+
needs: changed_files
89+
steps:
90+
# Checkout the repository
91+
- name: Harden the runner (Audit all outbound calls)
92+
uses: step-security/harden-runner@ec9f2d5744a09debf3a187a3f4f675c53b671911 # v2.13.0
93+
with:
94+
egress-policy: audit
95+
- name: Checkout Code
96+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
97+
- name: Prepare
98+
id: init
99+
uses: ./.github/actions/prepare
100+
101+
# Get the output of the prepare composite action
102+
- name: Get cache-hit output
103+
run: 'echo "Cache hit >>>>>: ${{ steps.init.outputs.cache-hit }}"'
104+
- name: Install cargo hack
105+
uses: taiki-e/install-action@7689010b667477e55299b24c373cdf719c945fdf # cargo-hack
106+
107+
# Check the minimum supported Rust version
108+
- name: Default features
109+
run: cargo hack check --feature-powerset --locked --rust-version --all-targets
110+
rustfmt:
111+
if: ${{ github.event.pull_request.draft == false && github.event_name != 'push' && needs.changed_files.outputs.changed-rust-files == 'true' }}
112+
needs: changed_files
113+
runs-on: ubuntu-latest
114+
steps:
115+
# Checkout the repository
116+
- name: Harden the runner (Audit all outbound calls)
117+
uses: step-security/harden-runner@ec9f2d5744a09debf3a187a3f4f675c53b671911 # v2.13.0
118+
with:
119+
egress-policy: audit
120+
- name: Checkout Code
121+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
122+
- name: Prepare
123+
id: init
124+
uses: ./.github/actions/prepare
125+
126+
# Get the output of the prepare composite action
127+
- name: Get cache-hit output
128+
run: 'echo "Cache hit >>>>>: ${{ steps.init.outputs.cache-hit }}"'
129+
130+
# Check the formatting of the code
131+
- name: Check formatting
132+
run: cargo fmt --all -- --check
133+
clippy:
134+
if: ${{ github.event.pull_request.draft == false && github.event_name != 'push' && needs.changed_files.outputs.changed-rust-files == 'true' }}
135+
needs: changed_files
136+
runs-on: ubuntu-latest
137+
steps:
138+
# Checkout the repository
139+
- name: Harden the runner (Audit all outbound calls)
140+
uses: step-security/harden-runner@ec9f2d5744a09debf3a187a3f4f675c53b671911 # v2.13.0
141+
with:
142+
egress-policy: audit
143+
- name: Checkout Code
144+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
145+
- name: Prepare
146+
id: init
147+
uses: ./.github/actions/prepare
148+
149+
# Get the output of the prepare composite action
150+
- name: Get cache-hit output
151+
run: 'echo "Cache hit >>>>>: ${{ steps.init.outputs.cache-hit }}"'
152+
- name: Install SARIF tools
153+
run: cargo install clippy-sarif --locked
154+
- name: Install SARIF tools
155+
run: cargo install sarif-fmt --locked
156+
- name: Check
157+
run: >
158+
cargo clippy --all-features --all-targets --message-format=json
159+
| clippy-sarif
160+
| tee clippy-results.sarif
161+
| sarif-fmt
162+
continue-on-error: true
163+
- name: Report status
164+
run: cargo clippy --all-features --all-targets -- -D warnings --allow deprecated
165+
test:
166+
if: ${{ github.event.pull_request.draft == false && needs.changed_files.outputs.changed-tests-files == 'true' }}
167+
permissions:
168+
contents: read
169+
needs:
170+
- changed_files
171+
runs-on: ubuntu-latest
172+
steps:
173+
# Checkout the repository
174+
- name: Harden the runner (Audit all outbound calls)
175+
uses: step-security/harden-runner@ec9f2d5744a09debf3a187a3f4f675c53b671911 # v2.13.0
176+
with:
177+
egress-policy: audit
178+
- name: Checkout Code
179+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
180+
- name: Setup Node.js
181+
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
182+
with:
183+
node-version: '20'
184+
- name: Prepare
185+
id: init
186+
uses: ./.github/actions/prepare
187+
with:
188+
components: llvm-tools-preview
189+
190+
# Get the output of the prepare composite action
191+
- name: Get cache-hit output
192+
run: 'echo "Cache hit >>>>>: ${{ steps.init.outputs.cache-hit }}"'
193+
- name: Install cargo hack
194+
uses: taiki-e/install-action@7689010b667477e55299b24c373cdf719c945fdf # cargo-hack
195+
- name: Install cargo-llvm-cov
196+
uses: taiki-e/install-action@16edcff251c6bb06f6878981359f84b77b28e7e2 # cargo-llvm-cov
197+
- name: Build
198+
run: cargo test --no-run --locked
199+
200+
# Unit tests coverage
201+
- name: Run Unit Tests and Generate Coverage Report
202+
env:
203+
LLVM_PROFILE_FILE: unit-%p-%m.profraw
204+
RUSTFLAGS: -Cinstrument-coverage
205+
RUST_TEST_THREADS: 1
206+
run: cargo llvm-cov --workspace --locked --lib --lcov --output-path unit-lcov.info

.gitignore

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# Generated by Cargo
22
/target/
3-
Cargo.lock
43

54
# IDE
65
.idea/
@@ -29,4 +28,7 @@ cache/
2928
data/
3029

3130
# Contracts
32-
oif-contracts/
31+
oif-contracts/
32+
33+
# Converage
34+
*.info

0 commit comments

Comments
 (0)