Skip to content

Commit

Permalink
Merge pull request #1540 from input-output-hk/djo/1528/reorganize-crates
Browse files Browse the repository at this point in the history
Reorganize crates
  • Loading branch information
Alenar authored Feb 28, 2024
2 parents 18f2623 + 26f7b87 commit a15369c
Show file tree
Hide file tree
Showing 72 changed files with 523 additions and 288 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/actions/prepare-distribution/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ runs:
EOF
cargo metadata --quiet --no-deps | \
jq -r '.packages | sort_by(.name) | .[] | select([.name] | inside(["mithrildemo", "client-mithril-stake-distribution", "client-snapshot", "mithril-end-to-end", "mithril-relay"]) | not) | "| \(.name) | `\(.version)` |"' \
jq -r '.packages | sort_by(.name) | .[] | select([.name] | inside(["mithril-stm", "mithril-aggregator", "mithril-client", "mithril-client-cli", "mithril-client-wasm", "mithril-signer", "mithril-common"])) | "| \(.name) | `\(.version)` |"' \
>> ./release-notes-addon.txt
- name: Add compatibility table
shell: bash
run: |
Expand All @@ -74,7 +74,7 @@ runs:
echo '${{ inputs.compatibility-table }}' \
| jq -r 'keys_unsorted[] as $network | "| \($network) | \(.[$network]) |"' \
>> ./release-notes-addon.txt
- name: Add minimum supported libc version
shell: bash
run: |
Expand Down
79 changes: 40 additions & 39 deletions .github/workflows/actions/publish-crate-package/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ inputs:
package:
description: crate package name.
required: true
api_token:
api_token:
description: crates.io API token.
required: false
publish_args:
Expand All @@ -18,45 +18,46 @@ inputs:
runs:
using: "composite"
steps:
- name: Check crate latest version
id: check_version
shell: bash
run: |
echo "Check crate latest published version for '${{ inputs.package}}' package"
LATEST_REMOTE_VERSION=$(curl -sL https://crates.io/api/v1/crates/${{ inputs.package}} | jq -r '.crate.newest_version')
LOCAL_VERSION=$(cargo metadata --quiet --no-deps | jq -r '.packages[] | select(.name=="${{ inputs.package}}") | .version')
echo "Latest crate.io version: $LATEST_REMOTE_VERSION"
echo "Local version: $LOCAL_VERSION"
- name: Check crate latest version
id: check_version
shell: bash
run: |
echo "Check crate latest published version for '${{ inputs.package}}' package"
LATEST_REMOTE_VERSION=$(curl -sL https://crates.io/api/v1/crates/${{ inputs.package}} | jq -r '.crate.newest_version')
LOCAL_VERSION=$(cargo metadata --quiet --no-deps | jq -r '.packages[] | select(.name=="${{ inputs.package}}") | .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
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
- name: Copy OpenAPI specs files
if: inputs.package == 'mithril-common'
shell: bash
run: |
echo "Copy OpenAPI specs files"
cp openapi*.yaml ./${{ inputs.package}}
- name: Copy OpenAPI specs files
shell: bash
run: |
echo "Copy OpenAPI specs files"
cp openapi*.yaml ./${{ inputs.package}}
- name: Cargo publish dry run
shell: bash
run: |
echo "Cargo publish '${{ inputs.package }}' package (dry run)"
cargo publish -p ${{ inputs.package }} --dry-run --no-verify --allow-dirty ${{ inputs.publish_args }}
- name: Cargo publish dry run
shell: bash
run: |
echo "Cargo publish '${{ inputs.package }}' package (dry run)"
cargo publish -p ${{ inputs.package }} --dry-run --no-verify --allow-dirty ${{ inputs.publish_args }}
- name: Cargo package list
shell: bash
run: |
echo "Cargo package list '${{ inputs.package }}' package"
cargo package -p ${{ inputs.package }} --list --allow-dirty
- name: Cargo package list
shell: bash
run: |
echo "Cargo package list '${{ inputs.package }}' package"
cargo package -p ${{ inputs.package }} --list --allow-dirty
- name: Cargo publish
if: inputs.dry_run == 'false' && steps.check_version.outputs.should_deploy == 'true'
shell: bash
run: |
echo "Cargo publish '${{ inputs.package }}' package"
cargo publish -p ${{ inputs.package }} --token ${{ inputs.api_token }} --no-verify --allow-dirty ${{ inputs.publish_args }}
- name: Cargo publish
if: inputs.dry_run == 'false' && steps.check_version.outputs.should_deploy == 'true'
shell: bash
run: |
echo "Cargo publish '${{ inputs.package }}' package"
cargo publish -p ${{ inputs.package }} --token ${{ inputs.api_token }} --no-verify --allow-dirty ${{ inputs.publish_args }}
27 changes: 8 additions & 19 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -207,9 +207,8 @@ jobs:
uses: actions/upload-artifact@v4
if: success() || failure()
with:
name: test-results${{ matrix.artifact-suffix }}-${{ runner.os }}-${{ runner.arch }}
path: |
./test-results-*.xml
name: test-results-${{ runner.os }}-${{ runner.arch }}
path: ./test-results-*.xml

check:
runs-on: ubuntu-22.04
Expand Down Expand Up @@ -335,29 +334,18 @@ jobs:
!./artifacts/devnet/cardano-node
if-no-files-found: error

publish-tests-results:
send-tests-results:
if: success() || failure()
runs-on: ubuntu-22.04
needs:
- test
steps:
- name: Download Tests Results (${{ runner.os }}-${{ runner.arch }})
if: success() || failure()
uses: actions/download-artifact@v4
with:
name: test-results-${{ runner.os }}-${{ runner.arch }}

- name: Download Tests Results (macOS-X64)
if: success() || failure()
uses: actions/download-artifact@v4
with:
name: test-results-macOS-X64

- name: Download Tests Results (Windows-X64)
- name: Download Tests Results
if: success() || failure()
uses: actions/download-artifact@v4
with:
name: test-results-Windows-X64
pattern: test-results-*
merge-multiple: true

- name: Publish Unit Test Results
if: success() || failure()
Expand Down Expand Up @@ -431,7 +419,7 @@ jobs:
fail-fast: false
max-parallel: 1
matrix:
package: [ mithril-stm, mithril-common, mithril-client ]
package: [ mithril-stm, mithril-build-script, mithril-common, mithril-client ]

runs-on: ubuntu-22.04
needs:
Expand Down Expand Up @@ -700,6 +688,7 @@ jobs:
# Force `--lib` to avoid a collision between the client lib and the client cli binary who share
# the same name (we only want to document those anyway)
cargo doc --no-deps --lib -p mithril-stm -p mithril-common -p mithril-persistence \
-p mithril-build-script -p mithril-doc -p mithril-doc-derive \
-p mithril-aggregator -p mithril-signer -p mithril-client -p mithril-client-cli \
--all-features --message-format=json \
| clippy-sarif | tee rust-cargo-doc-results.sarif | sarif-fmt
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/manual-publish-crates.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,12 @@ jobs:
fail-fast: true
max-parallel: 1
matrix:
package: [ mithril-stm, mithril-common, mithril-client ]
package: [ mithril-stm, mithril-build-script, mithril-common, mithril-client ]
include:
- package: mithril-stm
api_token_secret_name: CRATES_IO_API_TOKEN
- package: mithril-build-script
api_token_secret_name: CRATES_IO_API_TOKEN_MITHRIL_BUILD_SCRIPT
- package: mithril-common
api_token_secret_name: CRATES_IO_API_TOKEN_MITHRIL_COMMON
- package: mithril-client
Expand All @@ -59,4 +61,4 @@ jobs:
with:
dry_run: ${{ inputs.dry_run }}
package: ${{ matrix.package }}
api_token: ${{ secrets[matrix.api_token_secret_name] }}
api_token: ${{ secrets[matrix.api_token_secret_name] }}
2 changes: 1 addition & 1 deletion .github/workflows/pre-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ jobs:
fail-fast: false
max-parallel: 1
matrix:
package: [ mithril-stm, mithril-common, mithril-client ]
package: [ mithril-stm, mithril-build-script, mithril-common, mithril-client ]

runs-on: ubuntu-22.04
steps:
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -172,10 +172,12 @@ jobs:
fail-fast: true
max-parallel: 1
matrix:
package: [ mithril-stm, mithril-common, mithril-client ]
package: [ mithril-stm, mithril-build-script, mithril-common, mithril-client ]
include:
- package: mithril-stm
api_token_secret_name: CRATES_IO_API_TOKEN
- package: mithril-build-script
api_token_secret_name: CRATES_IO_API_TOKEN_MITHRIL_BUILD_SCRIPT
- package: mithril-common
api_token_secret_name: CRATES_IO_API_TOKEN_MITHRIL_COMMON
- package: mithril-client
Expand Down
25 changes: 15 additions & 10 deletions Cargo.lock

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

8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ members = [
"examples/client-cardano-transaction",
"examples/client-mithril-stake-distribution",
"examples/client-snapshot",
"internal/mithril-build-script",
"internal/mithril-doc",
"internal/mithril-doc-derive",
"internal/mithril-persistence",
"mithril-aggregator",
"mithril-build-script",
"mithril-client",
"mithril-client-cli",
"mithril-client-wasm",
"mithril-common",
"mithril-doc",
"mithril-doc-derive",
"mithril-persistence",
"mithril-relay",
"mithril-signer",
"mithril-stm",
Expand Down
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
COMPONENTS = mithril-common mithril-persistence mithril-stm mithril-aggregator mithril-client mithril-client-cli mithril-signer demo/protocol-demo mithril-test-lab/mithril-end-to-end
COMPONENTS = mithril-common mithril-stm mithril-aggregator mithril-client mithril-client-cli mithril-signer \
internal/mithril-persistence internal/mithril-doc-derive internal/mithril-doc internal/mithril-build-script \
demo/protocol-demo mithril-test-lab/mithril-end-to-end
GOALS := $(or $(MAKECMDGOALS),all)

.PHONY: $(GOALS) $(COMPONENTS)
Expand Down
12 changes: 10 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,6 @@ This repository consists of the following parts:

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

* [**Mithril persistence**](./mithril-persistence): the **persistence** library that is used by the **Mithril network** nodes.

* [**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** and artifacts.
Expand All @@ -74,6 +72,16 @@ This repository consists of the following parts:

* [**Mithril signer**](./mithril-signer): the node of the **Mithril network** responsible for producing individual signatures that are collected and aggregated by the **Mithril aggregator**.

* [**Internal**](./internal): the shared tools and API used by **Mithril** crates.

* [**Mithril build script**](./internal/mithril-build-script): a toolbox for Mithril crates using a build scripts phase.

* [**Mithril doc**](./internal/mithril-doc): an API that generates markdown documentation for a crate command lines arguments.

* [**Mithril doc derive**](./internal/mithril-doc-derive): a macro implementation used by **Mithril doc**.

* [**Mithril persistence**](./internal/mithril-persistence): the **persistence** library that is used by the **Mithril network** nodes.

* [**Mithril test lab**](./mithril-test-lab): the suite of tools that allow us to test and stress the **Mithril** protocol implementations.

* [**Mithril devnet**](./mithril-test-lab/mithril-devnet): the private **Mithril/Cardano network** used to scaffold a **Mithril network** on top of a **Cardano network**.
Expand Down
4 changes: 2 additions & 2 deletions demo/protocol-demo/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "mithrildemo"
version = "0.1.30"
version = "0.1.31"
authors = { workspace = true }
edition = { workspace = true }
documentation = { workspace = true }
Expand All @@ -15,7 +15,7 @@ clap = { version = "4.4.18", features = ["derive"] }
hex = "0.4.3"
log = "0.4.20"
mithril-common = { path = "../../mithril-common", features = ["fs"] }
mithril-doc = { path = "../../mithril-doc" }
mithril-doc = { path = "../../internal/mithril-doc" }
rand_chacha = "0.3.1"
rand_core = "0.6.4"
serde = { version = "1.0.196", features = ["derive"] }
Expand Down
Loading

0 comments on commit a15369c

Please sign in to comment.