Skip to content

Commit 9203378

Browse files
committed
Merge branch 'main' into 2592-mapper-bridge
2 parents dcd4329 + dc8fcb5 commit 9203378

File tree

9 files changed

+729
-36
lines changed

9 files changed

+729
-36
lines changed

.github/workflows/build-workflow.yml

Lines changed: 92 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,6 @@ on:
88
merge_group:
99
workflow_dispatch:
1010
inputs:
11-
disable_cache:
12-
description: Disable rust caching
13-
type: boolean
14-
required: false
15-
default: false
1611
include:
1712
description: Only run tests matching tests with the given tags
1813
type: string
@@ -23,6 +18,12 @@ on:
2318
type: string
2419
required: false
2520
default: "10"
21+
run_rust_tests:
22+
description: Run Rust tests (generally this is not required as the PR check will run full Rust tests)
23+
type: boolean
24+
required: false
25+
default: false
26+
2627
# Use a manual approval process before PR's are given access to
2728
# the secrets which are required to run the integration tests.
2829
# The PR code should be manually approved to see if it can be trusted.
@@ -33,45 +34,95 @@ on:
3334

3435
env:
3536
CARGO_TERM_COLOR: always
36-
RUSTFLAGS: -D warnings
3737

3838
jobs:
3939
build:
40-
name: Build ${{ matrix.job.target }}
41-
runs-on: ubuntu-20.04
40+
name: Build ${{ matrix.target }}
41+
runs-on: ${{ matrix.host_os }}
4242
strategy:
4343
fail-fast: false
4444
matrix:
45-
job:
46-
- { target: x86_64-unknown-linux-musl, cache: true }
47-
- { target: aarch64-unknown-linux-musl, cache: true }
48-
- { target: arm-unknown-linux-musleabihf, cache: true }
49-
- { target: armv7-unknown-linux-musleabihf, cache: true }
45+
# Note: Targets which requires a non-default rust_channel
46+
# then they should not be included in the .target list, but
47+
# rather in the include section.
48+
# This is just how Github processes matrix jobs
49+
target:
50+
- aarch64-unknown-linux-musl
51+
- armv7-unknown-linux-musleabihf
52+
- arm-unknown-linux-musleabihf
53+
- arm-unknown-linux-musleabi
54+
- armv5te-unknown-linux-musleabi
55+
- x86_64-unknown-linux-musl
56+
- i686-unknown-linux-musl
57+
- riscv64gc-unknown-linux-gnu
58+
- x86_64-apple-darwin
59+
mode:
60+
- --release
61+
62+
rust_channel:
63+
- "1.70"
64+
65+
include:
66+
- target: aarch64-unknown-linux-musl
67+
host_os: ubuntu-22.04
68+
cargo_options: --no-run
69+
70+
- target: armv7-unknown-linux-musleabihf
71+
host_os: ubuntu-22.04
72+
cargo_options: --no-run
73+
74+
- target: arm-unknown-linux-musleabihf
75+
host_os: ubuntu-22.04
76+
cargo_options: --no-run
77+
78+
- target: arm-unknown-linux-musleabi
79+
host_os: ubuntu-22.04
80+
cargo_options: --no-run
81+
82+
- target: armv5te-unknown-linux-musleabi
83+
host_os: ubuntu-22.04
84+
cargo_options: --no-run
85+
86+
- target: x86_64-unknown-linux-musl
87+
host_os: ubuntu-22.04
88+
89+
- target: i686-unknown-linux-musl
90+
host_os: ubuntu-22.04
91+
cargo_options: --no-run
92+
93+
- target: riscv64gc-unknown-linux-gnu
94+
host_os: ubuntu-22.04
95+
cargo_options: --no-run
96+
97+
- target: aarch64-apple-darwin
98+
mode: --release
99+
rust_channel: "1.72" # ahash uses "stdsimd" feature which was stabilized in 1.72, https://github.com/tkaitchuck/aHash/issues/195
100+
host_os: macos-14
101+
cargo_options: --no-run
102+
103+
- target: x86_64-apple-darwin
104+
host_os: macos-14
50105

51106
steps:
107+
- if: ${{ contains(matrix.host_os, 'ubuntu') }}
108+
run: sudo apt-get update -y
52109
- name: Checkout
53110
uses: actions/checkout@v4
54111
with:
55112
ref: ${{ github.event_name == 'pull_request_target' && github.event.pull_request.head.sha || '' }}
56113
fetch-depth: 0
57114

58-
- name: Retrieve MSRV from workspace Cargo.toml
59-
id: rust_version
60-
uses: SebRollen/toml-action@v1.2.0
61-
with:
62-
file: Cargo.toml
63-
field: "workspace.package.rust-version"
64-
65-
- name: Enable toolchain via github action
66-
uses: dtolnay/rust-toolchain@master
67-
with:
68-
toolchain: ${{ steps.rust_version.outputs.value }}
69-
targets: ${{ matrix.job.target }}
115+
- run: mk/install-build-tools.sh +${{ matrix.rust_channel }} --target=${{ matrix.target }}
116+
shell: sh
117+
- name: Build
118+
run: |
119+
. ./ci/build_scripts/version.sh
120+
mk/cargo.sh +${{ matrix.rust_channel }} build --target=${{ matrix.target }} ${{ matrix.mode }}
70121
71-
- name: Enable cache
72-
if: ${{ matrix.job.cache && !inputs.disable_cache }}
73-
# https://github.com/marketplace/actions/rust-cache
74-
uses: Swatinem/rust-cache@v2
122+
- if: ${{ inputs.run_rust_tests && !contains(matrix.host_os, 'windows') }}
123+
name: Test
124+
run: |
125+
mk/cargo.sh +${{ matrix.rust_channel }} test -vv --target=${{ matrix.target }} ${{ matrix.cargo_options }} ${{ matrix.mode }} --no-fail-fast --locked --all-features --all-targets
75126
76127
# Install nfpm used to for linux packaging
77128
- uses: actions/setup-go@v5
@@ -80,16 +131,16 @@ jobs:
80131
cache: false
81132
- run: go install github.com/goreleaser/nfpm/v2/cmd/nfpm@latest
82133

83-
- uses: taiki-e/install-action@just
84-
- name: Build for ${{ matrix.job.target }}
85-
run: just release ${{ matrix.job.target }}
134+
- name: Package
135+
run: |
136+
./ci/build_scripts/build.sh ${{ matrix.target }} --skip-build --skip-deprecated-packages
86137
87138
- name: Upload packages as zip
88139
# https://github.com/marketplace/actions/upload-a-build-artifact
89140
uses: actions/upload-artifact@v4
90141
with:
91-
name: packages-${{ matrix.job.target }}
92-
path: target/${{ matrix.job.target }}/packages/*.*
142+
name: packages-${{ matrix.target }}
143+
path: target/${{ matrix.target }}/packages/*.*
93144

94145
approve:
95146
# Note: Use approval as a job so that the downstream jobs are only prompted once (if more than 1 matrix job is defined)
@@ -200,6 +251,13 @@ jobs:
200251
# Keep arm-unknown-linux-musleabihf in separate repo due to armhf conflict between raspbian and debian
201252
- { target: arm-unknown-linux-musleabihf, repo: tedge-main-armv6, component: main }
202253
- { target: armv7-unknown-linux-musleabihf, repo: tedge-main, component: main }
254+
- { target: arm-unknown-linux-musleabi, repo: tedge-main, component: main }
255+
- { target: i686-unknown-linux-musl, repo: tedge-main, component: main }
256+
# Debian also calls this "armel" (conflict with arm-unknown-linux-musleabi)
257+
# - { target: armv5te-unknown-linux-musleabi, repo: tedge-main, component: main }
258+
- { target: riscv64gc-unknown-linux-gnu, repo: tedge-main, component: main }
259+
- { target: aarch64-apple-darwin, repo: tedge-main, component: main }
260+
- { target: x86_64-apple-darwin, repo: tedge-main, component: main }
203261

204262
steps:
205263
- name: Checkout

ci/build_scripts/publish_packages.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,12 +183,28 @@ get_user_friendly_arch() {
183183
*arm-unknown-linux-musleabihf*)
184184
easy_arch=armv6
185185
;;
186+
*arm-unknown-linux-musleabi*)
187+
easy_arch=armv5
188+
;;
189+
*armv5te-unknown-linux-*)
190+
easy_arch=armv5
191+
;;
192+
*i686-unknown-linux-musl*)
193+
easy_arch=i386
194+
;;
195+
*riscv64gc-unknown-linux-*)
196+
easy_arch=riscv64
197+
;;
186198
*aarch64-apple-darwin*)
187199
easy_arch=macos-arm64
188200
;;
189201
*x86_64-apple-darwin*)
190202
easy_arch=macos-amd64
191203
;;
204+
*)
205+
echo "Unknown architecture. $1" >&2
206+
exit 1
207+
;;
192208
esac
193209
echo "$easy_arch"
194210
}

crates/common/download/src/download.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -559,7 +559,7 @@ mod tests {
559559
async fn downloader_download_with_content_length_larger_than_usable_disk_space() {
560560
use nix::sys::statvfs;
561561
let tmpstats = statvfs::statvfs("/tmp").unwrap();
562-
let usable_disk_space = tmpstats.blocks_free() * tmpstats.block_size();
562+
let usable_disk_space = (tmpstats.blocks_free() as u64) * (tmpstats.block_size() as u64);
563563

564564
let mut server = mockito::Server::new();
565565
let _mock1 = server

crates/core/c8y_api/src/json_c8y.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -605,7 +605,7 @@ mod tests {
605605

606606
assert_eq!(actual_c8y_event.event_type, "empty_event".to_string());
607607
assert_eq!(actual_c8y_event.text, "empty_event".to_string());
608-
assert!(actual_c8y_event.time < OffsetDateTime::now_utc());
608+
assert!(actual_c8y_event.time <= OffsetDateTime::now_utc());
609609
assert_matches!(actual_c8y_event.source, None);
610610
assert!(actual_c8y_event.extras.is_empty());
611611

mk/README.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Notes
2+
3+
The scripts in this folder are taken from the [briansmith/ring](https://github.com/briansmith/ring) repository under the folder. This is done as the build targets of thin-edge.io are coupled with the build targets supported by ring (as it is the crypto library used in the thin-edge.io usage of rustls and some other libraries).
4+
5+
6+
## How to update the mk files from ring
7+
8+
1. Navigate to the [mk folder in the briansmith/ring](https://github.com/briansmith/ring/tree/main/mk) repository
9+
10+
2. Copy the following files into the `mk` folder of thin-edge.io
11+
12+
**Files that don't require patching**
13+
14+
* mk/llvm-snapshot.gpg.key
15+
16+
**Files that require minimal patching**
17+
18+
THe following files require minor patching to add some additional thin-edge.io specific changes, however adjusting should be fairly easy to manage using the git diff:
19+
20+
* mk/cargo.sh
21+
* mk/install-build-tools.sh
22+
23+
Some of the changes are due to shell check warnings, and there is already an [upstream PR](https://github.com/briansmith/ring/pull/1993) exists to resolved this warnings) so that this step can be skipped once the PR is merged. Alternatively you can take the files from the aforementioned PR instead of the PR itself if you are unsure how to merge the shell check changes.
24+
25+
**Notes**
26+
* The copyright notice at the top of each files originating from **briansmith/ring** *MUST* be preserved
27+
28+
3. Review the changes and resolve any differences
29+
30+
4. Create a PR with the updated changes

0 commit comments

Comments
 (0)