Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: add some of the ci checks done on node #174

Merged
merged 5 commits into from
Jan 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions .codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
codecov:
require_ci_to_pass: true

coverage:
precision: 2
round: down
range: "70...100"

status:
project:
default:
target: auto
threshold: 1%
base: auto
branches:
- main
if_ci_failed: error
informational: false
only_pulls: false

patch:
default:
target: auto
threshold: 1%
base: auto
if_ci_failed: error
only_pulls: true

changes: false

comment:
layout: "diff, flags, files"
behavior: default
require_changes: false
require_base: false
require_head: true
hide_project_coverage: false

parsers:
gcov:
branch_detection:
conditional: true
loop: true
macro: false
method: false

github_checks:
annotations: true
17 changes: 17 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
version: 2
updates:
- package-ecosystem: "cargo"
directory: "/"
schedule:
interval: "weekly"
# Ignoring these dependencies until we have more comprehensive testing
# See: https://github.com/atoma-network/atoma-node/pull/366
ignore:
- dependency-name: "sui-*"
# Ignore all Sui related packages

# Optionally keep Actions up to date too
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
21 changes: 21 additions & 0 deletions .github/workflows/audit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Security audit
on:
schedule:
- cron: "0 0 * * *" # Run at midnight every day
push:
paths:
- "**/Cargo.toml"
- "**/Cargo.lock"
pull_request:
paths:
- "**/Cargo.toml"
- "**/Cargo.lock"

jobs:
audit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: rustsec/audit-check@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
52 changes: 52 additions & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Coverage

on: [push, pull_request]

env:
toolchain: nightly-2024-11-14
CARGO_HTTP_MULTIPLEXING: false
CARGO_TERM_COLOR: always
CARGO_UNSTABLE_SPARSE_REGISTRY: true
CARGO_INCREMENTAL: 0
TERM: unknown

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
coverage:
runs-on: ubuntu-22.04
services:
postgres:
image: postgres:13
env:
POSTGRES_DB: atoma
POSTGRES_USER: atoma
POSTGRES_PASSWORD: atoma
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v4

- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y pkg-config libtss2-dev

- name: Install cargo-llvm-cov
run: cargo install cargo-llvm-cov

- name: Generate coverage
run: cargo llvm-cov --all-features --workspace --lcov --output-path lcov.info

- name: Upload to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: lcov.info
19 changes: 19 additions & 0 deletions .github/workflows/deny.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: CI
on: [push, pull_request]
jobs:
cargo-deny:
runs-on: ubuntu-22.04
strategy:
matrix:
checks:
- advisories
- bans licenses sources

# Prevent sudden announcement of a new advisory from failing ci:
continue-on-error: ${{ matrix.checks == 'advisories' }}

steps:
- uses: actions/checkout@v4.2.2
- uses: EmbarkStudios/cargo-deny-action@v2.0.4
with:
command: check ${{ matrix.checks }}
32 changes: 32 additions & 0 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: End-to-end testing
on:
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
run-atoma-e2e-tests:
name: Run Atoma e2e tests
if: github.event_name == 'workflow_dispatch'
runs-on: ${{ fromJSON(github.repository == 'atoma-network/atoma-node' && '["self-hosted", "linux", "x64", "4xlarge"]' || '"ubuntu-latest"') }}
strategy:
matrix:
flavour: [chromium, native]
steps:
- uses: actions/checkout@v4

- uses: docker/setup-buildx-action@v3

- name: Build ${{ matrix.flavour }} image
run: ./scripts/build-e2e-image.sh
env:
AWS_BUCKET_NAME: ${{ vars.S3_ATOMA_BUILD_CACHE_BUCKET_NAME }}
AWS_ACCESS_KEY_ID: ${{ vars.S3_ATOMA_BUILD_CACHE_AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.S3_ATOMA_BUILD_CACHE_AWS_SECRET_ACCESS_KEY }}
AWS_REGION: ${{ vars.S3_ATOMA_BUILD_CACHE_AWS_REGION }}
FLAVOUR: ${{ matrix.flavour }}

- name: Run ${{ matrix.flavour }} tests
uses: atoma-network/atoma-testground/.github/actions/run-chat-completion-request@master
156 changes: 156 additions & 0 deletions deny.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
# This section is considered when running `cargo deny check advisories`
# More documentation for the advisories section can be found here:
# https://embarkstudios.github.io/cargo-deny/checks/advisories/cfg.html
[advisories]
# Version of the advisory config. See https://github.com/EmbarkStudios/cargo-deny/pull/611
version = 2
# The path where the advisory database is cloned/fetched into
db-path = "~/cargo/advisory-db"
# The url of the advisory database to use
db-urls = ["https://github.com/rustsec/advisory-db"]
# The lint level for crates that have been yanked from their source registry
yanked = "warn"
# A list of advisory IDs to ignore. Note that ignored advisories will still
# output a note when they are encountered.
ignore = [
# These are all related to the sui SDK, which is outside of our control
# derivative is not maintained
"RUSTSEC-2024-0388",
# difference 2.0.0 is unmaintained
"RUSTSEC-2020-0095",
# we don't do RSA signing on Sui (only verifying for zklogin)
"RUSTSEC-2023-0071",
# allow yaml-rust being unmaintained
"RUSTSEC-2024-0320",
# allow unmaintained proc-macro-error used in transitive dependencies
"RUSTSEC-2024-0370",
]
# Threshold for security vulnerabilities, any vulnerability with a CVSS score
# lower than the range specified will be ignored. Note that ignored advisories
# will still output a note when they are encountered.
# * None - CVSS Score 0.0
# * Low - CVSS Score 0.1 - 3.9
# * Medium - CVSS Score 4.0 - 6.9
# * High - CVSS Score 7.0 - 8.9
# * Critical - CVSS Score 9.0 - 10.0
#severity-threshold =

# This section is considered when running `cargo deny check licenses`
# More documentation for the licenses section can be found here:
# https://embarkstudios.github.io/cargo-deny/checks/licenses/cfg.html
[licenses]
# Version of the license config. See https://github.com/EmbarkStudios/cargo-deny/pull/611
version = 2
# List of explicitly allowed licenses
# See https://spdx.org/licenses/ for list of possible licenses
# [possible values: any SPDX 3.11 short identifier (+ optional exception)].
allow = [
"Apache-2.0 WITH LLVM-exception",
"Apache-2.0",
"BSD-2-Clause",
"BSD-3-Clause",
"ISC",
"MIT",
"MPL-2.0",
"BSL-1.0",
"OpenSSL",
"CC0-1.0",
"Unlicense",
"Unicode-3.0",
"Zlib",
]
# The confidence threshold for detecting a license from license text.
# The higher the value, the more closely the license text must be to the
# canonical license text of a valid SPDX license file.
# [possible values: any between 0.0 and 1.0].
confidence-threshold = 0.8
# Allow 1 or more licenses on a per-crate basis, so that particular licenses
# aren't accepted for every possible crate as with the normal allow list
exceptions = [

{ allow = [
"MIT",
], name = "addchain" },
{ allow = [
"MIT",
], name = "anemo" },
{ allow = [
"MIT",
], name = "addr2line" },
]

# Some crates don't have (easily) machine readable licensing information,
# adding a clarification entry for it allows you to manually specify the
# licensing information
[[licenses.clarify]]
name = "ring"
expression = "ISC AND MIT AND OpenSSL"
license-files = [{ path = "LICENSE", hash = 0xbd0eed23 }]

[licenses.private]
# If true, ignores workspace crates that aren't published, or are only
# published to private registries
ignore = false
# One or more private registries that you might publish crates to, if a crate
# is only published to private registries, and ignore is true, the crate will
# not have its license(s) checked
#registries = [
#]

# This section is considered when running `cargo deny check bans`.
# More documentation about the 'bans' section can be found here:
# https://embarkstudios.github.io/cargo-deny/checks/bans/cfg.html
[bans]
# Lint level for when multiple versions of the same crate are detected
multiple-versions = "warn"
# The graph highlighting used when creating dotgraphs for crates
# with multiple versions
# * lowest-version - The path to the lowest versioned duplicate is highlighted
# * simplest-path - The path to the version with the fewest edges is highlighted
# * all - Both lowest-version and simplest-path are used
highlight = "all"
# List of crates that are allowed. Use with care!
#allow = [
#]
# List of crates to deny
#deny = [
#]
# Certain crates/versions that will be skipped when doing duplicate detection.
#skip = [
#]
# Similarly to `skip` allows you to skip certain crates during duplicate
# detection. Unlike skip, it also includes the entire tree of transitive
# dependencies starting at the specified crate, up to a certain depth, which is
# by default infinite
#skip-tree = [
#]

# This section is considered when running `cargo deny check sources`.
# More documentation about the 'sources' section can be found here:
# https://embarkstudios.github.io/cargo-deny/checks/sources/cfg.html
[sources]
# Lint level for what to happen when a crate from a crate registry that is not
# in the allow list is encountered
unknown-registry = "deny"
# Lint level for what to happen when a crate from a git repository that is not
# in the allow list is encountered
unknown-git = "deny"
# List of URLs for allowed crate registries. Defaults to the crates.io index
# if not specified. If it is specified but empty, no registries are allowed.
allow-registry = ["https://github.com/rust-lang/crates.io-index"]
# List of URLs for allowed Git repositories
# Allow the mysten labs repositories for Sui
allow-git = [
"https://github.com/asonnino/prometheus-parser",
"https://github.com/zhiburt/tabled",
]

[sources.allow-org]
github = [
"mystenmark",
"bmwill",
"mystenlabs",
"nextest-rs",
"rustls",
"atoma-network",
]