diff --git a/.github/workflows/audit.yml b/.github/workflows/audit.yml index 328d357..946a99e 100644 --- a/.github/workflows/audit.yml +++ b/.github/workflows/audit.yml @@ -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 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index eeb3028..4156a93 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 21281f8..479c720 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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 }} @@ -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 @@ -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: diff --git a/CHANGES.md b/CHANGES.md index 0173f8d..a44d378 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -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. diff --git a/Cargo.lock b/Cargo.lock index 0b9fd8d..e5be04f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -229,6 +229,12 @@ dependencies = [ "syn", ] +[[package]] +name = "either" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" + [[package]] name = "encode_unicode" version = "0.3.6" @@ -276,6 +282,15 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" +[[package]] +name = "home" +version = "0.5.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3d1354bf6b7235cb4a0576c2619fd4ed18183f689b12b006a0ee7329eeff9a5" +dependencies = [ + "windows-sys 0.52.0", +] + [[package]] name = "icu_collections" version = "1.5.0" @@ -550,11 +565,12 @@ dependencies = [ [[package]] name = "package" -version = "0.2.0" +version = "0.3.0" dependencies = [ "clap", "proc-exit", "sha2", + "which", ] [[package]] @@ -592,7 +608,7 @@ dependencies = [ [[package]] name = "ptex" -version = "1.2.0" +version = "1.3.0" dependencies = [ "anyhow", "curl", @@ -887,6 +903,18 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "which" +version = "7.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9cad3279ade7346b96e38731a641d7343dd6a53d55083dd54eadfa5a1b38c6b" +dependencies = [ + "either", + "home", + "rustix", + "winsafe", +] + [[package]] name = "windows-sys" version = "0.42.0" @@ -1092,6 +1120,12 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" +[[package]] +name = "winsafe" +version = "0.0.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d135d17ab770252ad95e9a872d365cf3090e3be864a34ab46f48555993efc904" + [[package]] name = "write16" version = "1.0.0" diff --git a/Cargo.toml b/Cargo.toml index cf05ea0..c78556b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,7 +5,7 @@ members = [ [package] name = "ptex" -version = "1.2.0" +version = "1.3.0" edition = "2021" authors = [ "John Sirois ", diff --git a/README.md b/README.md index 2a92369..29df561 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/package/Cargo.toml b/package/Cargo.toml index 8f83624..1633afa 100644 --- a/package/Cargo.toml +++ b/package/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "package" -version = "0.2.0" +version = "0.3.0" description = "Packages the ptex binary." authors = [ "John Sirois ", @@ -12,3 +12,4 @@ publish = false clap = { version = "4.5", features = ["derive"] } proc-exit = "2.0" sha2 = "0.10" +which = "7.0" diff --git a/package/src/main.rs b/package/src/main.rs index 6db7613..5df1f76 100644 --- a/package/src/main.rs +++ b/package/src/main.rs @@ -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"); diff --git a/rust-toolchain b/rust-toolchain index 07ffd99..a0b8a72 100644 --- a/rust-toolchain +++ b/rust-toolchain @@ -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",