Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Debian packaging to CI #579

Merged
merged 3 commits into from
Nov 3, 2022
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
16 changes: 0 additions & 16 deletions .github/workflows/actions/build-upload-mithril-artifact/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
31 changes: 31 additions & 0 deletions .github/workflows/actions/toolchain-and-cache/action.yml
Original file line number Diff line number Diff line change
@@ -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
73 changes: 39 additions & 34 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -27,6 +45,7 @@ jobs:
path: target/release/mithril-end-to-end
if-no-files-found: error


build:
strategy:
fail-fast: false
Expand All @@ -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:
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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:
Expand Down
13 changes: 3 additions & 10 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 9 additions & 0 deletions .github/workflows/pre-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
8 changes: 8 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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/"
8 changes: 6 additions & 2 deletions demo/protocol-demo/Cargo.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
8 changes: 6 additions & 2 deletions mithril-aggregator/Cargo.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
8 changes: 6 additions & 2 deletions mithril-client/Cargo.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
8 changes: 6 additions & 2 deletions mithril-common/Cargo.toml
Original file line number Diff line number Diff line change
@@ -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"]
Expand Down
5 changes: 5 additions & 0 deletions mithril-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
8 changes: 6 additions & 2 deletions mithril-signer/Cargo.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
8 changes: 6 additions & 2 deletions mithril-test-lab/mithril-end-to-end/Cargo.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down