Skip to content

Commit

Permalink
Add support for armv7l.
Browse files Browse the repository at this point in the history
  • Loading branch information
jsirois committed Dec 11, 2024
1 parent 85e3e50 commit ccacb62
Show file tree
Hide file tree
Showing 10 changed files with 119 additions and 48 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/audit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
jobs:
audit:
if: github.repository_owner == 'a-scie'
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
steps:
- name: Check out code
uses: actions/checkout@v4
Expand Down
55 changes: 39 additions & 16 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,42 +15,65 @@ jobs:
org-check:
name: Check GitHub Organization
if: github.repository_owner == 'a-scie'
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
steps:
- name: Noop
run: "true"
ci:
name: (${{ matrix.os }}) CI
name: ${{ matrix.name }} CI
needs: org-check
runs-on: ${{ matrix.os }}
strategy:
matrix:
# N.B.: macos-13 is the oldest non-deprecated Intel Mac runner and macos-14 is the oldest
# non-deprecated ARM Mac runner.
os: [ ubuntu-22.04, linux-arm64, macos-13, macos-14, windows-2022, windows-arm64 ]
include:
- os: ubuntu-24.04
name: Linux x86-64
- os: ubuntu-24.04
name: Linux x86-64 (musl)
cross-target: x86_64-unknown-linux-musl
- os: ubuntu-24.04
name: Linux aarch64
cross-target: aarch64-unknown-linux-musl
- os: ubuntu-24.04
name: Linux armv7l
cross-target: armv7-unknown-linux-musleabihf
- os: macos-13
name: macOS x86-64
- os: macos-14
name: macOS aarch64
- os: windows-2022
name: Windows x86-64
- os: windows-arm64
name: Windows aarch64
steps:
- uses: actions/checkout@v4
- name: Check Formatting
if: matrix.cross-target == ''
run: |
rustup toolchain add nightly -c rustfmt
cargo +nightly fmt --check --all
- name: Install Cross
if: matrix.cross-target != ''
run: |
cargo install cross --locked
docker run --privileged --rm tonistiigi/binfmt --install all
- name: Lint
if: matrix.cross-target == ''
run: cargo clippy --locked --all
- name: Lint
if: matrix.cross-target != ''
run: cross clippy --locked --all --target ${{ matrix.cross-target }}
- name: Unit Tests
if: matrix.cross-target == ''
run: cargo test --all
- name: Unit Tests
if: matrix.cross-target != ''
run: cross test --all --target ${{ matrix.cross-target }}
- name: Build & Package
if: ${{ matrix.os != 'ubuntu-22.04' && matrix.os != 'linux-arm64' }}
if: matrix.cross-target == ''
run: cargo run -p package
- name: Build & Package
if: ${{ matrix.os == 'ubuntu-22.04' || matrix.os == 'linux-arm64' }}
run: |
docker run --rm \
-v $PWD:/code \
-w /code \
rust:1.83.0-alpine3.20 \
sh -c "
apk add cmake make musl-dev perl &&
addgroup -g $(id -g) build &&
adduser -u $(id -u) -G build -D -H build &&
su build -c 'cargo run -p package -- dist'
"
if: matrix.cross-target != ''
run: cross run -p package --target ${{ matrix.cross-target }}
41 changes: 25 additions & 16 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ jobs:
org-check:
name: Check GitHub Organization
if: ${{ github.repository_owner == 'a-scie' }}
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
steps:
- name: Noop
run: "true"
determine-tag:
name: Determine the release tag to operate against.
needs: org-check
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
outputs:
release-tag: ${{ steps.determine-tag.outputs.release-tag }}
release-version: ${{ steps.determine-tag.outputs.release-version }}
Expand All @@ -40,14 +40,31 @@ jobs:
exit 1
fi
github-release:
name: (${{ matrix.os }}) Create Github Release
name: (${{ matrix.name }}) Create Github Release
needs: determine-tag
runs-on: ${{ matrix.os }}
strategy:
matrix:
# N.B.: macos-13 is the oldest non-deprecated Intel Mac runner and macos-14 is the oldest
# non-deprecated ARM Mac runner.
os: [ ubuntu-22.04, linux-arm64, macos-13, macos-14, windows-2022, windows-arm64 ]
include:
- os: ubuntu-24.04
name: Linux x86-64
cross-target: x86_64-unknown-linux-musl
- os: ubuntu-24.04
name: Linux aarch64
cross-target: aarch64-unknown-linux-musl
- os: ubuntu-24.04
name: Linux armv7l
cross-target: armv7-unknown-linux-musleabihf
- os: macos-13
name: macOS x86-64
- os: macos-14
name: macOS aarch64
- os: windows-2022
name: Windows x86-64
- os: windows-arm64
name: Windows aarch64
environment: Release
permissions:
id-token: write
Expand All @@ -60,21 +77,13 @@ jobs:
with:
ref: ${{ needs.determine-tag.outputs.release-tag }}
- name: Package ptex ${{ needs.determine-tag.outputs.release-tag }} binary
if: ${{ matrix.os != 'ubuntu-22.04' && matrix.os != 'linux-arm64' }}
if: matrix.cross-target == ''
run: cargo run -p package
- name: Package ptex ${{ needs.determine-tag.outputs.release-tag }} binary
if: ${{ matrix.os == 'ubuntu-22.04' || matrix.os == 'linux-arm64' }}
if: matrix.cross-target != ''
run: |
docker run --rm \
-v $PWD:/code \
-w /code \
rust:1.83.0-alpine3.20 \
sh -c "
apk add cmake make musl-dev perl &&
addgroup -g $(id -g) build &&
adduser -u $(id -u) -G build -D -H build &&
su build -c 'cargo run -p package -- dist'
"
cargo install cross --locked
cross run -p package --target ${{ matrix.cross-target }}
- name: Generate ptex ${{ needs.determine-tag.outputs.release-tag }} artifact attestations
uses: actions/attest-build-provenance@v1
with:
Expand Down
4 changes: 4 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Release Notes

## 1.3.0

This release adds support for Linux ARM (armv7 and armv8 32 bit mode).

## 1.2.0

This release adds support for Windows ARM64.
Expand Down
38 changes: 36 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ members = [

[package]
name = "ptex"
version = "1.2.0"
version = "1.3.0"
edition = "2021"
authors = [
"John Sirois <[email protected]>",
Expand Down
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,10 @@ distribution is ~28M:

## Building `ptex`

The `ptex` binary is [released](https://github.com/a-scie/ptex/releases) for Linux (x86_64 &
aarch64), macOS (x86_64 & aarch64) and Windows (x86_64). If you'd like to build your own copy,
you'll need [Rust installed](https://rustup.rs/) at which point you can run `cargo run -p package`
and a binary for your current machine will be built in `dist/` along with a sha256 checksum file.
For more build options, you can run `cargo run -p package -- --help`. On some systems, builds will
require `cmake`, `make` and `perl` in order to build various `*-sys` crates. If you're missing
these, the build failures will point you in the right direction with some reading.
The `ptex` binary is [released](https://github.com/a-scie/ptex/releases) for Linux (x86_64,
aarch64 & armv7), macOS (x86_64 & aarch64) and Windows (x86_64 & aarch64). If you'd like to build
your own copy, you'll need [Rust installed](https://rustup.rs/) at which point you can run
`cargo run -p package` and a binary for your current machine will be built in `dist/` along with a
sha256 checksum file. For more build options, you can run `cargo run -p package -- --help`. On some
systems, builds will require `cmake`, `make` and `perl` in order to build various `*-sys` crates.
If you're missing these, the build failures will point you in the right direction with some reading.
3 changes: 2 additions & 1 deletion package/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "package"
version = "0.2.0"
version = "0.3.0"
description = "Packages the ptex binary."
authors = [
"John Sirois <[email protected]>",
Expand All @@ -12,3 +12,4 @@ publish = false
clap = { version = "4.5", features = ["derive"] }
proc-exit = "2.0"
sha2 = "0.10"
which = "7.0"
5 changes: 4 additions & 1 deletion package/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,11 @@ fn main() -> ExitResult {
// script forwards them.
let out_dir = env!("OUT_DIR");
let target = args.target.unwrap_or_else(|| env!("TARGET").to_string());

// Just in case this target is not already installed.
execute(Command::new("rustup").args(["target", "add", &target]))?;
if let Ok(rustup) = which::which("rustup") {
execute(Command::new(rustup).args(["target", "add", &target]))?;
}

let workspace_root = PathBuf::from(cargo_manifest_dir).join("..");
let output_root = PathBuf::from(out_dir).join("dist");
Expand Down
3 changes: 0 additions & 3 deletions rust-toolchain
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
[toolchain]
# N.B.: Update .github and .circleci yaml to use a matching image, if available.
# Although a version match is not required (cargo downloads and installs the
# toolchain described here if not present), it does speed up CI builds.
channel = "1.83.0"
components = [
"cargo",
Expand Down

0 comments on commit ccacb62

Please sign in to comment.