-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ci): add workflows & repo templates
- Loading branch information
1 parent
53ec792
commit 761c104
Showing
10 changed files
with
391 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
name: 🐞 Bug report | ||
description: Create a report to help us improve | ||
title: "🐞 [Bug]: " | ||
labels: ["bug"] | ||
body: | ||
- type: markdown | ||
attributes: | ||
value: | | ||
Thanks for taking the time to fill out this bug report! Briefly describe the issue you're experiencing. Tell us what you were trying to do and what happened instead. Remember, this is not a place to ask for help debugging code. For that, we welcome you in the OpenZeppelin Community Forum: https://forum.openzeppelin.com/. | ||
- type: textarea | ||
id: what-happened | ||
attributes: | ||
label: What happened? | ||
description: if you want, you can include screenshots as well :) | ||
validations: | ||
required: true | ||
- type: checkboxes | ||
id: platform | ||
attributes: | ||
label: platform | ||
description: On which operating system did this bug emerge? | ||
options: | ||
- label: linux | ||
required: false | ||
- label: windows | ||
required: false | ||
- label: macos | ||
required: false | ||
- type: textarea | ||
id: expected | ||
attributes: | ||
label: Expected behavior | ||
description: What should have happened instead? | ||
- type: checkboxes | ||
id: terms | ||
attributes: | ||
label: Contribution Guidelines | ||
description: By submitting this issue, you agree to follow our [Contribution Guidelines](https://github.com/OpenZeppelin/rust-contracts-stylus/blob/main/CONTRIBUTING.md) | ||
options: | ||
- label: I agree to follow this project's Contribution Guidelines | ||
required: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
contact_links: | ||
- name: Questions & Support Requests | ||
url: https://forum.openzeppelin.com/c/support/17 | ||
about: Ask in the OpenZeppelin Forum |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
name: 🎁 Feature Request | ||
description: Suggest an idea for this project ⚡️ | ||
title: "🎁 [Feature Request]: " | ||
labels: ["enhancement"] | ||
body: | ||
- type: markdown | ||
attributes: | ||
value: | | ||
Thanks for taking the time to fill this feature request! | ||
- type: textarea | ||
id: feature | ||
attributes: | ||
label: What is the feature you would like to see? | ||
description: Is your feature request related to a specific problem? Is it just a crazy idea? Tell us about it! | ||
validations: | ||
required: true | ||
- type: checkboxes | ||
id: terms | ||
attributes: | ||
label: Contribution Guidelines | ||
description: By submitting this issue, you agree to follow our [Contribution Guidelines](https://github.com/OpenZeppelin/rust-contracts-stylus/blob/main/CONTRIBUTING.md) | ||
options: | ||
- label: I agree to follow this project's Contribution Guidelines | ||
required: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# ref: https://docs.codecov.com/docs/codecovyml-reference | ||
coverage: | ||
# Hold ourselves to a high bar. | ||
range: 95..100 | ||
round: down | ||
precision: 1 | ||
status: | ||
# ref: https://docs.codecov.com/docs/commit-status | ||
project: | ||
default: | ||
# Avoid false negatives. | ||
threshold: 1% | ||
# Test files aren't important for coverage. | ||
ignore: | ||
- "tests" | ||
- "docs" | ||
# Make comments less noisy. | ||
comment: | ||
layout: "files" | ||
require_changes: true | ||
github_checks: | ||
annotations: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: github-actions | ||
directory: / | ||
schedule: | ||
interval: daily | ||
- package-ecosystem: cargo | ||
directory: / | ||
schedule: | ||
interval: daily | ||
ignore: | ||
- dependency-name: "*" | ||
update-types: | ||
- "version-update:semver-patch" | ||
- "version-update:semver-minor" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<!-- Thank you for your interest in contributing to OpenZeppelin! --> | ||
|
||
<!-- Consider opening an issue for discussion prior to submitting a PR. --> | ||
<!-- New features will be merged faster if they were first discussed and designed with the team. --> | ||
|
||
Fixes #??? <!-- Fill in with issue number --> | ||
|
||
<!-- Describe the changes introduced in this pull request. --> | ||
<!-- Include any context necessary for understanding the PR's purpose. --> | ||
|
||
#### PR Checklist | ||
|
||
<!-- Before merging the pull request all of the following must be completed. --> | ||
<!-- Feel free to submit a PR or Draft PR even if some items are pending. --> | ||
<!-- Some of the items may not apply. --> | ||
|
||
- [ ] Tests | ||
- [ ] Documentation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
name: check | ||
# This workflow runs whenever a PR is opened or updated, or a commit is pushed | ||
# to main. It runs several checks: | ||
# - fmt: checks that the code is formatted according to `rustfmt`. | ||
# - clippy: checks that the code does not contain any `clippy` warnings. | ||
# - doc: checks that the code can be documented without errors. | ||
# - hack: check combinations of feature flags. | ||
permissions: | ||
contents: read | ||
# This configuration allows maintainers of this repo to create a branch and | ||
# pull request based on the new branch. Restricting the push trigger to the | ||
# main branch ensures that the PR only gets built once. | ||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
# If new code is pushed to a PR branch, then cancel in progress workflows for | ||
# that PR. Ensures that we don't waste CI time, and returns results quicker | ||
# https://github.com/jonhoo/rust-ci-conf/pull/5 | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | ||
cancel-in-progress: true | ||
env: | ||
CARGO_TERM_COLOR: always | ||
jobs: | ||
fmt: | ||
runs-on: ubuntu-latest | ||
name: nightly / fmt | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
submodules: true | ||
- name: Install stable | ||
# We run in nightly to make use of some features only available there. | ||
# Check out `rustfmt.toml` to see which ones. | ||
uses: dtolnay/rust-toolchain@nightly | ||
with: | ||
components: rustfmt | ||
- name: cargo fmt --all --check | ||
run: cargo fmt --all --check | ||
clippy: | ||
runs-on: ubuntu-latest | ||
name: ${{ matrix.toolchain }} / clippy | ||
permissions: | ||
contents: read | ||
checks: write | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
# Get early warning of new lints which are regularly introduced in beta | ||
# channels. | ||
toolchain: [stable, beta] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
submodules: true | ||
- name: Install ${{ matrix.toolchain }} | ||
uses: dtolnay/rust-toolchain@master | ||
with: | ||
toolchain: ${{ matrix.toolchain }} | ||
components: clippy | ||
- name: cargo clippy | ||
uses: giraffate/clippy-action@v1 | ||
with: | ||
reporter: 'github-pr-check' | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
doc: | ||
# Run docs generation on nightly rather than stable. This enables features | ||
# like https://doc.rust-lang.org/beta/unstable-book/language-features/doc-cfg.html | ||
# which allows an API be documented as only available in some specific | ||
# platforms. | ||
runs-on: ubuntu-latest | ||
name: nightly / doc | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
submodules: true | ||
- name: Install nightly | ||
uses: dtolnay/rust-toolchain@nightly | ||
- name: cargo doc | ||
run: cargo doc --no-deps --all-features | ||
env: | ||
RUSTDOCFLAGS: --cfg docsrs | ||
hack: | ||
# `cargo-hack` checks combinations of feature flags to ensure that features | ||
# are all additive which is required for feature unification. | ||
runs-on: ubuntu-latest | ||
name: ubuntu / stable / features | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
submodules: true | ||
- name: Install stable | ||
uses: dtolnay/rust-toolchain@stable | ||
- name: cargo install cargo-hack | ||
uses: taiki-e/install-action@cargo-hack | ||
# Intentionally no target specifier; see https://github.com/jonhoo/rust-ci-conf/pull/4 | ||
# --feature-powerset runs for every combination of features | ||
- name: cargo hack | ||
run: cargo hack --feature-powerset check |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: no-std | ||
# This workflow checks whether the library is able to run without the std | ||
# library. See `check.yml` for information about how the concurrency | ||
# cancellation and workflow triggering works. | ||
permissions: | ||
contents: read | ||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | ||
cancel-in-progress: true | ||
env: | ||
CARGO_TERM_COLOR: always | ||
jobs: | ||
nostd: | ||
runs-on: ubuntu-latest | ||
name: ${{ matrix.target }} | ||
strategy: | ||
matrix: | ||
target: [wasm32-unknown-unknown, thumbv7m-none-eabi, aarch64-unknown-none] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
submodules: true | ||
- name: Install stable | ||
uses: dtolnay/rust-toolchain@stable | ||
- name: rustup target add ${{ matrix.target }} | ||
run: rustup target add ${{ matrix.target }} | ||
- name: cargo check | ||
run: cargo check --target ${{ matrix.target }} --no-default-features |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
name: test | ||
# This is the main CI workflow that runs the test suite on all pushes to main | ||
# and all pull requests. It runs the following jobs: | ||
# - required: runs the test suite on ubuntu with stable and beta rust | ||
# toolchains. | ||
# - minimal: runs the test suite with the minimal versions of the dependencies | ||
# that satisfy the requirements of this crate, and its dependencies. | ||
# - os-check: runs the test suite on mac and windows. | ||
# - coverage: runs the test suite and collects coverage information. | ||
# See `check.yml` for information about how the concurrency cancellation and | ||
# workflow triggering works. | ||
permissions: | ||
contents: read | ||
on: | ||
push: | ||
branches: [main] | ||
paths-ignore: | ||
- "**.md" | ||
- "**.adoc" | ||
pull_request: | ||
paths-ignore: | ||
- "**.md" | ||
- "**.adoc" | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | ||
cancel-in-progress: true | ||
env: | ||
CARGO_TERM_COLOR: always | ||
jobs: | ||
required: | ||
runs-on: ubuntu-latest | ||
name: ubuntu / ${{ matrix.toolchain }} | ||
strategy: | ||
matrix: | ||
# Run on stable and beta to ensure that tests won't break on the next | ||
# version of the rust toolchain. | ||
toolchain: [stable, beta] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
submodules: true | ||
- name: Install ${{ matrix.toolchain }} | ||
uses: dtolnay/rust-toolchain@master | ||
with: | ||
toolchain: ${{ matrix.toolchain }} | ||
- name: cargo generate-lockfile | ||
# Enable this ci template to run regardless of whether the lockfile is | ||
# checked in or not. | ||
if: hashFiles('Cargo.lock') == '' | ||
run: cargo generate-lockfile | ||
# https://twitter.com/jonhoo/status/1571290371124260865 | ||
- name: cargo test --locked | ||
run: cargo test --locked --all-features --all-targets | ||
# https://github.com/rust-lang/cargo/issues/6669 | ||
- name: cargo test --doc | ||
run: cargo test --locked --all-features --doc | ||
os-check: | ||
# Run cargo test on MacOS and Windows. | ||
runs-on: ${{ matrix.os }} | ||
name: ${{ matrix.os }} / stable | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [macos-latest, windows-latest] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
submodules: true | ||
- name: Install stable | ||
uses: dtolnay/rust-toolchain@stable | ||
- name: cargo generate-lockfile | ||
if: hashFiles('Cargo.lock') == '' | ||
run: cargo generate-lockfile | ||
- name: cargo test | ||
run: cargo test --locked --all-features --all-targets | ||
coverage: | ||
# Use llvm-cov to build and collect coverage and outputs in a format that | ||
# is compatible with codecov.io. | ||
# | ||
# Note that codecov as of v4 requires that CODECOV_TOKEN from | ||
# | ||
# https://app.codecov.io/gh/<user or org>/<project>/settings | ||
# | ||
# is set in two places on your repo: | ||
# | ||
# - https://github.com/jonhoo/guardian/settings/secrets/actions | ||
# - https://github.com/jonhoo/guardian/settings/secrets/dependabot | ||
# | ||
# (the former is needed for codecov uploads to work with Dependabot PRs) | ||
# | ||
# PRs coming from forks of your repo will not have access to the token, but | ||
# for those, codecov allows uploading coverage reports without a token. | ||
# it's all a little weird and inconvenient. see | ||
# | ||
# https://github.com/codecov/feedback/issues/112 | ||
# | ||
# for lots of more discussion. | ||
runs-on: ubuntu-latest | ||
name: ubuntu / stable / coverage | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
submodules: true | ||
- name: Install stable | ||
uses: dtolnay/rust-toolchain@stable | ||
with: | ||
components: llvm-tools-preview | ||
- name: cargo install cargo-llvm-cov | ||
uses: taiki-e/install-action@cargo-llvm-cov | ||
- name: cargo generate-lockfile | ||
if: hashFiles('Cargo.lock') == '' | ||
run: cargo generate-lockfile | ||
- name: cargo llvm-cov | ||
run: cargo llvm-cov --locked --all-features --lcov --output-path lcov.info | ||
- name: Record Rust version | ||
run: echo "RUST=$(rustc --version)" >> "$GITHUB_ENV" | ||
- name: Upload to codecov.io | ||
uses: codecov/codecov-action@v4 | ||
with: | ||
fail_ci_if_error: true | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
env_vars: OS,RUST |
Oops, something went wrong.