Skip to content

Commit

Permalink
Merge branch 'input-output-hk:main' into jpraynaud/remove-clippy-file
Browse files Browse the repository at this point in the history
  • Loading branch information
jpraynaud authored Nov 29, 2022
2 parents ef0c6c6 + 9cf597c commit 017cc63
Show file tree
Hide file tree
Showing 92 changed files with 4,212 additions and 557 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ runs:
with:
name: mithril-distribution-${{ runner.os }}-${{ runner.arch }}
path: |
target/release/libmithril.*
target/release/libmithril_stm.*
target/release/libmithril_common.*
target/release/mithril-aggregator
target/release/mithril-aggregator.exe
Expand Down
26 changes: 14 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
name: CI

on:
push:
branches: # only run on branch push, tag push will be ignored
- '**'
pull_request:
types: [opened, reopened, synchronize, closed]
paths-ignore: # ignore docs only changes since they use a dedicated workflows: docs.yml
- 'docs/**'
- 'mithril-explorer/**'
- '.github/workflows/docs.yml'

concurrency:
group: ci-build-test-${{ github.ref }}
cancel-in-progress: true

jobs:
build-ubuntu-X64:
runs-on: ubuntu-22.04
Expand Down Expand Up @@ -245,12 +248,11 @@ jobs:
packages: write

env:
PUSH_PACKAGES: ${{ github.ref == 'refs/heads/main' || startsWith('refs/heads/hotfix', github.ref) }}
PUSH_PACKAGES: ${{ github.event.action == 'closed' && github.event.pull_request.merged == true && (github.base_ref == 'main' || startsWith('hotfix', github.base_ref)) }}
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository_owner }}/${{ matrix.project }}
DOCKER_FILE: ./${{ matrix.project }}/Dockerfile.ci
CONTEXT: .
GITHUB_REF: ${{ github.ref}}

steps:
- name: Checkout
Expand All @@ -270,7 +272,7 @@ jobs:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
unstable
type=raw,value={{branch}}-{{sha}}
type=raw,value=${{ github.base_ref }}-{{sha}}
- name: Download built artifacts
uses: actions/download-artifact@v3
Expand All @@ -287,7 +289,7 @@ jobs:
tags: ${{ steps.meta.outputs.tags }}

unstable-release:
if: github.ref == 'refs/heads/main' || startsWith('refs/heads/hotfix', github.ref)
if: github.event.action == 'closed' && github.event.pull_request.merged == true && (github.base_ref == 'main' || startsWith('hotfix', github.base_ref))
runs-on: ubuntu-22.04
needs:
- build
Expand Down Expand Up @@ -374,9 +376,9 @@ jobs:
mithril_api_domain: api.mithril.network
mithril_protocol_parameters: |
{
k = 5
m = 100
phi_f = 0.65
k = 2422
m = 20973
phi_f = 0.2
}
mithril_signers: |
{
Expand Down Expand Up @@ -412,7 +414,7 @@ jobs:
uses: actions/checkout@v3

- name: Get Docker image id
run: echo "DOCKER_IMAGE_ID=${{ github.head_ref || github.ref_name }}-$(echo ${{ github.sha }} | cut -c1-7)" >> $GITHUB_ENV
run: echo "DOCKER_IMAGE_ID=${{ github.base_ref }}-$(echo ${{ github.sha }} | cut -c1-7)" >> $GITHUB_ENV

- name: Prepare service account credentials
run: |
Expand Down Expand Up @@ -456,7 +458,7 @@ jobs:
GOOGLE_APPLICATION_CREDENTIALS=./google-application-credentials.json terraform plan --var-file=./env.variables.tfvars
- name: Terraform Apply
if: github.ref == 'refs/heads/main'
if: github.event.action == 'closed' && github.event.pull_request.merged == true && github.base_ref == 'main'
run: |
GOOGLE_APPLICATION_CREDENTIALS=./google-application-credentials.json terraform apply -auto-approve --var-file=./env.variables.tfvars
Expand Down
13 changes: 8 additions & 5 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
name: Documentations & Explorer

on:
push:
branches: # only run on branch push, tag push will be ignored
- '**'
pull_request:
types: [opened, reopened, synchronize, closed]

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

jobs:
cargo-doc:
Expand All @@ -21,7 +24,7 @@ jobs:
uses: actions-rs/cargo@v1
with:
command: doc
args: --no-deps -p mithril -p mithril-common -p mithril-aggregator -p mithril-signer -p mithril-client
args: --no-deps -p mithril-stm -p mithril-common -p mithril-aggregator -p mithril-signer -p mithril-client

- name: Publish Mithril-rust-doc
uses: actions/upload-artifact@v3
Expand Down Expand Up @@ -113,7 +116,7 @@ jobs:
out/*
publish-docs:
if: github.ref == 'refs/heads/main'
if: github.event.action == 'closed' && github.event.pull_request.merged == true && github.base_ref == 'main'
runs-on: ubuntu-22.04
needs:
- cargo-doc
Expand Down
23 changes: 23 additions & 0 deletions .github/workflows/pre-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,29 @@ jobs:
title: Mithril v${{ github.ref_name }}
files: package/*

- name: Prepare crates versions table
run: |
cat > ./versions-manifest.txt << EOF
## Crates Versions
| Crate | Version |
|---------- |-------------|
EOF
cargo metadata --quiet --no-deps | \
jq -r '.packages | sort_by(.name) | .[] | select([.name] | inside(["mithrildemo", "mithril-end-to-end"]) | not) | "| \(.name) | `\(.version)` |"' \
>> ./versions-manifest.txt
- name: Update release body with crates versions table
id: update_release
uses: tubone24/update_release@v1.3.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAG_NAME: ${{ github.ref_name }}
with:
is_append_body: true
body_path: ./versions-manifest.txt

build-push-docker:
runs-on: ubuntu-22.04
strategy:
Expand Down
57 changes: 57 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,63 @@ jobs:
push: true
tags: ${{ steps.meta.outputs.tags }}

check-deploy-crates-io:
runs-on: ubuntu-22.04
outputs:
should-deploy: ${{ steps.check_version.outputs.should_deploy }}
steps:
- name: Checkout sources
uses: actions/checkout@v3

- name: Check crate latest version
id: check_version
run: |
LATEST_REMOTE_VERSION=$(wget -q -O - https://crates.io/api/v1/crates/mithril-stm | jq -r '.crate.newest_version')
LOCAL_VERSION=$(cargo metadata --quiet --no-deps | jq -r '.packages[] | select(.name=="mithril-stm") | .version')
echo "Latest crate.io version: $LATEST_REMOTE_VERSION"
echo "Local version: $LOCAL_VERSION"
if [ "$LOCAL_VERSION" != "$LATEST_REMOTE_VERSION" ]; then
echo "Local version is newer than remote version: we will publish to crates.io"
echo "should_deploy=true" >> $GITHUB_OUTPUT
else
echo "Local version and remote version are the same: no need to publish to crates.io"
echo "should_deploy=false" >> $GITHUB_OUTPUT
fi
deploy-crates-io:
runs-on: ubuntu-22.04
needs: check-deploy-crates-io
if: needs.check-deploy-crates-io.outputs.should-deploy == 'true'
steps:
- name: Checkout sources
uses: actions/checkout@v3

- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable

- name: Cargo publish dry run
uses: actions-rs/cargo@v1
with:
command: publish
args: -p mithril-stm --dry-run

- name: Cargo package list
uses: actions-rs/cargo@v1
with:
command: package
args: -p mithril-stm --list

# We use the '--dry-run' arg until we have a valid CRATES_IO_API_TOKEN to avoid the workflow to crash
- name: Cargo publish
uses: actions-rs/cargo@v1
with:
command: publish
args: -p mithril-stm --token ${{ secrets.CRATES_IO_API_TOKEN }} --dry-run

deploy-release:
strategy:
fail-fast: false
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/scripts/edit-cargo-toml-version.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def append_label_to_cargo_toml_version(cargo_toml_path, label: str, dry_run: boo
print("No package section (probably a workspace file), skipping this Cargo.toml")
return

new_version = f"{cargo_toml['package']['version'].split('-', 1)[0]}-{label}"
new_version = f"{cargo_toml['package']['version'].split('+', 1)[0]}+{label}"
print(f"{cargo_toml_path} new version: {new_version}")

if not dry_run:
Expand Down
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
mithril.cabal
.stack-work/
.direnv/
mithril-core/c-tests/tests
mithril-core/c-tests/tests.dSYM/
mithril-stm/c-tests/tests
mithril-stm/c-tests/tests.dSYM/
*~
mithril-core/proptest-regressions/
mithril-stm/proptest-regressions/
*.dump
.tmp/
.s.PGSQL*
Expand Down
46 changes: 23 additions & 23 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ members = [
"mithril-aggregator",
"mithril-client",
"mithril-common",
"mithril-core",
"mithril-signer",
"mithril-stm",
"mithril-test-lab/mithril-end-to-end"
]

Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
COMPONENTS = mithril-common mithril-core mithril-aggregator mithril-client mithril-signer demo/protocol-demo mithril-test-lab
COMPONENTS = mithril-common mithril-stm mithril-aggregator mithril-client mithril-signer demo/protocol-demo mithril-test-lab
GOALS := $(or $(MAKECMDGOALS),all)

.PHONY: $(GOALS) $(COMPONENTS)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ This repository is sliced in the following parts:

* [**Mithril Common**](./mithril-common): this is the **common** library that is used by the **Mithril Network** nodes.

* [**Mithril Core**](./mithril-core): the **core** library that implements **Mithril** protocol cryptographic engine.
* [**Mithril STM**](./mithril-stm): the **core** library that implements **Mithril** protocol cryptographic engine.

* [**Mithril Explorer**](./mithril-explorer): the **explorer** website that connects to a **Mithril Aggregator** and displays its **Certificate Chain**.

Expand Down
12 changes: 11 additions & 1 deletion docs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,14 @@ clean:
rm yarn.lock || true

upgrade: clean install
yarn upgrade @docusaurus/core@latest @docusaurus/preset-classic@latest redocusaurus@latest
yarn upgrade @docusaurus/core@latest @docusaurus/preset-classic@latest redocusaurus@latest

update-current:
# Use docusaurus command to create a new version using a temporary name
yarn run docusaurus docs:version updated
# cleanup previous file & replace it with the updated ones
rm -rf versioned_docs/version-maintained versioned_sidebars/version-maintained-sidebars.json
mv versioned_docs/version-updated versioned_docs/version-maintained
mv versioned_sidebars/version-updated-sidebars.json versioned_sidebars/version-maintained-sidebars.json
# Remove the entry for the temporary version in the versions.json file
sed -i '/updated/d' versions.json
21 changes: 20 additions & 1 deletion docs/docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,21 @@ const config = {
path: 'root',
routeBasePath: '/',
sidebarPath: require.resolve('./sidebars.js'),
editUrl: 'https://github.com/input-output-hk/mithril/edit/main/docs',
editUrl: ({docPath}) => {
// We want users to submit doc updates to the upstream/next version!
// Otherwise we risk losing the update on the next release.
return `https://github.com/input-output-hk/mithril/edit/main/docs/root/${docPath}`;
},
lastVersion: 'maintained',
versions: {
current: {
label: 'Next 🚧',
banner: 'unreleased',
},
maintained: {
label: 'Current',
}
},
},
blog: {
path: 'blog/',
Expand Down Expand Up @@ -113,6 +127,11 @@ const config = {
label: 'About Mithril',
position: 'left',
},
{
type: 'docsVersionDropdown',
position: 'right',
dropdownActiveClassDisabled: true,
},
{
label: 'Explorer',
to: 'https://mithril.network/explorer',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
sidebar_position: 1
---

import NetworksMatrix from '../../../../shared/networks-matrix.md';
import NetworksMatrix from '../../../networks-matrix.md';

# Mithril Aggregator Node

Expand Down
Loading

0 comments on commit 017cc63

Please sign in to comment.