Skip to content

Commit

Permalink
Cross-compile to various targets in CI
Browse files Browse the repository at this point in the history
It probably makes sense for us to explicitly cross-compile to a few more
targets to weed out type casting bugs or similar early on. Do just that.

Signed-off-by: Daniel Müller <[email protected]>
  • Loading branch information
d-e-s-o authored and danielocfb committed Nov 21, 2023
1 parent f5d926f commit d8d963a
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 4 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,25 @@ jobs:
- name: Build ${{ matrix.profile }}
run: |
cargo build --profile=${{ matrix.profile }} ${{ matrix.args }} --lib
build-cross:
name: Cross-compile [${{ matrix.target }}]
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
target: [
aarch64-linux-android,
arm-linux-androideabi,
armv7-linux-androideabi,
x86_64-unknown-linux-musl,
]
steps:
- uses: actions/checkout@v4
- uses: taiki-e/setup-cross-toolchain-action@v1
with:
target: ${{ matrix.target }}
- run: |
cargo build --lib
nop-rebuilds:
name: No-op rebuilds
runs-on: ubuntu-22.04
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Unreleased
- Adjusted various symbolization code paths to stop heap-allocating
- Handled potential numeric overflow in Gsym inlined function parser more
gracefully
- Fixed build for some Android flavors


0.2.0-alpha.8
Expand Down
13 changes: 9 additions & 4 deletions src/file_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ use crate::Result;


#[derive(Debug, Eq, Hash, PartialEq)]
// `libc` has deprecated `time_t` usage on `musl`. See
// https://github.com/rust-lang/libc/issues/1848
#[cfg_attr(target_env = "musl", allow(deprecated))]
struct EntryMeta {
path: PathBuf,
dev: libc::dev_t,
Expand All @@ -22,13 +25,15 @@ struct EntryMeta {

impl EntryMeta {
fn new(path: PathBuf, stat: &libc::stat) -> Self {
// Casts are necessary because on Android some libc types do not
// use proper typedefs. https://github.com/rust-lang/libc/issues/3285
Self {
path,
dev: stat.st_dev,
inode: stat.st_ino,
size: stat.st_size,
dev: stat.st_dev as _,
inode: stat.st_ino as _,
size: stat.st_size as _,
mtime_sec: stat.st_mtime,
mtime_nsec: stat.st_mtime_nsec,
mtime_nsec: stat.st_mtime_nsec as _,
}
}
}
Expand Down

0 comments on commit d8d963a

Please sign in to comment.