Skip to content

Commit 9434a38

Browse files
authored
Merge pull request #579 from input-output-hk/djo/543/deb-package
Add Debian packaging to CI
2 parents a388186 + 1afd8d3 commit 9434a38

File tree

13 files changed

+131
-72
lines changed

13 files changed

+131
-72
lines changed

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

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,9 @@ inputs:
55
description: Arguments to pass to 'cargo build'
66
required: false
77
default: ''
8-
cache-version:
9-
description: Version of the current cache
10-
required: false
11-
default: ''
128
runs:
139
using: "composite"
1410
steps:
15-
- name: Install stable toolchain
16-
uses: actions-rs/toolchain@v1
17-
with:
18-
profile: minimal
19-
toolchain: stable
20-
override: true
21-
22-
- name: Rust Cache
23-
uses: Swatinem/rust-cache@v2
24-
with:
25-
key: ${{ runner.os }}-cache-v${{ inputs.cache-version }}
26-
2711
- name: Add commit short sha to Cargo.tomls version
2812
shell: bash
2913
run: |
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: toolchain-and-cache
2+
description: Install the stable cargo toolchain, the given cargo tools, and try to restore cache
3+
inputs:
4+
cache-version:
5+
description: Version of the current cache
6+
required: false
7+
default: ''
8+
cargo-tools:
9+
description: Space seperated list of cargo tools to install
10+
required: false
11+
default: ''
12+
runs:
13+
using: "composite"
14+
steps:
15+
- name: Install stable toolchain
16+
uses: actions-rs/toolchain@v1
17+
with:
18+
profile: minimal
19+
toolchain: stable
20+
override: true
21+
22+
- name: Rust Cache
23+
uses: Swatinem/rust-cache@v2
24+
with:
25+
key: ${{ runner.os }}-cache-v${{ inputs.cache-version }}
26+
27+
- name: Install cargo tools
28+
if: inputs.cargo-tools != ''
29+
shell: bash
30+
run: |
31+
cargo install ${{ inputs.cargo-tools }} 2>/dev/null || true # Suppress the "binary `xyz` already exists in destination" error

.github/workflows/ci.yml

Lines changed: 39 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,28 @@ jobs:
1515
- name: Checkout sources
1616
uses: actions/checkout@v3
1717

18+
- name: Install stable toolchain, tools, and restore cache
19+
uses: ./.github/workflows/actions/toolchain-and-cache
20+
with:
21+
cache-version: ${{ secrets.CACHE_VERSION }}
22+
cargo-tools: cargo-deb
23+
1824
- name: Build Mithril workspace & publish artifacts
1925
uses: ./.github/workflows/actions/build-upload-mithril-artifact
26+
27+
- name: Build Debian packages
28+
shell: bash
29+
run: |
30+
cargo deb -p mithril-aggregator
31+
cargo deb -p mithril-signer
32+
cargo deb -p mithril-client
33+
34+
- name: Publish Debian packages
35+
uses: actions/upload-artifact@v3
2036
with:
21-
cache-version: ${{ secrets.CACHE_VERSION }}
37+
name: mithril-deb-packages-${{ runner.os }}-${{ runner.arch }}
38+
path: target/debian/*.deb
39+
if-no-files-found: error
2240

2341
- name: Publish End-to-end runner (${{ runner.os }}-${{ runner.arch }})
2442
uses: actions/upload-artifact@v3
@@ -27,6 +45,7 @@ jobs:
2745
path: target/release/mithril-end-to-end
2846
if-no-files-found: error
2947

48+
3049
build:
3150
strategy:
3251
fail-fast: false
@@ -44,11 +63,15 @@ jobs:
4463
steps:
4564
- name: Checkout sources
4665
uses: actions/checkout@v3
66+
67+
- name: Install stable toolchain and restore cache
68+
uses: ./.github/workflows/actions/toolchain-and-cache
69+
with:
70+
cache-version: ${{ secrets.CACHE_VERSION }}
4771

4872
- name: Build Mithril workspace & publish artifacts
4973
uses: ./.github/workflows/actions/build-upload-mithril-artifact
5074
with:
51-
cache-version: ${{ secrets.CACHE_VERSION }}
5275
build-args: ${{ matrix.build-args }}
5376

5477
test:
@@ -75,22 +98,11 @@ jobs:
7598
- name: Checkout sources
7699
uses: actions/checkout@v3
77100

78-
- name: Install stable toolchain
79-
uses: actions-rs/toolchain@v1
101+
- name: Install stable toolchain, tools, and restore cache
102+
uses: ./.github/workflows/actions/toolchain-and-cache
80103
with:
81-
profile: minimal
82-
toolchain: stable
83-
override: true
84-
85-
- name: Rust Cache
86-
uses: Swatinem/rust-cache@v2
87-
with:
88-
key: ${{ runner.os }}-cache-v${{ secrets.CACHE_VERSION }}
89-
90-
- name: Install cargo tools
91-
shell: bash
92-
run: |
93-
cargo install cargo2junit 2>/dev/null || true # Suppress the "binary `xyz` already exists in destination" error
104+
cache-version: ${{ secrets.CACHE_VERSION }}
105+
cargo-tools: cargo2junit
94106

95107
- name: Run tests
96108
shell: bash
@@ -114,24 +126,11 @@ jobs:
114126
- name: Checkout sources
115127
uses: actions/checkout@v3
116128

117-
- name: Install stable toolchain
118-
uses: actions-rs/toolchain@v1
119-
with:
120-
profile: minimal
121-
toolchain: stable
122-
components: clippy, rustfmt
123-
override: true
124-
125-
- name: Rust Cache
126-
uses: Swatinem/rust-cache@v2
129+
- name: Install stable toolchain, tools, and restore cache
130+
uses: ./.github/workflows/actions/toolchain-and-cache
127131
with:
128-
key: ${{ runner.os }}-cache-v${{ secrets.CACHE_VERSION }}
129-
130-
- name: Install cargo tools
131-
if: steps.cargo-cache.outputs.cache-hit == false
132-
shell: bash
133-
run: |
134-
cargo install cargo-sort 2>/dev/null || true # Suppress the "binary `xyz` already exists in destination" error
132+
cache-version: ${{ secrets.CACHE_VERSION }}
133+
cargo-tools: cargo-sort
135134

136135
- name: Cargo check
137136
uses: actions-rs/cargo@v1
@@ -312,6 +311,12 @@ jobs:
312311
name: mithril-distribution-Linux-X64
313312
path: ./package-Linux-X64
314313

314+
- name: Download Debian packages (Linux-X64)
315+
uses: actions/download-artifact@v3
316+
with:
317+
name: mithril-deb-packages-Linux-x64
318+
path: ./package
319+
315320
- name: Download built artifacts (macOS-X64)
316321
uses: actions/download-artifact@v3
317322
with:

.github/workflows/docs.yml

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,10 @@ jobs:
1212
- name: Checkout sources
1313
uses: actions/checkout@v3
1414

15-
- name: Install stable toolchain
16-
uses: actions-rs/toolchain@v1
15+
- name: Install stable toolchain and restore cache
16+
uses: ./.github/workflows/actions/toolchain-and-cache
1717
with:
18-
profile: minimal
19-
toolchain: stable
20-
override: true
21-
22-
- name: Rust Cache
23-
uses: Swatinem/rust-cache@v2
24-
with:
25-
key: ${{ runner.os }}-cache-v${{ secrets.CACHE_VERSION }}
18+
cache-version: ${{ secrets.CACHE_VERSION }}
2619

2720
- name: Generate cargo doc
2821
uses: actions-rs/cargo@v1

.github/workflows/pre-release.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,15 @@ jobs:
2525
workflow: ci.yml
2626
workflow_conclusion: success
2727

28+
- name: Download Debian packages (Linux-X64)
29+
uses: dawidd6/action-download-artifact@v2
30+
with:
31+
name: mithril-deb-packages-Linux-x64
32+
path: ./package
33+
commit: ${{ github.sha }}
34+
workflow: ci.yml
35+
workflow_conclusion: success
36+
2837
- name: Download built artifacts (macOS-x64)
2938
uses: dawidd6/action-download-artifact@v2
3039
with:

Cargo.toml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,11 @@ members = [
1111
"mithril-signer",
1212
"mithril-test-lab/mithril-end-to-end"
1313
]
14+
15+
[workspace.package]
16+
authors = ["[email protected]"]
17+
documentation = "https://mithril.network/doc"
18+
edition = "2021"
19+
homepage = "https://mithril.network"
20+
license = "Apache-2.0"
21+
repository = "https://github.com/input-output-hk/mithril/"

demo/protocol-demo/Cargo.toml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
[package]
22
name = "mithrildemo"
33
version = "0.1.0"
4-
edition = "2021"
5-
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
4+
authors = { workspace = true }
5+
edition = { workspace = true }
6+
documentation = { workspace = true }
7+
homepage = { workspace = true }
8+
license = { workspace = true }
9+
repository = { workspace = true }
610

711
[dependencies]
812
base64 = "0.13.0"

mithril-aggregator/Cargo.toml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
[package]
22
name = "mithril-aggregator"
33
version = "0.1.0"
4-
edition = "2021"
54
description = "A Mithril Aggregator server"
6-
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
5+
authors = { workspace = true }
6+
edition = { workspace = true }
7+
documentation = { workspace = true }
8+
homepage = { workspace = true }
9+
license = { workspace = true }
10+
repository = { workspace = true }
711

812
[dependencies]
913
async-trait = "0.1.52"

mithril-client/Cargo.toml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
[package]
22
name = "mithril-client"
33
version = "0.1.0"
4-
edition = "2021"
54
description = "A Mithril Client"
6-
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
5+
authors = { workspace = true }
6+
edition = { workspace = true }
7+
documentation = { workspace = true }
8+
homepage = { workspace = true }
9+
license = { workspace = true }
10+
repository = { workspace = true }
711

812
[dependencies]
913
async-trait = "0.1.52"

mithril-common/Cargo.toml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
[package]
22
name = "mithril-common"
33
version = "0.1.0"
4-
edition = "2021"
5-
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
4+
authors = { workspace = true }
5+
edition = { workspace = true }
6+
documentation = { workspace = true }
7+
homepage = { workspace = true }
8+
license = { workspace = true }
9+
repository = { workspace = true }
610

711
[lib]
812
crate-type = ["lib", "cdylib", "staticlib"]

0 commit comments

Comments
 (0)