Compare commits
28 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d5793ed107 | ||
|
|
6ad5303397 | ||
|
|
9a1618ffb7 | ||
|
|
1db091d29d | ||
|
|
a448c4b137 | ||
|
|
f7da401093 | ||
|
|
ea9defd544 | ||
|
|
7cb7930e5c | ||
|
|
f6a193191b | ||
|
|
91c5b34b70 | ||
|
|
ddb18cfff9 | ||
|
|
329eb5fa43 | ||
|
|
56f0ba980e | ||
|
|
e2ab1c3836 | ||
|
|
d2db46a173 | ||
|
|
83dc934d7f | ||
|
|
601d02e82d | ||
|
|
2c7c51e283 | ||
|
|
9a022034a6 | ||
|
|
dc1022bc69 | ||
|
|
b4ab796093 | ||
|
|
b094471e7c | ||
|
|
885ad4bc41 | ||
|
|
c40b27b8f9 | ||
|
|
7619b10b9f | ||
|
|
a72a5f146c | ||
|
|
f0ceffbf58 | ||
|
|
c04b5a0b3e |
1
.github/FUNDING.yml
vendored
Normal file
1
.github/FUNDING.yml
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
github: autarch
|
||||||
2
.github/workflows/lint.yml
vendored
2
.github/workflows/lint.yml
vendored
@@ -8,7 +8,7 @@ env:
|
|||||||
jobs:
|
jobs:
|
||||||
lint:
|
lint:
|
||||||
name: Check that code is lint clean using precious
|
name: Check that code is lint clean using precious
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-24.04
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: Install mise
|
- name: Install mise
|
||||||
|
|||||||
232
.github/workflows/test.yml
vendored
232
.github/workflows/test.yml
vendored
@@ -11,8 +11,8 @@ jobs:
|
|||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
platform:
|
platform:
|
||||||
- platform_name: FreeBSD-x86_64
|
- name: FreeBSD-x86_64
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-24.04
|
||||||
target: x86_64-unknown-freebsd
|
target: x86_64-unknown-freebsd
|
||||||
cache-cross-binary: true
|
cache-cross-binary: true
|
||||||
expect-file-re: "x86-64.+FreeBSD"
|
expect-file-re: "x86-64.+FreeBSD"
|
||||||
@@ -20,8 +20,10 @@ jobs:
|
|||||||
expect-stripped: ""
|
expect-stripped: ""
|
||||||
can-execute: false
|
can-execute: false
|
||||||
|
|
||||||
- platform_name: Linux-x86_64
|
- name: Linux-x86_64
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-24.04
|
||||||
|
# It's important to use a musl target here to make sure that the step to install
|
||||||
|
# musl-tools works.
|
||||||
target: x86_64-unknown-linux-musl
|
target: x86_64-unknown-linux-musl
|
||||||
cache-cross-binary: true
|
cache-cross-binary: true
|
||||||
expect-file-re: "ELF.+x86-64"
|
expect-file-re: "ELF.+x86-64"
|
||||||
@@ -29,8 +31,48 @@ jobs:
|
|||||||
expect-stripped: "--expect-stripped"
|
expect-stripped: "--expect-stripped"
|
||||||
can-execute: true
|
can-execute: true
|
||||||
|
|
||||||
- platform_name: Linux-aarch64
|
- name: Linux-x86_64 (beta)
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-24.04
|
||||||
|
target: x86_64-unknown-linux-musl
|
||||||
|
toolchain: beta
|
||||||
|
cache-cross-binary: true
|
||||||
|
expect-file-re: "ELF.+x86-64"
|
||||||
|
expect-cross: ""
|
||||||
|
expect-stripped: "--expect-stripped"
|
||||||
|
can-execute: true
|
||||||
|
|
||||||
|
- name: Linux-x86_64 (nightly)
|
||||||
|
runs-on: ubuntu-24.04
|
||||||
|
target: x86_64-unknown-linux-musl
|
||||||
|
toolchain: nightly
|
||||||
|
cache-cross-binary: true
|
||||||
|
expect-file-re: "ELF.+x86-64"
|
||||||
|
expect-cross: ""
|
||||||
|
expect-stripped: "--expect-stripped"
|
||||||
|
can-execute: true
|
||||||
|
|
||||||
|
- name: Linux-x86_64 (force cross)
|
||||||
|
runs-on: ubuntu-24.04
|
||||||
|
target: x86_64-unknown-linux-gnu
|
||||||
|
force-use-cross: true
|
||||||
|
cache-cross-binary: true
|
||||||
|
expect-file-re: "ELF.+x86-64"
|
||||||
|
expect-cross: "--expect-cross"
|
||||||
|
expect-stripped: ""
|
||||||
|
can-execute: true
|
||||||
|
|
||||||
|
- name: Linux-x86_64 (stable 8 months ago)
|
||||||
|
runs-on: ubuntu-24.04
|
||||||
|
target: x86_64-unknown-linux-gnu
|
||||||
|
toolchain: "stable 8 months ago"
|
||||||
|
cache-cross-binary: true
|
||||||
|
expect-file-re: "ELF.+x86-64"
|
||||||
|
expect-cross: ""
|
||||||
|
expect-stripped: "--expect-stripped"
|
||||||
|
can-execute: true
|
||||||
|
|
||||||
|
- name: Linux-aarch64
|
||||||
|
runs-on: ubuntu-24.04
|
||||||
target: aarch64-unknown-linux-musl
|
target: aarch64-unknown-linux-musl
|
||||||
cache-cross-binary: true
|
cache-cross-binary: true
|
||||||
expect-file-re: "aarch64"
|
expect-file-re: "aarch64"
|
||||||
@@ -38,18 +80,18 @@ jobs:
|
|||||||
expect-stripped: ""
|
expect-stripped: ""
|
||||||
can-execute: true
|
can-execute: true
|
||||||
|
|
||||||
- platform_name: Linux-aarch64 (no cache)
|
- name: Linux-aarch64 (no cache)
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-24.04
|
||||||
target: aarch64-unknown-linux-musl
|
target: aarch64-unknown-linux-gnu
|
||||||
cache-cross-binary: false
|
cache-cross-binary: false
|
||||||
expect-file-re: "aarch64"
|
expect-file-re: "aarch64"
|
||||||
expect-cross: "--expect-cross"
|
expect-cross: "--expect-cross"
|
||||||
expect-stripped: ""
|
expect-stripped: ""
|
||||||
can-execute: true
|
can-execute: true
|
||||||
|
|
||||||
- platform_name: Linux-aarch64 with cross v0.2.3
|
- name: Linux-aarch64 with cross v0.2.3
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-24.04
|
||||||
target: aarch64-unknown-linux-musl
|
target: aarch64-unknown-linux-gnu
|
||||||
cross-version: "v0.2.3"
|
cross-version: "v0.2.3"
|
||||||
cache-cross-binary: true
|
cache-cross-binary: true
|
||||||
expect-file-re: "aarch64"
|
expect-file-re: "aarch64"
|
||||||
@@ -58,9 +100,9 @@ jobs:
|
|||||||
expect-stripped: ""
|
expect-stripped: ""
|
||||||
can-execute: true
|
can-execute: true
|
||||||
|
|
||||||
- platform_name: Linux-aarch64 with cross v0.2.3 (no cache)
|
- name: Linux-aarch64 with cross v0.2.3 (no cache)
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-24.04
|
||||||
target: aarch64-unknown-linux-musl
|
target: aarch64-unknown-linux-gnu
|
||||||
cross-version: "v0.2.3"
|
cross-version: "v0.2.3"
|
||||||
cache-cross-binary: false
|
cache-cross-binary: false
|
||||||
expect-file-re: "aarch64"
|
expect-file-re: "aarch64"
|
||||||
@@ -69,9 +111,9 @@ jobs:
|
|||||||
expect-stripped: ""
|
expect-stripped: ""
|
||||||
can-execute: true
|
can-execute: true
|
||||||
|
|
||||||
- platform_name: Linux-aarch64 with cross 19be834
|
- name: Linux-aarch64 with cross 19be834
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-24.04
|
||||||
target: aarch64-unknown-linux-musl
|
target: aarch64-unknown-linux-gnu
|
||||||
cross-version: "19be834"
|
cross-version: "19be834"
|
||||||
cache-cross-binary: true
|
cache-cross-binary: true
|
||||||
expect-file-re: "aarch64"
|
expect-file-re: "aarch64"
|
||||||
@@ -80,9 +122,9 @@ jobs:
|
|||||||
expect-stripped: ""
|
expect-stripped: ""
|
||||||
can-execute: true
|
can-execute: true
|
||||||
|
|
||||||
- platform_name: Linux-aarch64 with cross 19be834
|
- name: Linux-aarch64 with cross 19be834 (no cache)
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-24.04
|
||||||
target: aarch64-unknown-linux-musl
|
target: aarch64-unknown-linux-gnu
|
||||||
cross-version: "19be834"
|
cross-version: "19be834"
|
||||||
cache-cross-binary: false
|
cache-cross-binary: false
|
||||||
expect-file-re: "aarch64"
|
expect-file-re: "aarch64"
|
||||||
@@ -91,35 +133,61 @@ jobs:
|
|||||||
expect-stripped: ""
|
expect-stripped: ""
|
||||||
can-execute: true
|
can-execute: true
|
||||||
|
|
||||||
- platform_name: Linux-arm
|
- name: Linux-aarch64 with arm64 host
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-24.04-arm
|
||||||
target: arm-unknown-linux-musleabi
|
target: aarch64-unknown-linux-gnu
|
||||||
|
cache-cross-binary: true
|
||||||
|
expect-file-re: "aarch64"
|
||||||
|
expect-cross: ""
|
||||||
|
expect-stripped: "--expect-stripped"
|
||||||
|
can-execute: true
|
||||||
|
|
||||||
|
# This fails because of some sort of weird bug in cross. See
|
||||||
|
# https://github.com/cross-rs/cross/issues/1628 for more details. Until that's fixed
|
||||||
|
# cross-compiling on Linux ARM won't work without a custom Docker image, which I don't
|
||||||
|
# want to do just for the sake of testing this.
|
||||||
|
#
|
||||||
|
# - name: Linux-aarch64 with arm64 host compile to x86-64
|
||||||
|
# runs-on: ubuntu-24.04-arm
|
||||||
|
# target: x86_64-unknown-linux-gnu
|
||||||
|
# # Until cross produces arm64 binary releases we _have_ to set this when running on
|
||||||
|
# # arm64.
|
||||||
|
# cross-version: "c7dee4d"
|
||||||
|
# cache-cross-binary: true
|
||||||
|
# expect-file-re: "ELF.+x86-64"
|
||||||
|
# expect-cross: "--expect-cross"
|
||||||
|
# expect-stripped: ""
|
||||||
|
# can-execute: true
|
||||||
|
|
||||||
|
- name: Linux-arm
|
||||||
|
runs-on: ubuntu-24.04
|
||||||
|
target: arm-unknown-linux-gnueabi
|
||||||
cache-cross-binary: true
|
cache-cross-binary: true
|
||||||
expect-file-re: "32.+ARM"
|
expect-file-re: "32.+ARM"
|
||||||
expect-cross: "--expect-cross"
|
expect-cross: "--expect-cross"
|
||||||
expect-stripped: ""
|
expect-stripped: ""
|
||||||
can-execute: true
|
can-execute: true
|
||||||
|
|
||||||
- platform_name: Linux-i586
|
- name: Linux-i586
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-24.04
|
||||||
target: i586-unknown-linux-musl
|
target: i586-unknown-linux-gnu
|
||||||
cache-cross-binary: true
|
cache-cross-binary: true
|
||||||
expect-file-re: "ELF.+80386"
|
expect-file-re: "ELF.+80386"
|
||||||
expect-cross: "--expect-cross"
|
expect-cross: "--expect-cross"
|
||||||
expect-stripped: ""
|
expect-stripped: ""
|
||||||
can-execute: true
|
can-execute: true
|
||||||
|
|
||||||
- platform_name: Linux-i686
|
- name: Linux-i686
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-24.04
|
||||||
target: i686-unknown-linux-musl
|
target: i686-unknown-linux-gnu
|
||||||
cache-cross-binary: true
|
cache-cross-binary: true
|
||||||
expect-file-re: "ELF.+80386"
|
expect-file-re: "ELF.+80386"
|
||||||
expect-cross: "--expect-cross"
|
expect-cross: "--expect-cross"
|
||||||
expect-stripped: ""
|
expect-stripped: ""
|
||||||
can-execute: true
|
can-execute: true
|
||||||
|
|
||||||
- platform_name: Linux-powerpc
|
- name: Linux-powerpc
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-24.04
|
||||||
target: powerpc-unknown-linux-gnu
|
target: powerpc-unknown-linux-gnu
|
||||||
cache-cross-binary: true
|
cache-cross-binary: true
|
||||||
expect-file-re: "32.+PowerPC"
|
expect-file-re: "32.+PowerPC"
|
||||||
@@ -127,8 +195,8 @@ jobs:
|
|||||||
expect-stripped: ""
|
expect-stripped: ""
|
||||||
can-execute: true
|
can-execute: true
|
||||||
|
|
||||||
- platform_name: Linux-powerpc64
|
- name: Linux-powerpc64
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-24.04
|
||||||
target: powerpc64-unknown-linux-gnu
|
target: powerpc64-unknown-linux-gnu
|
||||||
cache-cross-binary: true
|
cache-cross-binary: true
|
||||||
expect-file-re: "64.+PowerPC"
|
expect-file-re: "64.+PowerPC"
|
||||||
@@ -136,8 +204,8 @@ jobs:
|
|||||||
expect-stripped: ""
|
expect-stripped: ""
|
||||||
can-execute: true
|
can-execute: true
|
||||||
|
|
||||||
- platform_name: Linux-powerpc64le
|
- name: Linux-powerpc64le
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-24.04
|
||||||
target: powerpc64le-unknown-linux-gnu
|
target: powerpc64le-unknown-linux-gnu
|
||||||
cache-cross-binary: true
|
cache-cross-binary: true
|
||||||
expect-file-re: "64.+PowerPC"
|
expect-file-re: "64.+PowerPC"
|
||||||
@@ -145,8 +213,8 @@ jobs:
|
|||||||
expect-stripped: ""
|
expect-stripped: ""
|
||||||
can-execute: true
|
can-execute: true
|
||||||
|
|
||||||
- platform_name: Linux-riscv64
|
- name: Linux-riscv64
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-24.04
|
||||||
target: riscv64gc-unknown-linux-gnu
|
target: riscv64gc-unknown-linux-gnu
|
||||||
cache-cross-binary: true
|
cache-cross-binary: true
|
||||||
expect-file-re: "64.+RISC-V"
|
expect-file-re: "64.+RISC-V"
|
||||||
@@ -154,8 +222,8 @@ jobs:
|
|||||||
expect-stripped: ""
|
expect-stripped: ""
|
||||||
can-execute: true
|
can-execute: true
|
||||||
|
|
||||||
- platform_name: Linux-s390x
|
- name: Linux-s390x
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-24.04
|
||||||
target: s390x-unknown-linux-gnu
|
target: s390x-unknown-linux-gnu
|
||||||
cache-cross-binary: true
|
cache-cross-binary: true
|
||||||
expect-file-re: "64.+S/390"
|
expect-file-re: "64.+S/390"
|
||||||
@@ -163,8 +231,8 @@ jobs:
|
|||||||
expect-stripped: ""
|
expect-stripped: ""
|
||||||
can-execute: true
|
can-execute: true
|
||||||
|
|
||||||
- platform_name: NetBSD-x86_64
|
- name: NetBSD-x86_64
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-24.04
|
||||||
target: x86_64-unknown-netbsd
|
target: x86_64-unknown-netbsd
|
||||||
cache-cross-binary: true
|
cache-cross-binary: true
|
||||||
expect-file-re: "x86-64.+NetBSD"
|
expect-file-re: "x86-64.+NetBSD"
|
||||||
@@ -172,33 +240,33 @@ jobs:
|
|||||||
expect-stripped: ""
|
expect-stripped: ""
|
||||||
can-execute: false
|
can-execute: false
|
||||||
|
|
||||||
- platform_name: Windows-aarch64
|
- name: Windows-aarch64
|
||||||
runs-on: windows-latest
|
runs-on: windows-latest
|
||||||
target: aarch64-pc-windows-msvc
|
target: aarch64-pc-windows-msvc
|
||||||
cache-cross-binary: true
|
cache-cross-binary: true
|
||||||
expect-file-re: "Aarch64.+Windows"
|
expect-file-re: "Windows.+ARM64"
|
||||||
expect-cross: ""
|
expect-cross: ""
|
||||||
expect-stripped: ""
|
expect-stripped: ""
|
||||||
can-execute: false
|
can-execute: false
|
||||||
|
|
||||||
- platform_name: Windows-i686
|
- name: Windows-i686
|
||||||
runs-on: windows-latest
|
runs-on: windows-latest
|
||||||
target: i686-pc-windows-msvc
|
target: i686-pc-windows-msvc
|
||||||
cache-cross-binary: true
|
cache-cross-binary: true
|
||||||
expect-file-re: "80386.+Windows"
|
expect-file-re: "Windows.+Intel i386"
|
||||||
expect-cross: ""
|
expect-cross: ""
|
||||||
expect-stripped: "--expect-stripped"
|
expect-stripped: "--expect-stripped"
|
||||||
can-execute: true
|
can-execute: true
|
||||||
|
|
||||||
- platform_name: Windows-x86_64
|
- name: Windows-x86_64
|
||||||
runs-on: windows-latest
|
runs-on: windows-latest
|
||||||
target: x86_64-pc-windows-msvc
|
target: x86_64-pc-windows-msvc
|
||||||
cache-cross-binary: true
|
cache-cross-binary: true
|
||||||
expect-file-re: "x86-64.+Windows"
|
expect-file-re: "Windows.+x86-64"
|
||||||
expect-stripped: "--expect-stripped"
|
expect-stripped: "--expect-stripped"
|
||||||
can-execute: true
|
can-execute: true
|
||||||
|
|
||||||
- platform_name: macOS-x86_64
|
- name: macOS-x86_64
|
||||||
runs-on: macOS-latest
|
runs-on: macOS-latest
|
||||||
target: x86_64-apple-darwin
|
target: x86_64-apple-darwin
|
||||||
cache-cross-binary: true
|
cache-cross-binary: true
|
||||||
@@ -207,7 +275,7 @@ jobs:
|
|||||||
expect-stripped: "--expect-stripped"
|
expect-stripped: "--expect-stripped"
|
||||||
can-execute: true
|
can-execute: true
|
||||||
|
|
||||||
- platform_name: macOS-aarch64
|
- name: macOS-aarch64
|
||||||
runs-on: macOS-latest
|
runs-on: macOS-latest
|
||||||
target: aarch64-apple-darwin
|
target: aarch64-apple-darwin
|
||||||
cache-cross-binary: true
|
cache-cross-binary: true
|
||||||
@@ -229,27 +297,33 @@ jobs:
|
|||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
command: both
|
command: both
|
||||||
|
force-use-cross: ${{ matrix.platform.force-use-cross || false }}
|
||||||
cross-version: ${{ matrix.platform.cross-version }}
|
cross-version: ${{ matrix.platform.cross-version }}
|
||||||
cache-cross-binary: ${{ matrix.platform.cache-cross-binary }}
|
cache-cross-binary: ${{ matrix.platform.cache-cross-binary }}
|
||||||
target: ${{ matrix.platform.target }}
|
target: ${{ matrix.platform.target }}
|
||||||
|
toolchain: ${{ matrix.platform.toolchain || 'stable' }}
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
if: ${{ matrix.platform.can-execute }}
|
if: ${{ matrix.platform.can-execute }}
|
||||||
- name: Run test command
|
- name: Run test command
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
command: test
|
command: test
|
||||||
|
force-use-cross: ${{ matrix.platform.force-use-cross || false }}
|
||||||
cross-version: ${{ matrix.platform.cross-version }}
|
cross-version: ${{ matrix.platform.cross-version }}
|
||||||
cache-cross-binary: ${{ matrix.platform.cache-cross-binary }}
|
cache-cross-binary: ${{ matrix.platform.cache-cross-binary }}
|
||||||
target: ${{ matrix.platform.target }}
|
target: ${{ matrix.platform.target }}
|
||||||
|
toolchain: ${{ matrix.platform.toolchain || 'stable' }}
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
if: ${{ matrix.platform.can-execute }}
|
if: ${{ matrix.platform.can-execute }}
|
||||||
- name: Run test command with args
|
- name: Run test command with args
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
command: test
|
command: test
|
||||||
|
force-use-cross: ${{ matrix.platform.force-use-cross || false }}
|
||||||
cross-version: ${{ matrix.platform.cross-version }}
|
cross-version: ${{ matrix.platform.cross-version }}
|
||||||
cache-cross-binary: ${{ matrix.platform.cache-cross-binary }}
|
cache-cross-binary: ${{ matrix.platform.cache-cross-binary }}
|
||||||
target: ${{ matrix.platform.target }}
|
target: ${{ matrix.platform.target }}
|
||||||
|
toolchain: ${{ matrix.platform.toolchain || 'stable' }}
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
args: "-- --ignored"
|
args: "-- --ignored"
|
||||||
if: ${{ matrix.platform.can-execute }}
|
if: ${{ matrix.platform.can-execute }}
|
||||||
@@ -257,12 +331,19 @@ jobs:
|
|||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
command: build
|
command: build
|
||||||
|
force-use-cross: ${{ matrix.platform.force-use-cross || false }}
|
||||||
cross-version: ${{ matrix.platform.cross-version }}
|
cross-version: ${{ matrix.platform.cross-version }}
|
||||||
cache-cross-binary: ${{ matrix.platform.cache-cross-binary }}
|
cache-cross-binary: ${{ matrix.platform.cache-cross-binary }}
|
||||||
target: ${{ matrix.platform.target }}
|
target: ${{ matrix.platform.target }}
|
||||||
|
toolchain: ${{ matrix.platform.toolchain || 'stable' }}
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
strip: true
|
strip: true
|
||||||
- name: Check binary and cross for main crate on ${{ matrix.platform.platform_name }}
|
# This is the default cache-provider. This is just added to make sure that we handle
|
||||||
|
# additional rust-cache parameters properly. See
|
||||||
|
# https://github.com/houseabsolute/actions-rust-cross/issues/46 for an example of how this
|
||||||
|
# was broken.
|
||||||
|
rust-cache-parameters: '{ "cache-provider": "github" }'
|
||||||
|
- name: Check binary and cross for main crate on ${{ matrix.platform.name }}
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
set -e
|
set -e
|
||||||
@@ -278,13 +359,15 @@ jobs:
|
|||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
command: build
|
command: build
|
||||||
|
force-use-cross: ${{ matrix.platform.force-use-cross || false }}
|
||||||
cross-version: ${{ matrix.platform.cross-version }}
|
cross-version: ${{ matrix.platform.cross-version }}
|
||||||
cache-cross-binary: ${{ matrix.platform.cache-cross-binary }}
|
cache-cross-binary: ${{ matrix.platform.cache-cross-binary }}
|
||||||
working-directory: subcrate
|
working-directory: subcrate
|
||||||
target: ${{ matrix.platform.target }}
|
target: ${{ matrix.platform.target }}
|
||||||
|
toolchain: ${{ matrix.platform.toolchain || 'stable' }}
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
strip: true
|
strip: true
|
||||||
- name: Check binary and cross for subcrate on ${{ matrix.platform.platform_name }}
|
- name: Check binary and cross for subcrate on ${{ matrix.platform.name }}
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
set -e
|
set -e
|
||||||
@@ -301,19 +384,62 @@ jobs:
|
|||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
command: bench
|
command: bench
|
||||||
|
force-use-cross: ${{ matrix.platform.force-use-cross || false }}
|
||||||
cross-version: ${{ matrix.platform.cross-version }}
|
cross-version: ${{ matrix.platform.cross-version }}
|
||||||
cache-cross-binary: ${{ matrix.platform.cache-cross-binary }}
|
cache-cross-binary: ${{ matrix.platform.cache-cross-binary }}
|
||||||
target: ${{ matrix.platform.target }}
|
target: ${{ matrix.platform.target }}
|
||||||
working-directory: bench
|
working-directory: bench
|
||||||
|
toolchain: ${{ matrix.platform.toolchain || 'stable' }}
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
if: ${{ matrix.platform.can-execute }}
|
if: ${{ matrix.platform.can-execute }}
|
||||||
|
- name: Upload build artifacts
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: build-artifacts-${{ matrix.platform.name }}
|
||||||
|
path: |
|
||||||
|
target/${{ matrix.platform.target }}/debug/bin*
|
||||||
|
subcrate/target/${{ matrix.platform.target }}/debug/subcrate
|
||||||
|
|
||||||
test-validate-inputs:
|
test-validate-inputs:
|
||||||
name: Test validate-inputs
|
name: Test validate-inputs
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-24.04
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
shell: bash
|
shell: bash
|
||||||
run: ./validate-inputs.py --test
|
run: ./validate-inputs.py --test
|
||||||
|
|
||||||
|
test-other-cargo-commands:
|
||||||
|
name: Test a "cargo foo" command
|
||||||
|
runs-on: ubuntu-24.04
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Copy test project to root
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
cp -a test-project/* .
|
||||||
|
rm -fr test-project
|
||||||
|
- name: Create cargo-foo command
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
set -e
|
||||||
|
set -x
|
||||||
|
|
||||||
|
dir="${{ github.workspace }}/bin"
|
||||||
|
mkdir -p "$dir"
|
||||||
|
|
||||||
|
bin="$dir/cargo-foo"
|
||||||
|
|
||||||
|
echo "#!/bin/bash" >> "$bin"
|
||||||
|
echo "echo 'This is cargo-foo!'" >> "$bin"
|
||||||
|
echo "exit 0" >> "$bin"
|
||||||
|
chmod 0755 "$bin"
|
||||||
|
|
||||||
|
echo "PATH=$dir:$PATH" >> "$GITHUB_ENV"
|
||||||
|
- name: Run cargo-foo command
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
command: foo
|
||||||
|
target: x86_64-unknown-linux-gnu
|
||||||
|
|||||||
20
CONTRIBUTING.md
Normal file
20
CONTRIBUTING.md
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
# Contributing
|
||||||
|
|
||||||
|
Thank you for your interest in contributing to this project. This file contains instructions that
|
||||||
|
will help you work with the source code.
|
||||||
|
|
||||||
|
Please note that if you have any questions or difficulties, you can reach the maintainer through
|
||||||
|
GitHub Issues. Filing an issue is the preferred method for reporting bugs or issues with the
|
||||||
|
development tool configuration for this project.
|
||||||
|
|
||||||
|
If you'd like to suggest a small change, you can do that by directly creating a
|
||||||
|
[Pull Request](https://docs.github.com/en/pull-requests). For larger changes, you are encouraged to
|
||||||
|
file an issue first, so we can discuss the change before you spend too much time implementing it.
|
||||||
|
|
||||||
|
Please note that the maintainer, Dave Rolsky (@autarch), mostly works on his FOSS projects in his
|
||||||
|
free time, which means on weekends and days off. However, he does not work on these things _every_
|
||||||
|
weekend, so it may be a little while before you get a response to your issue or PR.
|
||||||
|
|
||||||
|
If it's been more than 3 weeks since you submitted an issue or PR, feel free to comment on the
|
||||||
|
submission to nudge the maintainer, who is probably getting sucked into some new video game and
|
||||||
|
spending all his time there.
|
||||||
32
Changes.md
32
Changes.md
@@ -1,3 +1,33 @@
|
|||||||
|
## 1.0.5 - 2025-07-20
|
||||||
|
|
||||||
|
- Fixed a bug in the handling of the `rust-cache-parameters` input. If anything was specified for
|
||||||
|
this, it would end up providing a broken config to the `Swatinem/rust-cache` action. Reported by
|
||||||
|
@SinTan1729 (Sayantan Santra). GH #46.
|
||||||
|
|
||||||
|
## 1.0.4 - 2025-04-12
|
||||||
|
|
||||||
|
- Removed validation for the `toolchain` input. The
|
||||||
|
[dtolnay/rust-toolchain](https://github.com/dtolnay/rust-toolchain) accepts a lot of different
|
||||||
|
options that this action wasn't allowing. It's simpler and more flexible to just let that action
|
||||||
|
handle validation. Requested by @axos88 (Akos Vandra-Meyer). GH #42.
|
||||||
|
- Removed validation for the `command` input. This allows you to use this action with any `cargo`
|
||||||
|
extension command, like `cargo-deb`. Setting `command` to `both` is still supported and will run
|
||||||
|
the `build` and `test` commands. Requested by @bvaisvil (Benjamin Vaisvil). GH #43.
|
||||||
|
|
||||||
|
## 1.0.3 - 2025-02-17
|
||||||
|
|
||||||
|
- Fixed a bug when running with a Linux ARM host where the action would use a cached `cross`
|
||||||
|
download for x86-64 Linux (or vice versa). Now the cache key for the `cross` binary includes the
|
||||||
|
runner's architecture in addition to its OS.
|
||||||
|
- This release partially support running on Linxu ARM, but see the `README.md` file for details on
|
||||||
|
this.
|
||||||
|
|
||||||
|
## 1.0.2 - 2025-02-16
|
||||||
|
|
||||||
|
- Added a new `force-use-cross` input, which does what it says. It will force the use of `cross`
|
||||||
|
even when it is not required for given platform/target combination. Note that this only works on
|
||||||
|
Linux hosts.
|
||||||
|
|
||||||
## 1.0.1 - 2025-01-20
|
## 1.0.1 - 2025-01-20
|
||||||
|
|
||||||
- Fixed a bug where this action would attempt to use `cross` when compiling for an ARM Linux target
|
- Fixed a bug where this action would attempt to use `cross` when compiling for an ARM Linux target
|
||||||
@@ -32,7 +62,7 @@ bumped to v1.0.0 because of this change.
|
|||||||
- This action will now configure and use `Swatinem/rust-cache` by default for you. It will include
|
- This action will now configure and use `Swatinem/rust-cache` by default for you. It will include
|
||||||
the `target` parameter as part of the cache key automatically. Suggested by @jennydaman (Jennings
|
the `target` parameter as part of the cache key automatically. Suggested by @jennydaman (Jennings
|
||||||
Zhang). GH #23.
|
Zhang). GH #23.
|
||||||
- This action now validates its input and will exit early if they are not valid. GH #35.
|
- This action now validates its inputs and will exit early if they are not valid. GH #35.
|
||||||
|
|
||||||
## 0.0.17 - 2024-11-23
|
## 0.0.17 - 2024-11-23
|
||||||
|
|
||||||
|
|||||||
12
GOVERNANCE.md
Normal file
12
GOVERNANCE.md
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
# Project Governance
|
||||||
|
|
||||||
|
This repository works through the BDFL – Benevolent Dictator For Life - model. That means that a
|
||||||
|
single maintainer, Dave Rolsky (@autarch), holds all of the admin keys and write access for this
|
||||||
|
repository. Other users are encouraged to open issues, submit Pull Requests, and to ask for
|
||||||
|
recognition as maintainers, but all decisions ultimately lie with the core maintainer.
|
||||||
|
|
||||||
|
This maintainer is open to others joining on the admin team for this repository, but prospective
|
||||||
|
admins will need a track record of contributions in the form of PRs and issue responses first.
|
||||||
|
|
||||||
|
Please see the [CONTRIBUTING.md](CONTRIBUTING.md) file for more details on how to file issues and
|
||||||
|
PRs for this project.
|
||||||
76
README.md
76
README.md
@@ -14,19 +14,19 @@ jobs:
|
|||||||
matrix:
|
matrix:
|
||||||
platform:
|
platform:
|
||||||
- os-name: FreeBSD-x86_64
|
- os-name: FreeBSD-x86_64
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-24.04
|
||||||
target: x86_64-unknown-freebsd
|
target: x86_64-unknown-freebsd
|
||||||
|
|
||||||
- os-name: Linux-x86_64
|
- os-name: Linux-x86_64
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-24.04
|
||||||
target: x86_64-unknown-linux-musl
|
target: x86_64-unknown-linux-musl
|
||||||
|
|
||||||
- os-name: Linux-aarch64
|
- os-name: Linux-aarch64
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-24.04
|
||||||
target: aarch64-unknown-linux-musl
|
target: aarch64-unknown-linux-musl
|
||||||
|
|
||||||
- os-name: Linux-riscv64
|
- os-name: Linux-riscv64
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-24.04
|
||||||
target: riscv64gc-unknown-linux-gnu
|
target: riscv64gc-unknown-linux-gnu
|
||||||
|
|
||||||
- os-name: Windows-x86_64
|
- os-name: Windows-x86_64
|
||||||
@@ -46,7 +46,7 @@ jobs:
|
|||||||
- name: Build binary
|
- name: Build binary
|
||||||
uses: houseabsolute/actions-rust-cross@v1
|
uses: houseabsolute/actions-rust-cross@v1
|
||||||
with:
|
with:
|
||||||
command: ${{ matrix.platform.command }}
|
command: build
|
||||||
target: ${{ matrix.platform.target }}
|
target: ${{ matrix.platform.target }}
|
||||||
args: "--locked --release"
|
args: "--locked --release"
|
||||||
strip: true
|
strip: true
|
||||||
@@ -60,7 +60,7 @@ jobs:
|
|||||||
Note that for Linux or BSD targets, you should always set the `runs-on` key to a Linux x86-64
|
Note that for Linux or BSD targets, you should always set the `runs-on` key to a Linux x86-64
|
||||||
architecture runner.
|
architecture runner.
|
||||||
|
|
||||||
If you _only_ want to do native ARM compilation, for example using the `ubuntu-latest-arm` runner,
|
If you _only_ want to do native ARM compilation, for example using the `ubuntu-24.04-arm` runner,
|
||||||
then there's no need to use this action. However, if you want to compile for _many_ platforms,
|
then there's no need to use this action. However, if you want to compile for _many_ platforms,
|
||||||
including Linux ARM, using this action will simplify your config. This action is only tested on
|
including Linux ARM, using this action will simplify your config. This action is only tested on
|
||||||
Ubuntu x86-64, Windows, and macOS runners.
|
Ubuntu x86-64, Windows, and macOS runners.
|
||||||
@@ -69,18 +69,19 @@ Ubuntu x86-64, Windows, and macOS runners.
|
|||||||
|
|
||||||
This action takes the following parameters:
|
This action takes the following parameters:
|
||||||
|
|
||||||
| Key | Type | Required? | Description |
|
| Key | Type | Required? | Description |
|
||||||
| ----------------------- | -------------------------------------------------------------------- | --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
| ----------------------- | --------------------------- | --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||||
| `command` | string (one of `build`, `test`, `both` (build and test), or `bench`) | no | The command(s) to run. The default is `build`. Running the `test` command will fail with \*BSD targets and non-x86 Windows. |
|
| `command` | string | no | The command(s) to run. The default is `build`. Running the `test` command will fail with \*BSD targets and non-x86 Windows. You can use any command supported by `cargo` and/or `cross`. For example, if you install `cargo-deb`, the command can be `deb`. Use the special string "both" to run both `build` and `test. |
|
||||||
| `target` | string | yes | The target triple to compile for. This should be one of the targets found by running `rustup target list`. |
|
| `target` | string | yes | The target triple to compile for. This should be one of the targets found by running `rustup target list`. |
|
||||||
| `working-directory` | string | no | The working directory in which to run the `cargo` or `cross` commands. Defaults to the current directory (`.`). |
|
| `working-directory` | string | no | The working directory in which to run the `cargo` or `cross` commands. Defaults to the current directory (`.`). |
|
||||||
| `toolchain` | string (one of `stable`, `beta`, or `nightly`) | no | The Rust toolchain version to install. The default is `stable`. |
|
| `toolchain` | string) | no | The Rust toolchain version to install. This is passed directly to [dtolnay/rust-toolchain](https://github.com/dtolnay/rust-toolchain), which accepts many different options. See its documentation for more details. The default is `stable`. |
|
||||||
| `GITHUB_TOKEN` | string | no | Defaults to the value of `${{ github.token }}`. |
|
| `GITHUB_TOKEN` | string | no | Defaults to the value of `${{ github.token }}`. |
|
||||||
| `args` | string | no | A string-separated list of arguments to be passed to `cross build`, like `--release --locked`. |
|
| `args` | string | no | A string-separated list of arguments to be passed to `cross build`, like `--release --locked`. |
|
||||||
| `strip` | boolean (`true` or `false`) | no | If this is true, then the resulting binaries will be stripped if possible. This is only possible for binaries which weren't cross-compiled. |
|
| `strip` | boolean (`true` or `false`) | no | If this is true, then the resulting binaries will be stripped if possible. This is only possible for binaries which weren't cross-compiled. |
|
||||||
| `cross-version` | string | no | This can be used to set the version of `cross` to use. If specified, it should be a specific `cross` release tag (like `v0.2.3`) or a git ref (commit hash, `HEAD`, etc.). If this is not set then the latest released version will always be used. If this is set to a git ref then the version corresponding to that ref will be installed. |
|
| `cross-version` | string | no | This can be used to set the version of `cross` to use. If specified, it should be a specific `cross` release tag (like `v0.2.3`) or a git ref (commit hash, `HEAD`, etc.). If this is not set then the latest released version will always be used. If this is set to a git ref then the version corresponding to that ref will be installed. |
|
||||||
| `use-rust-cache` | boolean | no | Whether or not to use [the `Swatinem/rust-cache@v2` action](https://github.com/Swatinem/rust-cache). This defaults to true. |
|
| `force-use-cross` | boolean (`true` or `false`) | no | If this is true, then the action will use `cross` even if it is not needed for the given target. If this is set to `true`, then the resulting binary will not be stripped, regardless of whether `strip` is `true` or not. This only works on Linux hosts. Forcing the use of `cross` on other hosts is not supported. |
|
||||||
| `rust-cache-parameters` | string (containing JSON) | no | This must be a string containing valid JSON. The JSON should be an object where the keys are the parameters for [the `Swatinem/rust-cache@v2` action](https://github.com/Swatinem/rust-cache). |
|
| `use-rust-cache` | boolean | no | Whether or not to use [the `Swatinem/rust-cache@v2` action](https://github.com/Swatinem/rust-cache). This defaults to true. |
|
||||||
|
| `rust-cache-parameters` | string (containing JSON) | no | This must be a string containing valid JSON. The JSON should be an object where the keys are the parameters for [the `Swatinem/rust-cache@v2` action](https://github.com/Swatinem/rust-cache). |
|
||||||
|
|
||||||
### Setting Environment Variables
|
### Setting Environment Variables
|
||||||
|
|
||||||
@@ -161,3 +162,42 @@ you can avoid this issue by structuring your workflow as follows:
|
|||||||
4. Run the release steps for crate B.
|
4. Run the release steps for crate B.
|
||||||
|
|
||||||
When structured this way, it does not matter if the output of crate A is deleted in step 3.
|
When structured this way, it does not matter if the output of crate A is deleted in step 3.
|
||||||
|
|
||||||
|
## Cross-Compiling from Linux ARM Runners
|
||||||
|
|
||||||
|
In theory, this should work, and this action does implement some of the necessary work for this.
|
||||||
|
However, there are a couple issues with this:
|
||||||
|
|
||||||
|
1. As of 2025-02-17, the `cross` project does not publish Linux ARM binary releases. That means that
|
||||||
|
in order to use `cross` on a Linux ARM runner as part of this action, you must set
|
||||||
|
`cross-version` to a more recent commit from the `cross` repo.
|
||||||
|
2. There is
|
||||||
|
[a bug in `cross` that means you must use a custom Docker image](https://github.com/cross-rs/cross/issues/1628)
|
||||||
|
when cross-compiling from a Linux ARM runner. See
|
||||||
|
[this other `cross` issue](https://github.com/cross-rs/cross/issues/751) for more details.
|
||||||
|
|
||||||
|
## Linting and Tidying this Code
|
||||||
|
|
||||||
|
The code in this repo is linted and tidied with
|
||||||
|
[`precious`](https://github.com/houseabsolute/precious). This repo contains a `mise.toml` file.
|
||||||
|
[Mise](https://mise.jdx.dev/) is a tool for managing dev tools with per-repo configuration. You can
|
||||||
|
install `mise` and use it to run `precious` as follows:
|
||||||
|
|
||||||
|
```
|
||||||
|
# Installs mise
|
||||||
|
curl https://mise.run | sh
|
||||||
|
# Installs precious and other dev tools
|
||||||
|
mise install
|
||||||
|
```
|
||||||
|
|
||||||
|
Once this is done, you can run `precious` via `mise`:
|
||||||
|
|
||||||
|
```
|
||||||
|
# Lints all code
|
||||||
|
mise exec -- precious lint -a
|
||||||
|
# Tidies all code
|
||||||
|
mise exec -- precious tidy -a
|
||||||
|
```
|
||||||
|
|
||||||
|
If you want to use `mise` for other projects, see [its documentation](https://mise.jdx.dev/) for
|
||||||
|
more details on how you can configure your shell to always activate `mise`.
|
||||||
|
|||||||
9
SECURITY.md
Normal file
9
SECURITY.md
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
# Reporting Security Issues
|
||||||
|
|
||||||
|
To report a security issue, please use the GitHub Security Advisory "Report a Vulnerability" tab.
|
||||||
|
|
||||||
|
The project maintainer(s) will send a response indicating the next steps in handling your report.
|
||||||
|
After the initial reply to your report, the maintainer(s) will keep you informed of the progress
|
||||||
|
towards a fix and full announcement, and may ask for additional information or guidance.
|
||||||
|
|
||||||
|
Report security bugs in third-party packages to the person or team maintaining the package.
|
||||||
7
SUPPORT.md
Normal file
7
SUPPORT.md
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
# How to file issues and get help
|
||||||
|
|
||||||
|
This project uses GitHub Issues to track bugs and feature requests. Please search the existing
|
||||||
|
issues before filing new issues to avoid duplicates. For new issues, file your bug or feature
|
||||||
|
request as a new Issue.
|
||||||
|
|
||||||
|
For help and questions about using this project, you can use GitHub Issues as well.
|
||||||
109
action.yml
109
action.yml
@@ -1,55 +1,74 @@
|
|||||||
name: "Build Rust Projects with Cross"
|
name: "Build Rust Projects with Cross"
|
||||||
author: "Dave Rolsky <autarch@urth.org>"
|
author: "Dave Rolsky <autarch@urth.org>"
|
||||||
|
|
||||||
branding:
|
branding:
|
||||||
icon: home
|
icon: home
|
||||||
color: gray-dark
|
color: gray-dark
|
||||||
|
|
||||||
description: |
|
description: |
|
||||||
Cross compile your Rust projects with cross (https://github.com/cross-rs/cross).
|
Cross compile your Rust projects with cross (https://github.com/cross-rs/cross).
|
||||||
|
|
||||||
inputs:
|
inputs:
|
||||||
target:
|
target:
|
||||||
description: The target platform
|
description: The target platform
|
||||||
required: true
|
required: true
|
||||||
|
|
||||||
command:
|
command:
|
||||||
description: |
|
description: |
|
||||||
The commands to run. This must be one of "build", "test", "both" (build and test), or "bench".
|
The commands to run. Use "both" to run both "build" and "test".
|
||||||
default: build
|
default: build
|
||||||
|
|
||||||
toolchain:
|
toolchain:
|
||||||
description: |
|
description: |
|
||||||
The target toolchain to use (one of "stable", "beta", or "nightly").
|
The target toolchain to use.
|
||||||
default: stable
|
default: stable
|
||||||
|
|
||||||
working-directory:
|
working-directory:
|
||||||
description: The working directory for each step
|
description: The working directory for each step
|
||||||
default: "."
|
default: "."
|
||||||
|
|
||||||
GITHUB_TOKEN:
|
GITHUB_TOKEN:
|
||||||
description: |
|
description: |
|
||||||
A GitHub token, available in the secrets.GITHUB_TOKEN working-directory variable.
|
A GitHub token, available in the secrets.GITHUB_TOKEN working-directory variable.
|
||||||
default: ${{ github.token }}
|
default: ${{ github.token }}
|
||||||
|
|
||||||
args:
|
args:
|
||||||
description: |
|
description: |
|
||||||
The arguments to be passed to cross or cargo when building, as a
|
The arguments to be passed to cross or cargo when building, as a
|
||||||
space-separated string.
|
space-separated string.
|
||||||
default: ""
|
default: ""
|
||||||
|
|
||||||
strip:
|
strip:
|
||||||
description: Strip the compiled binary
|
description: Strip the compiled binary
|
||||||
default: false
|
default: false
|
||||||
|
|
||||||
cross-version:
|
cross-version:
|
||||||
description: |
|
description: |
|
||||||
The version of cross to use. If not specified, then the latest version
|
The version of cross to use. If not specified, then the latest version
|
||||||
will be used.
|
will be used.
|
||||||
|
|
||||||
cache-cross-binary:
|
cache-cross-binary:
|
||||||
description: |
|
description: |
|
||||||
Cache the cross binary if one is installed. This is primarily for use in
|
Cache the cross binary if one is installed. This is primarily for use in
|
||||||
tests of this action.
|
tests of this action.
|
||||||
default: true
|
default: true
|
||||||
|
|
||||||
|
force-use-cross:
|
||||||
|
description: |
|
||||||
|
If this is true, the action will use cross even for targets where it is not needed.
|
||||||
|
default: false
|
||||||
|
|
||||||
use-rust-cache:
|
use-rust-cache:
|
||||||
description: |
|
description: |
|
||||||
Use `Swatinem/rust-cache@v2`. Defaults to true.
|
Use `Swatinem/rust-cache@v2`. Defaults to true.
|
||||||
default: true
|
default: true
|
||||||
|
|
||||||
rust-cache-parameters:
|
rust-cache-parameters:
|
||||||
description: |
|
description: |
|
||||||
A JSON string containing parameters to pass to `Swatinem/rust-cache@v2`. You can use the
|
A JSON string containing parameters to pass to `Swatinem/rust-cache@v2`. You can use the
|
||||||
`toJSON()` function in your action to make passing this easier.
|
`toJSON()` function in your action to make passing this easier.
|
||||||
default: "{}"
|
default: "{}"
|
||||||
|
|
||||||
runs:
|
runs:
|
||||||
using: composite
|
using: composite
|
||||||
steps:
|
steps:
|
||||||
@@ -57,9 +76,11 @@ runs:
|
|||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
echo '${{ toJSON(inputs) }}'
|
echo '${{ toJSON(inputs) }}'
|
||||||
|
|
||||||
- name: Add this action's path to PATH
|
- name: Add this action's path to PATH
|
||||||
shell: bash
|
shell: bash
|
||||||
run: echo "${{ github.action_path }}" >> $GITHUB_PATH
|
run: echo "${{ github.action_path }}" >> $GITHUB_PATH
|
||||||
|
|
||||||
- name: Validate inputs
|
- name: Validate inputs
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
@@ -71,17 +92,30 @@ runs:
|
|||||||
INPUTS_working_directory: ${{ inputs.working-directory }}
|
INPUTS_working_directory: ${{ inputs.working-directory }}
|
||||||
INPUTS_strip: ${{ inputs.strip }}
|
INPUTS_strip: ${{ inputs.strip }}
|
||||||
INPUTS_cache_cross_binary: ${{ inputs.cache-cross-binary }}
|
INPUTS_cache_cross_binary: ${{ inputs.cache-cross-binary }}
|
||||||
|
INPUTS_force_use_cross: ${{ inputs.force-use-cross }}
|
||||||
INPUTS_use_rust_cache: ${{ inputs.use-rust-cache }}
|
INPUTS_use_rust_cache: ${{ inputs.use-rust-cache }}
|
||||||
INPUTS_rust_cache_parameters: ${{ inputs.rust-cache-parameters }}
|
INPUTS_rust_cache_parameters: ${{ inputs.rust-cache-parameters }}
|
||||||
|
|
||||||
- name: Determine whether we need to cross-compile
|
- name: Determine whether we need to cross-compile
|
||||||
id: determine-cross-compile
|
id: determine-cross-compile
|
||||||
shell: bash
|
shell: bash
|
||||||
run: set-cross-compile.py ${{ inputs.target }}
|
run: set-cross-compile.py ${{ inputs.target }} ${{ inputs.force-use-cross }}
|
||||||
|
|
||||||
- name: Install toolchain
|
- name: Install toolchain
|
||||||
uses: dtolnay/rust-toolchain@master
|
uses: dtolnay/rust-toolchain@master
|
||||||
with:
|
with:
|
||||||
targets: ${{ inputs.target }}
|
targets: ${{ inputs.target }}
|
||||||
toolchain: ${{ inputs.toolchain }}
|
toolchain: ${{ inputs.toolchain }}
|
||||||
|
|
||||||
|
- name: Install qemu-user emulator binaries if cross-compiling on arm64 host
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
set -e
|
||||||
|
set -x
|
||||||
|
|
||||||
|
docker run --privileged --rm tonistiigi/binfmt --install all
|
||||||
|
if: steps.determine-cross-compile.outputs.needs-cross == 'true' && runner.os == 'Linux' && contains(runner.arch, 'ARM')
|
||||||
|
|
||||||
- name: Determine cross version
|
- name: Determine cross version
|
||||||
id: determine-cross-version
|
id: determine-cross-version
|
||||||
shell: bash
|
shell: bash
|
||||||
@@ -89,6 +123,7 @@ runs:
|
|||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ inputs.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ inputs.GITHUB_TOKEN }}
|
||||||
if: steps.determine-cross-compile.outputs.needs-cross == 'true'
|
if: steps.determine-cross-compile.outputs.needs-cross == 'true'
|
||||||
|
|
||||||
# We need to access this in both this YAML config and shell scripts. It
|
# We need to access this in both this YAML config and shell scripts. It
|
||||||
# doesn't seem like using ${{ env.RUNNER_TEMP }} works in the YAML config.
|
# doesn't seem like using ${{ env.RUNNER_TEMP }} works in the YAML config.
|
||||||
- name: Set directory for installing cross
|
- name: Set directory for installing cross
|
||||||
@@ -96,19 +131,22 @@ runs:
|
|||||||
shell: bash
|
shell: bash
|
||||||
run: set-cross-dir.sh
|
run: set-cross-dir.sh
|
||||||
if: steps.determine-cross-compile.outputs.needs-cross == 'true'
|
if: steps.determine-cross-compile.outputs.needs-cross == 'true'
|
||||||
|
|
||||||
- name: Cache cross
|
- name: Cache cross
|
||||||
id: cache-cross
|
id: cache-cross
|
||||||
uses: actions/cache@v4
|
uses: actions/cache@v4
|
||||||
with:
|
with:
|
||||||
path: ${{ steps.set-cross-dir.outputs.cross-dir }}/cross
|
path: ${{ steps.set-cross-dir.outputs.cross-dir }}/cross
|
||||||
key: ${{ runner.os }}-${{ steps.determine-cross-version.outputs.cross-version }}
|
key: ${{ runner.os }}-${{ runner.arch }}-${{ steps.determine-cross-version.outputs.cross-version }}
|
||||||
if: steps.determine-cross-compile.outputs.needs-cross == 'true' && inputs.cache-cross-binary == 'true'
|
if: steps.determine-cross-compile.outputs.needs-cross == 'true' && inputs.cache-cross-binary == 'true'
|
||||||
|
|
||||||
- name: Install cross if cross-compiling (*nix)
|
- name: Install cross if cross-compiling (*nix)
|
||||||
shell: bash
|
shell: bash
|
||||||
run: install-cross-nix.sh ${{ steps.set-cross-dir.outputs.cross-dir }} ${{ steps.determine-cross-version.outputs.cross-version }}
|
run: install-cross-nix.sh ${{ steps.set-cross-dir.outputs.cross-dir }} ${{ steps.determine-cross-version.outputs.cross-version }}
|
||||||
if: steps.determine-cross-compile.outputs.needs-cross == 'true' && steps.cache-cross.outputs.cache-hit != 'true'
|
if: steps.determine-cross-compile.outputs.needs-cross == 'true' && steps.cache-cross.outputs.cache-hit != 'true'
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ inputs.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ inputs.GITHUB_TOKEN }}
|
||||||
|
|
||||||
- name: Install musl-tools on Linux if target includes "musl"
|
- name: Install musl-tools on Linux if target includes "musl"
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
@@ -118,14 +156,17 @@ runs:
|
|||||||
sudo apt-get update --yes && \
|
sudo apt-get update --yes && \
|
||||||
sudo apt-get install --yes musl-tools
|
sudo apt-get install --yes musl-tools
|
||||||
if: steps.determine-cross-compile.outputs.needs-cross != 'true' && contains(inputs.target, 'musl')
|
if: steps.determine-cross-compile.outputs.needs-cross != 'true' && contains(inputs.target, 'musl')
|
||||||
|
|
||||||
- name: Set build command
|
- name: Set build command
|
||||||
id: set-build-command
|
id: set-build-command
|
||||||
shell: bash
|
shell: bash
|
||||||
run: set-build-command.sh ${{ steps.set-cross-dir.outputs.cross-dir }}
|
run: set-build-command.sh ${{ steps.set-cross-dir.outputs.cross-dir }}
|
||||||
|
|
||||||
- name: Determine which cargo commands to run
|
- name: Determine which cargo commands to run
|
||||||
id: determine-cargo-commands
|
id: determine-cargo-commands
|
||||||
shell: bash
|
shell: bash
|
||||||
run: determine-cargo-commands.sh ${{ inputs.command }}
|
run: determine-cargo-commands.sh ${{ inputs.command }}
|
||||||
|
|
||||||
- name: Parse `rust-cache-parameters` and set inputs for `Swatinem/rust-cache@v2`
|
- name: Parse `rust-cache-parameters` and set inputs for `Swatinem/rust-cache@v2`
|
||||||
id: parse-rust-cache-parameters
|
id: parse-rust-cache-parameters
|
||||||
shell: bash
|
shell: bash
|
||||||
@@ -144,50 +185,42 @@ runs:
|
|||||||
env:
|
env:
|
||||||
RUST_CACHE_PARAMETERS: ${{ inputs.rust-cache-parameters }}
|
RUST_CACHE_PARAMETERS: ${{ inputs.rust-cache-parameters }}
|
||||||
if: inputs.use-rust-cache == 'true'
|
if: inputs.use-rust-cache == 'true'
|
||||||
|
|
||||||
- name: Cache cargo & target directories
|
- name: Cache cargo & target directories
|
||||||
uses: Swatinem/rust-cache@v2
|
uses: Swatinem/rust-cache@v2
|
||||||
with: ${{ steps.parse-rust-cache-parameters.outputs }}
|
with: ${{ steps.parse-rust-cache-parameters.outputs }}
|
||||||
if: inputs.use-rust-cache == 'true'
|
if: inputs.use-rust-cache == 'true'
|
||||||
- name: Run tests (*nix)
|
|
||||||
|
- name: Run cargo test
|
||||||
working-directory: ${{ inputs.working-directory }}
|
working-directory: ${{ inputs.working-directory }}
|
||||||
shell: bash
|
# We want to run in Powershell on Windows to make sure we compile in a native Windows
|
||||||
|
# environment. Some things won't compile properly under msys, notably OpenSSL, which is
|
||||||
|
# compiled locally when using the `openssl` crate with the `vendored` feature.
|
||||||
|
shell: ${{ runner.os == 'Windows' && 'powershell' || 'bash' }}
|
||||||
run: |
|
run: |
|
||||||
${{ steps.set-build-command.outputs.build-command }} +${{inputs.toolchain}} test --target ${{ inputs.target }} ${{ inputs.args }}
|
${{ steps.set-build-command.outputs.build-command }} test --target ${{ inputs.target }} ${{ inputs.args }}
|
||||||
if: steps.determine-cargo-commands.outputs.test == 'true' && runner.os != 'Windows'
|
if: steps.determine-cargo-commands.outputs.test == 'true'
|
||||||
# We want to run in Powershell on Windows to make sure we compile in a
|
|
||||||
# native Windows environment. Some things won't compile properly under
|
- name: Run cargo build
|
||||||
# msys, notably OpenSSL, which is compiled locally when using the
|
|
||||||
# `openssl` crate with the `vendored` feature.
|
|
||||||
- name: Run tests (Windows)
|
|
||||||
working-directory: ${{ inputs.working-directory }}
|
working-directory: ${{ inputs.working-directory }}
|
||||||
shell: powershell
|
# We want to run in Powershell on Windows to make sure we compile in a native Windows
|
||||||
|
# environment. Some things won't compile properly under msys, notably OpenSSL, which is
|
||||||
|
# compiled locally when using the `openssl` crate with the `vendored` feature.
|
||||||
|
shell: ${{ runner.os == 'Windows' && 'powershell' || 'bash' }}
|
||||||
run: |
|
run: |
|
||||||
& ${{ steps.set-build-command.outputs.build-command }} +${{inputs.toolchain}} test --target ${{ inputs.target }} ${{ inputs.args }}
|
${{ steps.set-build-command.outputs.build-command }} build --target ${{ inputs.target }} ${{ inputs.args }}
|
||||||
if: steps.determine-cargo-commands.outputs.test == 'true' && runner.os == 'Windows'
|
if: steps.determine-cargo-commands.outputs.build == 'true'
|
||||||
- name: Run benchmarks (*nix)
|
|
||||||
|
- name: Run cargo ${{ steps.determine-cargo-commands.outputs.command }}
|
||||||
working-directory: ${{ inputs.working-directory }}
|
working-directory: ${{ inputs.working-directory }}
|
||||||
shell: bash
|
# We want to run in Powershell on Windows to make sure we compile in a native Windows
|
||||||
|
# environment. Some things won't compile properly under msys, notably OpenSSL, which is
|
||||||
|
# compiled locally when using the `openssl` crate with the `vendored` feature.
|
||||||
|
shell: ${{ runner.os == 'Windows' && 'powershell' || 'bash' }}
|
||||||
run: |
|
run: |
|
||||||
${{ steps.set-build-command.outputs.build-command }} +${{inputs.toolchain}} bench --target ${{ inputs.target }} ${{ inputs.args }}
|
${{ steps.set-build-command.outputs.build-command }} ${{ steps.determine-cargo-commands.outputs.command }} --target ${{ inputs.target }} ${{ inputs.args }}
|
||||||
if: steps.determine-cargo-commands.outputs.bench == 'true' && runner.os != 'Windows'
|
if: steps.determine-cargo-commands.outputs.command != ''
|
||||||
- name: Run benchmarks (Windows)
|
|
||||||
working-directory: ${{ inputs.working-directory }}
|
|
||||||
shell: powershell
|
|
||||||
run: |
|
|
||||||
& ${{ steps.set-build-command.outputs.build-command }} +${{inputs.toolchain}} bench --target ${{ inputs.target }} ${{ inputs.args }}
|
|
||||||
if: steps.determine-cargo-commands.outputs.bench == 'true' && runner.os == 'Windows'
|
|
||||||
- name: Build binary (*nix)
|
|
||||||
working-directory: ${{ inputs.working-directory }}
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
${{ steps.set-build-command.outputs.build-command }} +${{inputs.toolchain}} build ${{ inputs.args }} --target ${{ inputs.target }}
|
|
||||||
if: steps.determine-cargo-commands.outputs.build == 'true' && runner.os != 'Windows'
|
|
||||||
- name: Build binary (Windows)
|
|
||||||
working-directory: ${{ inputs.working-directory }}
|
|
||||||
shell: powershell
|
|
||||||
run: |
|
|
||||||
& ${{ steps.set-build-command.outputs.build-command }} +${{inputs.toolchain}} build ${{ inputs.args }} --target ${{ inputs.target }}
|
|
||||||
if: steps.determine-cargo-commands.outputs.build == 'true' && runner.os == 'Windows'
|
|
||||||
- name: Strip binary
|
- name: Strip binary
|
||||||
working-directory: ${{ inputs.working-directory }}
|
working-directory: ${{ inputs.working-directory }}
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|||||||
@@ -9,5 +9,5 @@ if [ "$COMMAND" == 'both' ]; then
|
|||||||
echo "build=true" >>"$GITHUB_OUTPUT"
|
echo "build=true" >>"$GITHUB_OUTPUT"
|
||||||
echo "test=true" >>"$GITHUB_OUTPUT"
|
echo "test=true" >>"$GITHUB_OUTPUT"
|
||||||
else
|
else
|
||||||
echo "$COMMAND=true" >>"$GITHUB_OUTPUT"
|
echo "command=$COMMAND" >>"$GITHUB_OUTPUT"
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ def main():
|
|||||||
file = os.environ["GITHUB_OUTPUT"]
|
file = os.environ["GITHUB_OUTPUT"]
|
||||||
with open(file, "w") as f:
|
with open(file, "w") as f:
|
||||||
for key, value in parameters.items():
|
for key, value in parameters.items():
|
||||||
f.write(f"{key}={value}")
|
f.write(f"{key}={value}\n")
|
||||||
|
|
||||||
|
|
||||||
def get_file_hash(build_command):
|
def get_file_hash(build_command):
|
||||||
|
|||||||
171
run-tests/Cargo.lock
generated
171
run-tests/Cargo.lock
generated
@@ -4,18 +4,18 @@ version = 4
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "aho-corasick"
|
name = "aho-corasick"
|
||||||
version = "1.1.3"
|
version = "1.1.4"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916"
|
checksum = "ddd31a130427c27518df266943a5308ed92d4b226cc639f5a8f1002816174301"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"memchr",
|
"memchr",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "anstream"
|
name = "anstream"
|
||||||
version = "0.6.18"
|
version = "0.6.21"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "8acc5369981196006228e28809f761875c0327210a891e941f4c683b3a99529b"
|
checksum = "43d5b281e737544384e969a5ccad3f1cdd24b48086a0fc1b2a5262a26b8f4f4a"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anstyle",
|
"anstyle",
|
||||||
"anstyle-parse",
|
"anstyle-parse",
|
||||||
@@ -28,43 +28,44 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "anstyle"
|
name = "anstyle"
|
||||||
version = "1.0.10"
|
version = "1.0.13"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "55cc3b69f167a1ef2e161439aa98aed94e6028e5f9a59be9a6ffb47aef1651f9"
|
checksum = "5192cca8006f1fd4f7237516f40fa183bb07f8fbdfedaa0036de5ea9b0b45e78"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "anstyle-parse"
|
name = "anstyle-parse"
|
||||||
version = "0.2.6"
|
version = "0.2.7"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "3b2d16507662817a6a20a9ea92df6652ee4f94f914589377d69f3b21bc5798a9"
|
checksum = "4e7644824f0aa2c7b9384579234ef10eb7efb6a0deb83f9630a49594dd9c15c2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"utf8parse",
|
"utf8parse",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "anstyle-query"
|
name = "anstyle-query"
|
||||||
version = "1.1.2"
|
version = "1.1.5"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "79947af37f4177cfead1110013d678905c37501914fba0efea834c3fe9a8d60c"
|
checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"windows-sys",
|
"windows-sys 0.61.2",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "anstyle-wincon"
|
name = "anstyle-wincon"
|
||||||
version = "3.0.6"
|
version = "3.0.11"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "2109dbce0e72be3ec00bed26e6a7479ca384ad226efdd66db8fa2e3a38c83125"
|
checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anstyle",
|
"anstyle",
|
||||||
"windows-sys",
|
"once_cell_polyfill",
|
||||||
|
"windows-sys 0.61.2",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "clap"
|
name = "clap"
|
||||||
version = "4.5.23"
|
version = "4.5.53"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "3135e7ec2ef7b10c6ed8950f0f792ed96ee093fa088608f1c76e569722700c84"
|
checksum = "c9e340e012a1bf4935f5282ed1436d1489548e8f72308207ea5df0e23d2d03f8"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"clap_builder",
|
"clap_builder",
|
||||||
"clap_derive",
|
"clap_derive",
|
||||||
@@ -72,9 +73,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "clap_builder"
|
name = "clap_builder"
|
||||||
version = "4.5.23"
|
version = "4.5.53"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "30582fc632330df2bd26877bde0c1f4470d57c582bbc070376afcd04d8cb4838"
|
checksum = "d76b5d13eaa18c901fd2f7fca939fefe3a0727a953561fefdf3b2922b8569d00"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anstream",
|
"anstream",
|
||||||
"anstyle",
|
"anstyle",
|
||||||
@@ -84,9 +85,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "clap_derive"
|
name = "clap_derive"
|
||||||
version = "4.5.18"
|
version = "4.5.49"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "4ac6a0c7b1a9e9a5186361f67dfa1b88213572f427fb9ab038efb2bd8c582dab"
|
checksum = "2a0b5487afeab2deb2ff4e03a807ad1a03ac532ff5a2cee5d86884440c7f7671"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"heck",
|
"heck",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
@@ -96,15 +97,15 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "clap_lex"
|
name = "clap_lex"
|
||||||
version = "0.7.4"
|
version = "0.7.6"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "f46ad14479a25103f283c0f10005961cf086d8dc42205bb44c46ac563475dca6"
|
checksum = "a1d728cc89cf3aee9ff92b05e62b19ee65a02b5702cff7d5a377e32c6ae29d8d"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "colorchoice"
|
name = "colorchoice"
|
||||||
version = "1.0.3"
|
version = "1.0.4"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "5b63caa9aa9397e2d9480a9b13673856c78d8ac123288526c37d7839f2a86990"
|
checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "heck"
|
name = "heck"
|
||||||
@@ -114,48 +115,54 @@ checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "is_executable"
|
name = "is_executable"
|
||||||
version = "1.0.4"
|
version = "1.0.5"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "d4a1b5bad6f9072935961dfbf1cced2f3d129963d091b6f69f007fe04e758ae2"
|
checksum = "baabb8b4867b26294d818bf3f651a454b6901431711abb96e296245888d6e8c4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"winapi",
|
"windows-sys 0.60.2",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "is_terminal_polyfill"
|
name = "is_terminal_polyfill"
|
||||||
version = "1.70.1"
|
version = "1.70.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf"
|
checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "memchr"
|
name = "memchr"
|
||||||
version = "2.7.4"
|
version = "2.7.6"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3"
|
checksum = "f52b00d39961fc5b2736ea853c9cc86238e165017a493d1d5c8eac6bdc4cc273"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "once_cell_polyfill"
|
||||||
|
version = "1.70.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "proc-macro2"
|
name = "proc-macro2"
|
||||||
version = "1.0.92"
|
version = "1.0.103"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "37d3544b3f2748c54e147655edb5025752e2303145b5aefb3c3ea2c78b973bb0"
|
checksum = "5ee95bc4ef87b8d5ba32e8b7714ccc834865276eab0aed5c9958d00ec45f49e8"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"unicode-ident",
|
"unicode-ident",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "quote"
|
name = "quote"
|
||||||
version = "1.0.37"
|
version = "1.0.42"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af"
|
checksum = "a338cc41d27e6cc6dce6cefc13a0729dfbb81c262b1f519331575dd80ef3067f"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "regex"
|
name = "regex"
|
||||||
version = "1.11.1"
|
version = "1.12.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191"
|
checksum = "843bc0191f75f3e22651ae5f1e72939ab2f72a4bc30fa80a066bd66edefc24d4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"aho-corasick",
|
"aho-corasick",
|
||||||
"memchr",
|
"memchr",
|
||||||
@@ -165,9 +172,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "regex-automata"
|
name = "regex-automata"
|
||||||
version = "0.4.9"
|
version = "0.4.13"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908"
|
checksum = "5276caf25ac86c8d810222b3dbb938e512c55c6831a10f3e6ed1c93b84041f1c"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"aho-corasick",
|
"aho-corasick",
|
||||||
"memchr",
|
"memchr",
|
||||||
@@ -176,9 +183,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "regex-syntax"
|
name = "regex-syntax"
|
||||||
version = "0.8.5"
|
version = "0.8.8"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c"
|
checksum = "7a2d987857b319362043e95f5353c0535c1f58eec5336fdfcf626430af7def58"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "run-tests"
|
name = "run-tests"
|
||||||
@@ -197,9 +204,9 @@ checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "syn"
|
name = "syn"
|
||||||
version = "2.0.90"
|
version = "2.0.111"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "919d3b74a5dd0ccd15aeb8f93e7006bd9e14c295087c9896a110f490752bcf31"
|
checksum = "390cc9a294ab71bdb1aa2e99d13be9c753cd2d7bd6560c77118597410c4d2e87"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
@@ -208,9 +215,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "unicode-ident"
|
name = "unicode-ident"
|
||||||
version = "1.0.14"
|
version = "1.0.22"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "adb9e6ca4f869e1180728b7950e35922a7fc6397f7b641499e8f3ef06e50dc83"
|
checksum = "9312f7c4f6ff9069b165498234ce8be658059c6728633667c526e27dc2cf1df5"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "utf8parse"
|
name = "utf8parse"
|
||||||
@@ -219,42 +226,36 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821"
|
checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "winapi"
|
name = "windows-link"
|
||||||
version = "0.3.9"
|
version = "0.2.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
|
checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5"
|
||||||
dependencies = [
|
|
||||||
"winapi-i686-pc-windows-gnu",
|
|
||||||
"winapi-x86_64-pc-windows-gnu",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "winapi-i686-pc-windows-gnu"
|
|
||||||
version = "0.4.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "winapi-x86_64-pc-windows-gnu"
|
|
||||||
version = "0.4.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows-sys"
|
name = "windows-sys"
|
||||||
version = "0.59.0"
|
version = "0.60.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b"
|
checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"windows-targets",
|
"windows-targets",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows-targets"
|
name = "windows-sys"
|
||||||
version = "0.52.6"
|
version = "0.61.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973"
|
checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"windows-link",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows-targets"
|
||||||
|
version = "0.53.5"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "4945f9f551b88e0d65f3db0bc25c33b8acea4d9e41163edf90dcd0b19f9069f3"
|
||||||
|
dependencies = [
|
||||||
|
"windows-link",
|
||||||
"windows_aarch64_gnullvm",
|
"windows_aarch64_gnullvm",
|
||||||
"windows_aarch64_msvc",
|
"windows_aarch64_msvc",
|
||||||
"windows_i686_gnu",
|
"windows_i686_gnu",
|
||||||
@@ -267,48 +268,48 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows_aarch64_gnullvm"
|
name = "windows_aarch64_gnullvm"
|
||||||
version = "0.52.6"
|
version = "0.53.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3"
|
checksum = "a9d8416fa8b42f5c947f8482c43e7d89e73a173cead56d044f6a56104a6d1b53"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows_aarch64_msvc"
|
name = "windows_aarch64_msvc"
|
||||||
version = "0.52.6"
|
version = "0.53.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469"
|
checksum = "b9d782e804c2f632e395708e99a94275910eb9100b2114651e04744e9b125006"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows_i686_gnu"
|
name = "windows_i686_gnu"
|
||||||
version = "0.52.6"
|
version = "0.53.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b"
|
checksum = "960e6da069d81e09becb0ca57a65220ddff016ff2d6af6a223cf372a506593a3"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows_i686_gnullvm"
|
name = "windows_i686_gnullvm"
|
||||||
version = "0.52.6"
|
version = "0.53.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66"
|
checksum = "fa7359d10048f68ab8b09fa71c3daccfb0e9b559aed648a8f95469c27057180c"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows_i686_msvc"
|
name = "windows_i686_msvc"
|
||||||
version = "0.52.6"
|
version = "0.53.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66"
|
checksum = "1e7ac75179f18232fe9c285163565a57ef8d3c89254a30685b57d83a38d326c2"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows_x86_64_gnu"
|
name = "windows_x86_64_gnu"
|
||||||
version = "0.52.6"
|
version = "0.53.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78"
|
checksum = "9c3842cdd74a865a8066ab39c8a7a473c0778a3f29370b5fd6b4b9aa7df4a499"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows_x86_64_gnullvm"
|
name = "windows_x86_64_gnullvm"
|
||||||
version = "0.52.6"
|
version = "0.53.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d"
|
checksum = "0ffa179e2d07eee8ad8f57493436566c7cc30ac536a3379fdf008f47f6bb7ae1"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows_x86_64_msvc"
|
name = "windows_x86_64_msvc"
|
||||||
version = "0.52.6"
|
version = "0.53.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
|
checksum = "d6bbff5f0aada427a1e5a6da5f1f98158182f26556f345ac9e04d36d0ebed650"
|
||||||
|
|||||||
@@ -4,6 +4,6 @@ version = "0.1.0"
|
|||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
clap = { version = "4.5.23", features = ["derive"] }
|
clap = { version = "4.5.53", features = ["derive"] }
|
||||||
is_executable = "1.0.4"
|
is_executable = "1.0.5"
|
||||||
regex = "1.11.1"
|
regex = "1.12.2"
|
||||||
|
|||||||
@@ -79,7 +79,11 @@ fn check_cross(bin_dir: &Path, expect_cross: bool, expect_cross_version: Option<
|
|||||||
let cross_path = bin_dir.join("cross");
|
let cross_path = bin_dir.join("cross");
|
||||||
|
|
||||||
if expect_cross {
|
if expect_cross {
|
||||||
assert!(cross_path.is_file(), "`cross` exists");
|
assert!(
|
||||||
|
cross_path.is_file(),
|
||||||
|
"`cross` exists at {}",
|
||||||
|
cross_path.display()
|
||||||
|
);
|
||||||
|
|
||||||
if let Some(expected_version) = expect_cross_version {
|
if let Some(expected_version) = expect_cross_version {
|
||||||
let output = Command::new(&cross_path)
|
let output = Command::new(&cross_path)
|
||||||
@@ -90,7 +94,7 @@ fn check_cross(bin_dir: &Path, expect_cross: bool, expect_cross_version: Option<
|
|||||||
.expect("`cross --version` stdout was not valid UTF-8");
|
.expect("`cross --version` stdout was not valid UTF-8");
|
||||||
assert!(
|
assert!(
|
||||||
version.contains(expected_version),
|
version.contains(expected_version),
|
||||||
"`cross` version matches expected version"
|
"`cross` version matches expected version: {expected_version}",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -118,12 +122,16 @@ fn check_binary(bin_path: &PathBuf, expect_file_re: Option<&str>, expect_strippe
|
|||||||
.output()
|
.output()
|
||||||
.expect("Failed to execute `file` command");
|
.expect("Failed to execute `file` command");
|
||||||
let file_output = String::from_utf8_lossy(&output.stdout);
|
let file_output = String::from_utf8_lossy(&output.stdout);
|
||||||
|
println!(
|
||||||
|
"output from `file` for {}: {file_output}",
|
||||||
|
bin_path.display(),
|
||||||
|
);
|
||||||
|
|
||||||
if let Some(file_re) = expect_file_re {
|
if let Some(file_re) = expect_file_re {
|
||||||
let re = Regex::new(file_re).expect("Invalid regex");
|
let re = Regex::new(file_re).expect("Invalid regex");
|
||||||
assert!(
|
assert!(
|
||||||
re.is_match(&file_output),
|
re.is_match(&file_output),
|
||||||
"`file` output for {} matches expected output",
|
"`file` output for {} matches `{file_re}`: `{file_output}`",
|
||||||
bin_path.display(),
|
bin_path.display(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -136,24 +144,24 @@ fn check_binary(bin_path: &PathBuf, expect_file_re: Option<&str>, expect_strippe
|
|||||||
if expect_stripped {
|
if expect_stripped {
|
||||||
assert!(
|
assert!(
|
||||||
!file_output.contains("not stripped"),
|
!file_output.contains("not stripped"),
|
||||||
"`file` does not report {} as not stripped",
|
"`file` does not report {} as 'not stripped': `{file_output}`",
|
||||||
bin_path.display(),
|
bin_path.display(),
|
||||||
);
|
);
|
||||||
assert!(
|
assert!(
|
||||||
file_output.contains("stripped"),
|
file_output.contains("stripped"),
|
||||||
"`file` reports {} as stripped",
|
"`file` reports {} as 'stripped': `{file_output}`",
|
||||||
bin_path.display(),
|
bin_path.display(),
|
||||||
);
|
);
|
||||||
} else if cfg!(windows) {
|
} else if cfg!(windows) {
|
||||||
assert!(
|
assert!(
|
||||||
!file_output.contains("stripped"),
|
!file_output.contains("stripped"),
|
||||||
"`file` does not report {} as stripped",
|
"`file` does not report {} as 'stripped': `{file_output}`",
|
||||||
bin_path.display(),
|
bin_path.display(),
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
assert!(
|
assert!(
|
||||||
file_output.contains("not stripped"),
|
file_output.contains("not stripped"),
|
||||||
"`file` reports {} as not stripped",
|
"`file` reports {} as 'not stripped': `{file_output}`",
|
||||||
bin_path.display(),
|
bin_path.display(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,12 +16,20 @@ def main() -> int:
|
|||||||
Returns:
|
Returns:
|
||||||
Exit code (0 for success)
|
Exit code (0 for success)
|
||||||
"""
|
"""
|
||||||
if len(sys.argv) < 2:
|
if len(sys.argv) < 3:
|
||||||
print("Error: Target architecture argument is required", file=sys.stderr)
|
print(
|
||||||
|
"Error: Target architecture and force cross arguments are required",
|
||||||
|
file=sys.stderr,
|
||||||
|
)
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
target = sys.argv[1]
|
target = sys.argv[1]
|
||||||
needs_cross = check_needs_cross(target)
|
force_use_cross = sys.argv[2]
|
||||||
|
if force_use_cross == "true":
|
||||||
|
needs_cross = True
|
||||||
|
else:
|
||||||
|
needs_cross = check_needs_cross(target)
|
||||||
|
|
||||||
write_github_output(needs_cross)
|
write_github_output(needs_cross)
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
@@ -53,6 +61,10 @@ def check_needs_cross(target: str) -> bool:
|
|||||||
):
|
):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
# It's tempting to not use cross when the host is Linux x86-64 and we're compiling for Linux
|
||||||
|
# i586 or i686. This sort of works, but if there's any C being compiled, things get weird,
|
||||||
|
# because then we need 32-bit C headers, 32-bit C libs to link to, etc.
|
||||||
|
|
||||||
# Check if both host and target are ARM Linux. I'm assuming here that for things like
|
# Check if both host and target are ARM Linux. I'm assuming here that for things like
|
||||||
# "arm-linux-androideabi" or "armv7-unknown-linux-ohos" we'd still need cross.
|
# "arm-linux-androideabi" or "armv7-unknown-linux-ohos" we'd still need cross.
|
||||||
if (
|
if (
|
||||||
|
|||||||
@@ -9,6 +9,8 @@ from typing import Dict, List, Union
|
|||||||
import tempfile
|
import tempfile
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
|
boolean_flags = {"cache_cross_binary", "force_use_cross", "strip", "use_rust_cache"}
|
||||||
|
|
||||||
|
|
||||||
class InputValidator:
|
class InputValidator:
|
||||||
"""Validate inputs for a GitHub Action."""
|
"""Validate inputs for a GitHub Action."""
|
||||||
@@ -40,22 +42,6 @@ class InputValidator:
|
|||||||
if "target" not in self.inputs:
|
if "target" not in self.inputs:
|
||||||
validation_errors.append("'target' is a required parameter")
|
validation_errors.append("'target' is a required parameter")
|
||||||
|
|
||||||
# Validate command if present
|
|
||||||
if "command" in self.inputs:
|
|
||||||
valid_commands = {"build", "test", "both", "bench"}
|
|
||||||
if self.inputs["command"] not in valid_commands:
|
|
||||||
validation_errors.append(
|
|
||||||
f"Invalid 'command'. Must be one of {sorted(valid_commands)}"
|
|
||||||
)
|
|
||||||
|
|
||||||
# Validate toolchain if present
|
|
||||||
if "toolchain" in self.inputs:
|
|
||||||
valid_toolchains = {"stable", "beta", "nightly"}
|
|
||||||
if self.inputs["toolchain"] not in valid_toolchains:
|
|
||||||
validation_errors.append(
|
|
||||||
f"Invalid 'toolchain'. Must be one of {sorted(valid_toolchains)}"
|
|
||||||
)
|
|
||||||
|
|
||||||
# Validate working directory if present
|
# Validate working directory if present
|
||||||
if "working_directory" in self.inputs:
|
if "working_directory" in self.inputs:
|
||||||
path = Path(self.inputs["working_directory"])
|
path = Path(self.inputs["working_directory"])
|
||||||
@@ -72,10 +58,11 @@ class InputValidator:
|
|||||||
)
|
)
|
||||||
|
|
||||||
# Validate boolean flags
|
# Validate boolean flags
|
||||||
boolean_flags = {"cache_cross_binary", "strip", "use_rust_cache"}
|
|
||||||
for flag in boolean_flags:
|
for flag in boolean_flags:
|
||||||
if flag in self.inputs and self.inputs[flag] not in {"true", "false"}:
|
if flag in self.inputs and self.inputs[flag] not in {"true", "false"}:
|
||||||
validation_errors.append(f"'{flag}' must be either 'true' or 'false'")
|
# Turn the underscores into dashes
|
||||||
|
dashes = flag.replace("_", "-")
|
||||||
|
validation_errors.append(f"'{dashes}' must be either 'true' or 'false'")
|
||||||
|
|
||||||
# Validate rust-cache-parameters JSON if present
|
# Validate rust-cache-parameters JSON if present
|
||||||
if "rust_cache_parameters" in self.inputs:
|
if "rust_cache_parameters" in self.inputs:
|
||||||
@@ -140,26 +127,15 @@ class TestInputValidator(unittest.TestCase):
|
|||||||
errors = validator.validate()
|
errors = validator.validate()
|
||||||
self.assertTrue(errors)
|
self.assertTrue(errors)
|
||||||
|
|
||||||
def test_validate_valid_command(self) -> None:
|
|
||||||
"""Test validation of valid commands."""
|
|
||||||
valid_commands = ["build", "test", "both", "bench"]
|
|
||||||
|
|
||||||
for command in valid_commands:
|
|
||||||
self.setup_env({"target": "x86_64-unknown-linux-gnu", "command": command})
|
|
||||||
validator = InputValidator("/root")
|
|
||||||
errors = validator.validate()
|
|
||||||
self.assertFalse(errors, f"Command '{command}' should be valid")
|
|
||||||
|
|
||||||
def test_validate_invalid_command(self) -> None:
|
|
||||||
"""Test validation of invalid command."""
|
|
||||||
self.setup_env({"target": "x86_64-unknown-linux-gnu", "command": "invalid"})
|
|
||||||
validator = InputValidator("/root")
|
|
||||||
errors = validator.validate()
|
|
||||||
self.assertTrue(errors)
|
|
||||||
|
|
||||||
def test_validate_valid_toolchain(self) -> None:
|
def test_validate_valid_toolchain(self) -> None:
|
||||||
"""Test validation of valid toolchains."""
|
"""Test validation of valid toolchains."""
|
||||||
valid_toolchains = ["stable", "beta", "nightly"]
|
valid_toolchains = [
|
||||||
|
"stable",
|
||||||
|
"beta",
|
||||||
|
"nightly",
|
||||||
|
"nightly-2025-03-17",
|
||||||
|
"stable 8 weeks ago",
|
||||||
|
]
|
||||||
|
|
||||||
for toolchain in valid_toolchains:
|
for toolchain in valid_toolchains:
|
||||||
self.setup_env(
|
self.setup_env(
|
||||||
@@ -169,13 +145,6 @@ class TestInputValidator(unittest.TestCase):
|
|||||||
errors = validator.validate()
|
errors = validator.validate()
|
||||||
self.assertFalse(errors, f"Toolchain '{toolchain}' should be valid")
|
self.assertFalse(errors, f"Toolchain '{toolchain}' should be valid")
|
||||||
|
|
||||||
def test_validate_invalid_toolchain(self) -> None:
|
|
||||||
"""Test validation of invalid toolchain."""
|
|
||||||
self.setup_env({"target": "x86_64-unknown-linux-gnu", "toolchain": "unknown"})
|
|
||||||
validator = InputValidator("/root")
|
|
||||||
errors = validator.validate()
|
|
||||||
self.assertTrue(errors)
|
|
||||||
|
|
||||||
def test_validate_working_directory(self) -> None:
|
def test_validate_working_directory(self) -> None:
|
||||||
"""Test validation of working directory."""
|
"""Test validation of working directory."""
|
||||||
with tempfile.TemporaryDirectory() as temp_dir:
|
with tempfile.TemporaryDirectory() as temp_dir:
|
||||||
@@ -212,7 +181,6 @@ class TestInputValidator(unittest.TestCase):
|
|||||||
|
|
||||||
def test_validate_boolean_flags(self) -> None:
|
def test_validate_boolean_flags(self) -> None:
|
||||||
"""Test validation of boolean flags."""
|
"""Test validation of boolean flags."""
|
||||||
boolean_flags = ["cache-cross-binary", "strip", "use-rust-cache"]
|
|
||||||
|
|
||||||
# Test valid boolean values
|
# Test valid boolean values
|
||||||
for flag in boolean_flags:
|
for flag in boolean_flags:
|
||||||
|
|||||||
Reference in New Issue
Block a user