diff --git a/.github/workflows/actions/build-upload-mithril-artifact/action.yml b/.github/workflows/actions/build-upload-mithril-artifact/action.yml index b504a9f8163..75d770db00e 100644 --- a/.github/workflows/actions/build-upload-mithril-artifact/action.yml +++ b/.github/workflows/actions/build-upload-mithril-artifact/action.yml @@ -5,25 +5,9 @@ inputs: description: Arguments to pass to 'cargo build' required: false default: '' - cache-version: - description: Version of the current cache - required: false - default: '' runs: using: "composite" steps: - - name: Install stable toolchain - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: stable - override: true - - - name: Rust Cache - uses: Swatinem/rust-cache@v2 - with: - key: ${{ runner.os }}-cache-v${{ inputs.cache-version }} - - name: Add commit short sha to Cargo.tomls version shell: bash run: | diff --git a/.github/workflows/actions/toolchain-and-cache/action.yml b/.github/workflows/actions/toolchain-and-cache/action.yml new file mode 100644 index 00000000000..e443a7475a6 --- /dev/null +++ b/.github/workflows/actions/toolchain-and-cache/action.yml @@ -0,0 +1,31 @@ +name: toolchain-and-cache +description: Install the stable cargo toolchain, the given cargo tools, and try to restore cache +inputs: + cache-version: + description: Version of the current cache + required: false + default: '' + cargo-tools: + description: Space seperated list of cargo tools to install + required: false + default: '' +runs: + using: "composite" + steps: + - name: Install stable toolchain + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + override: true + + - name: Rust Cache + uses: Swatinem/rust-cache@v2 + with: + key: ${{ runner.os }}-cache-v${{ inputs.cache-version }} + + - name: Install cargo tools + if: inputs.cargo-tools != '' + shell: bash + run: | + cargo install ${{ inputs.cargo-tools }} 2>/dev/null || true # Suppress the "binary `xyz` already exists in destination" error diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 255282f22d3..78203de3069 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,10 +15,28 @@ jobs: - name: Checkout sources uses: actions/checkout@v3 + - name: Install stable toolchain, tools, and restore cache + uses: ./.github/workflows/actions/toolchain-and-cache + with: + cache-version: ${{ secrets.CACHE_VERSION }} + cargo-tools: cargo-deb + - name: Build Mithril workspace & publish artifacts uses: ./.github/workflows/actions/build-upload-mithril-artifact + + - name: Build Debian packages + shell: bash + run: | + cargo deb -p mithril-aggregator + cargo deb -p mithril-signer + cargo deb -p mithril-client + + - name: Publish Debian packages + uses: actions/upload-artifact@v3 with: - cache-version: ${{ secrets.CACHE_VERSION }} + name: mithril-deb-packages-${{ runner.os }}-${{ runner.arch }} + path: target/debian/*.deb + if-no-files-found: error - name: Publish End-to-end runner (${{ runner.os }}-${{ runner.arch }}) uses: actions/upload-artifact@v3 @@ -27,6 +45,7 @@ jobs: path: target/release/mithril-end-to-end if-no-files-found: error + build: strategy: fail-fast: false @@ -44,11 +63,15 @@ jobs: steps: - name: Checkout sources uses: actions/checkout@v3 + + - name: Install stable toolchain and restore cache + uses: ./.github/workflows/actions/toolchain-and-cache + with: + cache-version: ${{ secrets.CACHE_VERSION }} - name: Build Mithril workspace & publish artifacts uses: ./.github/workflows/actions/build-upload-mithril-artifact with: - cache-version: ${{ secrets.CACHE_VERSION }} build-args: ${{ matrix.build-args }} test: @@ -75,22 +98,11 @@ jobs: - name: Checkout sources uses: actions/checkout@v3 - - name: Install stable toolchain - uses: actions-rs/toolchain@v1 + - name: Install stable toolchain, tools, and restore cache + uses: ./.github/workflows/actions/toolchain-and-cache with: - profile: minimal - toolchain: stable - override: true - - - name: Rust Cache - uses: Swatinem/rust-cache@v2 - with: - key: ${{ runner.os }}-cache-v${{ secrets.CACHE_VERSION }} - - - name: Install cargo tools - shell: bash - run: | - cargo install cargo2junit 2>/dev/null || true # Suppress the "binary `xyz` already exists in destination" error + cache-version: ${{ secrets.CACHE_VERSION }} + cargo-tools: cargo2junit - name: Run tests shell: bash @@ -114,24 +126,11 @@ jobs: - name: Checkout sources uses: actions/checkout@v3 - - name: Install stable toolchain - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: stable - components: clippy, rustfmt - override: true - - - name: Rust Cache - uses: Swatinem/rust-cache@v2 + - name: Install stable toolchain, tools, and restore cache + uses: ./.github/workflows/actions/toolchain-and-cache with: - key: ${{ runner.os }}-cache-v${{ secrets.CACHE_VERSION }} - - - name: Install cargo tools - if: steps.cargo-cache.outputs.cache-hit == false - shell: bash - run: | - cargo install cargo-sort 2>/dev/null || true # Suppress the "binary `xyz` already exists in destination" error + cache-version: ${{ secrets.CACHE_VERSION }} + cargo-tools: cargo-sort - name: Cargo check uses: actions-rs/cargo@v1 @@ -312,6 +311,12 @@ jobs: name: mithril-distribution-Linux-X64 path: ./package-Linux-X64 + - name: Download Debian packages (Linux-X64) + uses: actions/download-artifact@v3 + with: + name: mithril-deb-packages-Linux-x64 + path: ./package + - name: Download built artifacts (macOS-X64) uses: actions/download-artifact@v3 with: diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 5d0413d8c46..e0d5e099617 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -12,17 +12,10 @@ jobs: - name: Checkout sources uses: actions/checkout@v3 - - name: Install stable toolchain - uses: actions-rs/toolchain@v1 + - name: Install stable toolchain and restore cache + uses: ./.github/workflows/actions/toolchain-and-cache with: - profile: minimal - toolchain: stable - override: true - - - name: Rust Cache - uses: Swatinem/rust-cache@v2 - with: - key: ${{ runner.os }}-cache-v${{ secrets.CACHE_VERSION }} + cache-version: ${{ secrets.CACHE_VERSION }} - name: Generate cargo doc uses: actions-rs/cargo@v1 diff --git a/.github/workflows/pre-release.yml b/.github/workflows/pre-release.yml index 8e3cbff9d4d..10b647fefd6 100644 --- a/.github/workflows/pre-release.yml +++ b/.github/workflows/pre-release.yml @@ -25,6 +25,15 @@ jobs: workflow: ci.yml workflow_conclusion: success + - name: Download Debian packages (Linux-X64) + uses: dawidd6/action-download-artifact@v2 + with: + name: mithril-deb-packages-Linux-x64 + path: ./package + commit: ${{ github.sha }} + workflow: ci.yml + workflow_conclusion: success + - name: Download built artifacts (macOS-x64) uses: dawidd6/action-download-artifact@v2 with: diff --git a/Cargo.toml b/Cargo.toml index de3e04d86e4..54c8694b9b3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,3 +11,11 @@ members = [ "mithril-signer", "mithril-test-lab/mithril-end-to-end" ] + +[workspace.package] +authors = ["dev@iohk.io"] +documentation = "https://mithril.network/doc" +edition = "2021" +homepage = "https://mithril.network" +license = "Apache-2.0" +repository = "https://github.com/input-output-hk/mithril/" diff --git a/demo/protocol-demo/Cargo.toml b/demo/protocol-demo/Cargo.toml index 6e018c24798..588ee2b9c6c 100644 --- a/demo/protocol-demo/Cargo.toml +++ b/demo/protocol-demo/Cargo.toml @@ -1,8 +1,12 @@ [package] name = "mithrildemo" version = "0.1.0" -edition = "2021" -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html +authors = { workspace = true } +edition = { workspace = true } +documentation = { workspace = true } +homepage = { workspace = true } +license = { workspace = true } +repository = { workspace = true } [dependencies] base64 = "0.13.0" diff --git a/mithril-aggregator/Cargo.toml b/mithril-aggregator/Cargo.toml index 73a81fa4160..66767f8773e 100644 --- a/mithril-aggregator/Cargo.toml +++ b/mithril-aggregator/Cargo.toml @@ -1,9 +1,13 @@ [package] name = "mithril-aggregator" version = "0.1.0" -edition = "2021" description = "A Mithril Aggregator server" -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html +authors = { workspace = true } +edition = { workspace = true } +documentation = { workspace = true } +homepage = { workspace = true } +license = { workspace = true } +repository = { workspace = true } [dependencies] async-trait = "0.1.52" diff --git a/mithril-client/Cargo.toml b/mithril-client/Cargo.toml index 6d9c43477b6..8960cfee1f0 100644 --- a/mithril-client/Cargo.toml +++ b/mithril-client/Cargo.toml @@ -1,9 +1,13 @@ [package] name = "mithril-client" version = "0.1.0" -edition = "2021" description = "A Mithril Client" -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html +authors = { workspace = true } +edition = { workspace = true } +documentation = { workspace = true } +homepage = { workspace = true } +license = { workspace = true } +repository = { workspace = true } [dependencies] async-trait = "0.1.52" diff --git a/mithril-common/Cargo.toml b/mithril-common/Cargo.toml index afc81abeb9a..2b6f322a329 100644 --- a/mithril-common/Cargo.toml +++ b/mithril-common/Cargo.toml @@ -1,8 +1,12 @@ [package] name = "mithril-common" version = "0.1.0" -edition = "2021" -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html +authors = { workspace = true } +edition = { workspace = true } +documentation = { workspace = true } +homepage = { workspace = true } +license = { workspace = true } +repository = { workspace = true } [lib] crate-type = ["lib", "cdylib", "staticlib"] diff --git a/mithril-core/Cargo.toml b/mithril-core/Cargo.toml index a15841d9885..93025af5f54 100644 --- a/mithril-core/Cargo.toml +++ b/mithril-core/Cargo.toml @@ -2,6 +2,11 @@ name = "mithril" version = "0.1.0" edition = "2018" +authors = { workspace = true } +documentation = { workspace = true } +homepage = { workspace = true } +license = { workspace = true } +repository = { workspace = true } [dependencies] blake2 = "0.10.4" diff --git a/mithril-signer/Cargo.toml b/mithril-signer/Cargo.toml index e2eee2493a0..c138ce01e66 100644 --- a/mithril-signer/Cargo.toml +++ b/mithril-signer/Cargo.toml @@ -1,9 +1,13 @@ [package] name = "mithril-signer" version = "0.1.0" -edition = "2021" description = "A Mithril Signer" -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html +authors = { workspace = true } +edition = { workspace = true } +documentation = { workspace = true } +homepage = { workspace = true } +license = { workspace = true } +repository = { workspace = true } [dependencies] async-trait = "0.1.52" diff --git a/mithril-test-lab/mithril-end-to-end/Cargo.toml b/mithril-test-lab/mithril-end-to-end/Cargo.toml index 3bee76e4396..25063abc114 100644 --- a/mithril-test-lab/mithril-end-to-end/Cargo.toml +++ b/mithril-test-lab/mithril-end-to-end/Cargo.toml @@ -1,8 +1,12 @@ [package] name = "mithril-end-to-end" version = "0.1.0" -edition = "2021" -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html +authors = { workspace = true } +edition = { workspace = true } +documentation = { workspace = true } +homepage = { workspace = true } +license = { workspace = true } +repository = { workspace = true } [dependencies] async-trait = "0.1.52"