Skip to content

Commit 7178bf7

Browse files
authored
Merge pull request #610 from input-output-hk/ensemble/588-deployment-crates.io
Deployment to crates.io
2 parents e7b8860 + 66d583b commit 7178bf7

File tree

38 files changed

+158
-95
lines changed

38 files changed

+158
-95
lines changed

.github/workflows/actions/build-upload-mithril-artifact/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ runs:
2525
with:
2626
name: mithril-distribution-${{ runner.os }}-${{ runner.arch }}
2727
path: |
28-
target/release/libmithril.*
28+
target/release/libmithril_stm.*
2929
target/release/libmithril_common.*
3030
target/release/mithril-aggregator
3131
target/release/mithril-aggregator.exe

.github/workflows/docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
uses: actions-rs/cargo@v1
2222
with:
2323
command: doc
24-
args: --no-deps -p mithril -p mithril-common -p mithril-aggregator -p mithril-signer -p mithril-client
24+
args: --no-deps -p mithril-stm -p mithril-common -p mithril-aggregator -p mithril-signer -p mithril-client
2525

2626
- name: Publish Mithril-rust-doc
2727
uses: actions/upload-artifact@v3

.github/workflows/release.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,63 @@ jobs:
6060
push: true
6161
tags: ${{ steps.meta.outputs.tags }}
6262

63+
check-deploy-crates-io:
64+
runs-on: ubuntu-22.04
65+
outputs:
66+
should-deploy: ${{ steps.check_version.outputs.should_deploy }}
67+
steps:
68+
- name: Checkout sources
69+
uses: actions/checkout@v3
70+
71+
- name: Check crate latest version
72+
id: check_version
73+
run: |
74+
LATEST_REMOTE_VERSION=$(wget -q -O - https://crates.io/api/v1/crates/mithril-stm | jq -r '.crate.newest_version')
75+
LOCAL_VERSION=$(cargo metadata --quiet --no-deps | jq -r '.packages[] | select(.name=="mithril-stm") | .version')
76+
echo "Latest crate.io version: $LATEST_REMOTE_VERSION"
77+
echo "Local version: $LOCAL_VERSION"
78+
79+
if [ "$LOCAL_VERSION" != "$LATEST_REMOTE_VERSION" ]; then
80+
echo "Local version is newer than remote version: we will publish to crates.io"
81+
echo "should_deploy=true" >> $GITHUB_OUTPUT
82+
else
83+
echo "Local version and remote version are the same: no need to publish to crates.io"
84+
echo "should_deploy=false" >> $GITHUB_OUTPUT
85+
fi
86+
87+
deploy-crates-io:
88+
runs-on: ubuntu-22.04
89+
needs: check-deploy-crates-io
90+
if: needs.check-deploy-crates-io.outputs.should-deploy == 'true'
91+
steps:
92+
- name: Checkout sources
93+
uses: actions/checkout@v3
94+
95+
- name: Install stable toolchain
96+
uses: actions-rs/toolchain@v1
97+
with:
98+
profile: minimal
99+
toolchain: stable
100+
101+
- name: Cargo publish dry run
102+
uses: actions-rs/cargo@v1
103+
with:
104+
command: publish
105+
args: -p mithril-stm --dry-run
106+
107+
- name: Cargo package list
108+
uses: actions-rs/cargo@v1
109+
with:
110+
command: package
111+
args: -p mithril-stm --list
112+
113+
# We use the '--dry-run' arg until we have a valid CRATES_IO_API_TOKEN to avoid the workflow to crash
114+
- name: Cargo publish
115+
uses: actions-rs/cargo@v1
116+
with:
117+
command: publish
118+
args: -p mithril-stm --token ${{ secrets.CRATES_IO_API_TOKEN }} --dry-run
119+
63120
deploy-release:
64121
strategy:
65122
fail-fast: false

.gitignore

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
mithril.cabal
22
.stack-work/
33
.direnv/
4-
mithril-core/c-tests/tests
5-
mithril-core/c-tests/tests.dSYM/
4+
mithril-stm/c-tests/tests
5+
mithril-stm/c-tests/tests.dSYM/
66
*~
7-
mithril-core/proptest-regressions/
7+
mithril-stm/proptest-regressions/
88
*.dump
99
.tmp/
1010
.s.PGSQL*

Cargo.lock

Lines changed: 23 additions & 23 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ members = [
77
"mithril-aggregator",
88
"mithril-client",
99
"mithril-common",
10-
"mithril-core",
1110
"mithril-signer",
11+
"mithril-stm",
1212
"mithril-test-lab/mithril-end-to-end"
1313
]
1414

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
COMPONENTS = mithril-common mithril-core mithril-aggregator mithril-client mithril-signer demo/protocol-demo mithril-test-lab
1+
COMPONENTS = mithril-common mithril-stm mithril-aggregator mithril-client mithril-signer demo/protocol-demo mithril-test-lab
22
GOALS := $(or $(MAKECMDGOALS),all)
33

44
.PHONY: $(GOALS) $(COMPONENTS)

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ This repository is sliced in the following parts:
5454

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

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

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

docs/root/manual/developer-docs/references.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ For more information about the **Mithril Protocol**, please refer to the [About
2929
| Dependency | Description | Source Repository | Rust Documentation | REST API
3030
|------------|-------------|:-----------------:|:------------------:|:------------:|
3131
| **Mithril Common** | This is the **common** library that is used by the **Mithril Network** nodes. | [:arrow_upper_right:](https://github.com/input-output-hk/mithril/tree/main/mithril-common) | [:arrow_upper_right:](https://mithril.network/rust-doc/mithril_common/index.html) | -
32-
| **Mithril Core** | The **core** library that implements **Mithril** protocol cryptographic engine. | [:arrow_upper_right:](https://github.com/input-output-hk/mithril/tree/main/mithril-core) | [:arrow_upper_right:](https://mithril.network/rust-doc/mithril/index.html) | -
32+
| **Mithril STM** | The **core** library that implements **Mithril** protocol cryptographic engine. | [:arrow_upper_right:](https://github.com/input-output-hk/mithril/tree/main/mithril-stm) | [:arrow_upper_right:](https://mithril.network/rust-doc/mithril_stm/index.html) | -
3333
| **Mithril Aggregator** | The node of the **Mithril Network** responsible for collecting individual signatures from the **Mithril Signers** and aggregate them into a multisignature. The **Mithril Aggregator** uses this ability to provide certified snapshots of the **Cardano** blockchain. | [:arrow_upper_right:](https://github.com/input-output-hk/mithril/tree/main/mithril-aggregator) | [:arrow_upper_right:](https://mithril.network/rust-doc/mithril_aggregator/index.html) | [:arrow_upper_right:](/aggregator-api)
3434
| **Mithril Client** | The node of the **Mithril Network** responsible for restoring the **Cardano** blockchain on an empty node from a certified snapshot. | [:arrow_upper_right:](https://github.com/input-output-hk/mithril/tree/main/mithril-client) | [:arrow_upper_right:](https://mithril.network/rust-doc/mithril_client/index.html) | -
3535
| **Mithril Signer** | The node of the **Mithril Network** responsible for producing individual signatures that are collected and aggregated by the **Mithril Aggregator**. | [:arrow_upper_right:](https://github.com/input-output-hk/mithril/tree/main/mithril-signer) | [:arrow_upper_right:](https://mithril.network/rust-doc/mithril_signer/index.html) | -

mithril-aggregator/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ RUN adduser --no-create-home --disabled-password appuser
1818
WORKDIR /app
1919

2020
# Copy local dependencies
21-
COPY mithril-core/ /mithril-core/
22-
COPY Cargo.lock /mithril-core/
21+
COPY mithril-stm/ /mithril-stm/
22+
COPY Cargo.lock /mithril-stm/
2323
COPY mithril-common/ /mithril-common/
2424
COPY Cargo.lock /mithril-common/
2525

0 commit comments

Comments
 (0)