Skip to content
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
21 changes: 19 additions & 2 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,32 @@ insert_final_newline = true
trim_trailing_whitespace = true
indent_style = space
indent_size = 2
max_line_length = 80

[*.{d,h,hpp,c,cpp,cxx,cs,hs,java,kt,py,rs,sol}]
indent_size = 4

[{Makefile,go.mod,go.sum,*.go,.gitmodules}]
[{Makefile,go.mod,go.sum,*.go,.gitmodules,dub.selections.json}]
indent_style = tab
indent_size = 4

[{CMakeLists.txt,*.cmake}]
indent_size = 2
indent_style = space

[*.md]
indent_style = space
# Prettier handles formatting for markdown files
# and `indent_size` is not enforcable because ordered and unordered lists use
# different indentation:
indent_size = unset

[**/Cargo.lock]
indent_style = space
indent_size = unset

[*.wit]
indent_style = space
indent_size = 2

[*.rs]
indent_size = unset
6 changes: 3 additions & 3 deletions .envrc
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# shellcheck shell=bash
if ! has nix_direnv_version || ! nix_direnv_version 2.4.0; then
source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/2.4.0/direnvrc" "sha256-XQzUAvL6pysIJnRJyR7uVpmUSZfc7LSgWQwq/4mBr1U="
if ! has nix_direnv_version || ! nix_direnv_version 3.0.6; then
source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/3.0.6/direnvrc" "sha256-RYcUJaRMf8oF5LznDrlCXbkOQrywm0HDv1VjYGaJGdM="
fi

dotenv_if_exists

use flake
nix_direnv_watch_file "$(find ./shells -name "*.nix" -printf '"%p" ')"
watch_file "$(find ./shells -name "*.nix" -printf '"%p" ')"
29 changes: 14 additions & 15 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
version: 2
updates:

- package-ecosystem: github-actions
directory: "/"
schedule:
interval: daily
time: '00:00'
timezone: UTC
commit-message:
prefix: "chore"
include: "scope"
groups:
gh-actions:
patterns:
# Bundle all GH Actions updates in a single PR
- "*"
- package-ecosystem: github-actions
directory: '/'
schedule:
interval: daily
time: '00:00'
timezone: UTC
commit-message:
prefix: 'chore'
include: 'scope'
groups:
gh-actions:
patterns:
# Bundle all GH Actions updates in a single PR
- '*'
2 changes: 1 addition & 1 deletion .github/install-nix/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ inputs:
required: false

runs:
using: "composite"
using: 'composite'
steps:
- name: Install Nix
uses: cachix/install-nix-action@v27
Expand Down
2 changes: 1 addition & 1 deletion .github/print-matrix/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ outputs:
value: ${{ steps.print-matrix.outputs.comment }}

runs:
using: "composite"
using: 'composite'
steps:
- name: Install Nix
uses: metacraft-labs/nixos-modules/.github/install-nix@main
Expand Down
29 changes: 26 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,34 @@ on:
pull_request:
branches:
- main
push:
branches:
- main

concurrency:
group: ${{ github.workflow }}-${{ github.repository }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
lint:
uses: ./.github/workflows/reusable-lint.yml
secrets: inherit
with:
runner: '["self-hosted", "Linux", "x86-64-v2"]'

test-mcl:
runs-on: self-hosted
steps:
- name: Install Nix
uses: metacraft-labs/nixos-modules/.github/install-nix@main
with:
cachix-cache: ${{ vars.CACHIX_CACHE }}
cachix-auth-token: ${{ secrets.CACHIX_AUTH_TOKEN }}
trusted-public-keys: ${{ vars.TRUSTED_PUBLIC_KEYS }}
substituters: ${{ vars.SUBSTITUTERS }}

- uses: actions/checkout@v4

- name: Build and test the `mcl` command
run: nix develop -c sh -c "dub test --root packages/mcl -- -e 'fetchJson|(coda\.)|nix.run|nix.build'"

ci:
uses: ./.github/workflows/reusable-flake-checks-ci-matrix.yml
secrets: inherit
Expand Down
36 changes: 0 additions & 36 deletions .github/workflows/mcl.yml

This file was deleted.

37 changes: 37 additions & 0 deletions .github/workflows/reusable-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: 'Lint'

on:
# Allow this workflow to be reused by other workflows:
workflow_call:
inputs:
runner:
description: 'JSON-encoded list of runner labels'
default: '["self-hosted"]'
required: false
type: string

secrets:
NIX_GITHUB_TOKEN:
description: GitHub token to add as access-token in nix.conf
required: false
CACHIX_AUTH_TOKEN:
description: 'Cachix auth token'
required: true

jobs:
lint:
runs-on: self-hosted
steps:
- uses: actions/checkout@v4

- name: Install Nix
uses: metacraft-labs/nixos-modules/.github/install-nix@main
with:
nix-github-token: ${{ secrets.NIX_GITHUB_TOKEN }}
cachix-auth-token: ${{ secrets.CACHIX_AUTH_TOKEN }}
cachix-cache: ${{ vars.CACHIX_CACHE }}
trusted-public-keys: ${{ vars.TRUSTED_PUBLIC_KEYS }}
substituters: ${{ vars.SUBSTITUTERS }}

- name: Check formatting
run: nix develop --accept-flake-config .#pre-commit -c pre-commit run --all --show-diff-on-failure --color=always
2 changes: 1 addition & 1 deletion .github/workflows/reusable-update-flake-lock.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: "Update Nix Flake lockfile"
name: 'Update Nix Flake lockfile'

on:
# Allow this workflow to be reused by other workflows:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/reusable-update-flake-packages.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: "Update Flake Packages ❄️"
name: 'Update Flake Packages ❄️'

on:
# Allow this workflow to be reused by other workflows:
Expand Down Expand Up @@ -29,7 +29,7 @@ on:

# Run everyday at 00:00:
schedule:
- cron: "0 0 * * *" # https://crontab.guru/#0_0_*_*_*
- cron: '0 0 * * *' # https://crontab.guru/#0_0_*_*_*

jobs:
updateFlakePackages:
Expand Down Expand Up @@ -57,4 +57,4 @@ jobs:
uses: metacraft-labs/nix-update-action@main
with:
token: ${{ steps.generate-token.outputs.token }}
blacklist: "ci-matrix,folder-size-metrics,mcl,grafana-agent,validator-ejector"
blacklist: 'ci-matrix,folder-size-metrics,mcl,grafana-agent,validator-ejector'
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,6 @@ matrix-*.json
shardMatrix.json

.vscode

# Pre Commit
.pre-commit-config.yaml
8 changes: 8 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.direnv
node_modules
.yarn
.pnp.cjs
.pnp.loader.mjs
*.json
flake.lock
*.mdx
8 changes: 8 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"tabWidth": 2,
"useTabs": false,
"singleQuote": true,
"semi": true,
"arrowParens": "avoid",
"trailingComma": "all"
}
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Evaluates each package, and compares it to it's last cached version, creating a
This command is not meant to be run manually, but rather to be ran by the CI.

ENV Variables:

- IS_INITIAL: `true` or `false`
- CACHIX_CACHE: Which cachix cache to search
- CACHIX_AUTH_TOKEN: The auth token for the cache
Expand All @@ -36,6 +37,7 @@ Usage: Use `mcl ci` instead
Evaluates each package, and compares it to it's last cached version, creating a table listing which packages are cached, which aren't, and which failed.

ENV Variables:

- IS_INITIAL: `true` or `false`
- CACHIX_CACHE: Which cachix cache to search
- CACHIX_AUTH_TOKEN: The auth token for the cache
Expand All @@ -53,6 +55,7 @@ Usage: `mcl deploy_spec`
### get_fstab

ENV Variables:

- IS_INITIAL: `true` or `false`
- CACHIX_CACHE: Which cachix cache to search
- CACHIX_AUTH_TOKEN: The auth token for the cache
Expand All @@ -74,9 +77,11 @@ Usage: `mcl host_info`
Create a starting nix configuration for target machine.

ENV Variables:

- SSH_PATH: SSH path of target machine

The remaining ENV variables are optional, and if missing will be prompted at runtime.

- CREATE_USER: bool
- USER_NAME: string
- MACHINE_NAME: string
Expand All @@ -93,6 +98,7 @@ Usage: `mcl machine_create`
Splits the list of packages under `checks` into n number of shards. Requires manual configuration using modules/shard-split. See this repo and `nix-blockchain-development`

ENV Variables:

- [Optional] GITHUB_OUTPUT: If set, exports results to GITHUB_INPUT env variable

Usage: `mcl shard_matrix`
7 changes: 7 additions & 0 deletions checks/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{ ... }:
{
imports = [
./packages-ci-matrix.nix
./pre-commit.nix
];
}
57 changes: 57 additions & 0 deletions checks/packages-ci-matrix.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{
lib,
inputs,
...
}:
{
perSystem =
{
inputs',
self',
pkgs,
...
}:
let
inherit (lib) optionalAttrs;
inherit (pkgs) system;
inherit (pkgs.hostPlatform) isLinux;
in
rec {
checks =
self'.packages
// {
inherit (self'.legacyPackages) rustToolchain;
inherit (self'.legacyPackages.inputs.dlang-nix) dub;
inherit (self'.legacyPackages.inputs.nixpkgs)
cachix
nix
nix-eval-jobs
nix-fast-build
;
inherit (self'.legacyPackages.inputs.ethereum-nix) foundry;
}
// optionalAttrs (system == "x86_64-linux" || system == "aarch64-darwin") {
inherit (self'.legacyPackages.inputs.ethereum-nix) geth;
}
// optionalAttrs isLinux {
inherit (inputs'.validator-ejector.packages) validator-ejector;
}
// optionalAttrs (system == "x86_64-linux") {
inherit (pkgs) terraform;
inherit (self'.legacyPackages.inputs.terranix) terranix;
inherit (self'.legacyPackages.inputs.dlang-nix)
dcd
dscanner
serve-d
dmd
ldc
;
inherit (self'.legacyPackages.inputs.ethereum-nix)
mev-boost
nethermind
web3signer
nimbus-eth2
;
};
};
}
Loading