Files
actions-rust-cross/.github/workflows/test.yml
Dave Rolsky 9a1618ffb7
Some checks failed
Lint / Check that code is lint clean using precious (push) Failing after 0s
Self-test / Test action (map[cache-cross-binary:false can-execute:true cross-version:19be834 expect-cross:--expect-cross expect-cross-version:19be834 expect-file-re:aarch64 expect-stripped: name:Linux-aarch64 with cross 19be834 (no cache) runs-on:ubuntu-24.04 targ… (push) Failing after 0s
Self-test / Test action (map[cache-cross-binary:false can-execute:true cross-version:v0.2.3 expect-cross:--expect-cross expect-cross-version:0.2.3 expect-file-re:aarch64 expect-stripped: name:Linux-aarch64 with cross v0.2.3 (no cache) runs-on:ubuntu-24.04 target:a… (push) Failing after 0s
Self-test / Test action (map[cache-cross-binary:false can-execute:true expect-cross:--expect-cross expect-file-re:aarch64 expect-stripped: name:Linux-aarch64 (no cache) runs-on:ubuntu-24.04 target:aarch64-unknown-linux-gnu]) (push) Failing after 0s
Self-test / Test action (map[cache-cross-binary:true can-execute:false expect-cross:--expect-cross expect-file-re:x86-64.+FreeBSD expect-stripped: name:FreeBSD-x86_64 runs-on:ubuntu-24.04 target:x86_64-unknown-freebsd]) (push) Failing after 0s
Self-test / Test action (map[cache-cross-binary:true can-execute:false expect-cross:--expect-cross expect-file-re:x86-64.+NetBSD expect-stripped: name:NetBSD-x86_64 runs-on:ubuntu-24.04 target:x86_64-unknown-netbsd]) (push) Failing after 0s
Self-test / Test action (map[cache-cross-binary:true can-execute:true cross-version:19be834 expect-cross:--expect-cross expect-cross-version:19be834 expect-file-re:aarch64 expect-stripped: name:Linux-aarch64 with cross 19be834 runs-on:ubuntu-24.04 target:aarch64-u… (push) Failing after 0s
Self-test / Test action (map[cache-cross-binary:true can-execute:true cross-version:v0.2.3 expect-cross:--expect-cross expect-cross-version:0.2.3 expect-file-re:aarch64 expect-stripped: name:Linux-aarch64 with cross v0.2.3 runs-on:ubuntu-24.04 target:aarch64-unkno… (push) Failing after 0s
Self-test / Test action (map[cache-cross-binary:true can-execute:true expect-cross: expect-file-re:ELF.+x86-64 expect-stripped:--expect-stripped name:Linux-x86_64 (beta) runs-on:ubuntu-24.04 target:x86_64-unknown-linux-musl toolchain:beta]) (push) Failing after 0s
Self-test / Test action (map[cache-cross-binary:true can-execute:true expect-cross: expect-file-re:ELF.+x86-64 expect-stripped:--expect-stripped name:Linux-x86_64 (nightly) runs-on:ubuntu-24.04 target:x86_64-unknown-linux-musl toolchain:nightly]) (push) Failing after 0s
Self-test / Test action (map[cache-cross-binary:true can-execute:true expect-cross: expect-file-re:ELF.+x86-64 expect-stripped:--expect-stripped name:Linux-x86_64 (stable 8 months ago) runs-on:ubuntu-24.04 target:x86_64-unknown-linux-gnu toolchain:stable 8 months … (push) Failing after 0s
Self-test / Test action (map[cache-cross-binary:true can-execute:true expect-cross: expect-file-re:ELF.+x86-64 expect-stripped:--expect-stripped name:Linux-x86_64 runs-on:ubuntu-24.04 target:x86_64-unknown-linux-musl]) (push) Failing after 0s
Self-test / Test action (map[cache-cross-binary:true can-execute:true expect-cross:--expect-cross expect-file-re:32.+ARM expect-stripped: name:Linux-arm runs-on:ubuntu-24.04 target:arm-unknown-linux-gnueabi]) (push) Failing after 0s
Self-test / Test action (map[cache-cross-binary:true can-execute:true expect-cross:--expect-cross expect-file-re:32.+PowerPC expect-stripped: name:Linux-powerpc runs-on:ubuntu-24.04 target:powerpc-unknown-linux-gnu]) (push) Failing after 0s
Self-test / Test action (map[cache-cross-binary:true can-execute:true expect-cross:--expect-cross expect-file-re:64.+PowerPC expect-stripped: name:Linux-powerpc64 runs-on:ubuntu-24.04 target:powerpc64-unknown-linux-gnu]) (push) Failing after 0s
Self-test / Test action (map[cache-cross-binary:true can-execute:true expect-cross:--expect-cross expect-file-re:64.+PowerPC expect-stripped: name:Linux-powerpc64le runs-on:ubuntu-24.04 target:powerpc64le-unknown-linux-gnu]) (push) Failing after 0s
Self-test / Test action (map[cache-cross-binary:true can-execute:true expect-cross:--expect-cross expect-file-re:64.+RISC-V expect-stripped: name:Linux-riscv64 runs-on:ubuntu-24.04 target:riscv64gc-unknown-linux-gnu]) (push) Failing after 0s
Self-test / Test action (map[cache-cross-binary:true can-execute:true expect-cross:--expect-cross expect-file-re:64.+S/390 expect-stripped: name:Linux-s390x runs-on:ubuntu-24.04 target:s390x-unknown-linux-gnu]) (push) Failing after 0s
Self-test / Test action (map[cache-cross-binary:true can-execute:true expect-cross:--expect-cross expect-file-re:ELF.+80386 expect-stripped: name:Linux-i586 runs-on:ubuntu-24.04 target:i586-unknown-linux-gnu]) (push) Failing after 0s
Self-test / Test action (map[cache-cross-binary:true can-execute:true expect-cross:--expect-cross expect-file-re:ELF.+80386 expect-stripped: name:Linux-i686 runs-on:ubuntu-24.04 target:i686-unknown-linux-gnu]) (push) Failing after 0s
Self-test / Test action (map[cache-cross-binary:true can-execute:true expect-cross:--expect-cross expect-file-re:ELF.+x86-64 expect-stripped: force-use-cross:true name:Linux-x86_64 (force cross) runs-on:ubuntu-24.04 target:x86_64-unknown-linux-gnu]) (push) Failing after 0s
Self-test / Test action (map[cache-cross-binary:true can-execute:true expect-cross:--expect-cross expect-file-re:aarch64 expect-stripped: name:Linux-aarch64 runs-on:ubuntu-24.04 target:aarch64-unknown-linux-musl]) (push) Failing after 0s
Self-test / Test validate-inputs (push) Failing after 0s
Self-test / Test a "cargo foo" command (push) Failing after 0s
Self-test / Test action (map[cache-cross-binary:true can-execute:false expect-cross: expect-file-re:Mach-O.+arm64 expect-stripped:--expect-stripped name:macOS-aarch64 runs-on:macOS-latest target:aarch64-apple-darwin]) (push) Has been cancelled
Self-test / Test action (map[cache-cross-binary:true can-execute:false expect-cross: expect-file-re:Windows.+ARM64 expect-stripped: name:Windows-aarch64 runs-on:windows-latest target:aarch64-pc-windows-msvc]) (push) Has been cancelled
Self-test / Test action (map[cache-cross-binary:true can-execute:true expect-cross: expect-file-re:Mach-O.+x86_64 expect-stripped:--expect-stripped name:macOS-x86_64 runs-on:macOS-latest target:x86_64-apple-darwin]) (push) Has been cancelled
Self-test / Test action (map[cache-cross-binary:true can-execute:true expect-cross: expect-file-re:Windows.+Intel i386 expect-stripped:--expect-stripped name:Windows-i686 runs-on:windows-latest target:i686-pc-windows-msvc]) (push) Has been cancelled
Self-test / Test action (map[cache-cross-binary:true can-execute:true expect-cross: expect-file-re:aarch64 expect-stripped:--expect-stripped name:Linux-aarch64 with arm64 host runs-on:ubuntu-24.04-arm target:aarch64-unknown-linux-gnu]) (push) Has been cancelled
Self-test / Test action (map[cache-cross-binary:true can-execute:true expect-file-re:Windows.+x86-64 expect-stripped:--expect-stripped name:Windows-x86_64 runs-on:windows-latest target:x86_64-pc-windows-msvc]) (push) Has been cancelled
Add a newline after each rust-cache parameter when running them to GITHUB_OUTPUT
This fixes a bug where setting anything in `rust-cache-parameters` caused the input to the
`rust-cache` to be broken.
2025-07-20 13:02:30 -05:00

446 lines
16 KiB
YAML

name: Self-test
on:
push:
pull_request:
jobs:
test-action:
name: Test action
strategy:
fail-fast: false
matrix:
platform:
- name: FreeBSD-x86_64
runs-on: ubuntu-24.04
target: x86_64-unknown-freebsd
cache-cross-binary: true
expect-file-re: "x86-64.+FreeBSD"
expect-cross: "--expect-cross"
expect-stripped: ""
can-execute: false
- name: Linux-x86_64
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
cache-cross-binary: true
expect-file-re: "ELF.+x86-64"
expect-cross: ""
expect-stripped: "--expect-stripped"
can-execute: true
- name: Linux-x86_64 (beta)
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
cache-cross-binary: true
expect-file-re: "aarch64"
expect-cross: "--expect-cross"
expect-stripped: ""
can-execute: true
- name: Linux-aarch64 (no cache)
runs-on: ubuntu-24.04
target: aarch64-unknown-linux-gnu
cache-cross-binary: false
expect-file-re: "aarch64"
expect-cross: "--expect-cross"
expect-stripped: ""
can-execute: true
- name: Linux-aarch64 with cross v0.2.3
runs-on: ubuntu-24.04
target: aarch64-unknown-linux-gnu
cross-version: "v0.2.3"
cache-cross-binary: true
expect-file-re: "aarch64"
expect-cross: "--expect-cross"
expect-cross-version: "0.2.3"
expect-stripped: ""
can-execute: true
- name: Linux-aarch64 with cross v0.2.3 (no cache)
runs-on: ubuntu-24.04
target: aarch64-unknown-linux-gnu
cross-version: "v0.2.3"
cache-cross-binary: false
expect-file-re: "aarch64"
expect-cross: "--expect-cross"
expect-cross-version: "0.2.3"
expect-stripped: ""
can-execute: true
- name: Linux-aarch64 with cross 19be834
runs-on: ubuntu-24.04
target: aarch64-unknown-linux-gnu
cross-version: "19be834"
cache-cross-binary: true
expect-file-re: "aarch64"
expect-cross: "--expect-cross"
expect-cross-version: "19be834"
expect-stripped: ""
can-execute: true
- name: Linux-aarch64 with cross 19be834 (no cache)
runs-on: ubuntu-24.04
target: aarch64-unknown-linux-gnu
cross-version: "19be834"
cache-cross-binary: false
expect-file-re: "aarch64"
expect-cross: "--expect-cross"
expect-cross-version: "19be834"
expect-stripped: ""
can-execute: true
- name: Linux-aarch64 with arm64 host
runs-on: ubuntu-24.04-arm
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
expect-file-re: "32.+ARM"
expect-cross: "--expect-cross"
expect-stripped: ""
can-execute: true
- name: Linux-i586
runs-on: ubuntu-24.04
target: i586-unknown-linux-gnu
cache-cross-binary: true
expect-file-re: "ELF.+80386"
expect-cross: "--expect-cross"
expect-stripped: ""
can-execute: true
- name: Linux-i686
runs-on: ubuntu-24.04
target: i686-unknown-linux-gnu
cache-cross-binary: true
expect-file-re: "ELF.+80386"
expect-cross: "--expect-cross"
expect-stripped: ""
can-execute: true
- name: Linux-powerpc
runs-on: ubuntu-24.04
target: powerpc-unknown-linux-gnu
cache-cross-binary: true
expect-file-re: "32.+PowerPC"
expect-cross: "--expect-cross"
expect-stripped: ""
can-execute: true
- name: Linux-powerpc64
runs-on: ubuntu-24.04
target: powerpc64-unknown-linux-gnu
cache-cross-binary: true
expect-file-re: "64.+PowerPC"
expect-cross: "--expect-cross"
expect-stripped: ""
can-execute: true
- name: Linux-powerpc64le
runs-on: ubuntu-24.04
target: powerpc64le-unknown-linux-gnu
cache-cross-binary: true
expect-file-re: "64.+PowerPC"
expect-cross: "--expect-cross"
expect-stripped: ""
can-execute: true
- name: Linux-riscv64
runs-on: ubuntu-24.04
target: riscv64gc-unknown-linux-gnu
cache-cross-binary: true
expect-file-re: "64.+RISC-V"
expect-cross: "--expect-cross"
expect-stripped: ""
can-execute: true
- name: Linux-s390x
runs-on: ubuntu-24.04
target: s390x-unknown-linux-gnu
cache-cross-binary: true
expect-file-re: "64.+S/390"
expect-cross: "--expect-cross"
expect-stripped: ""
can-execute: true
- name: NetBSD-x86_64
runs-on: ubuntu-24.04
target: x86_64-unknown-netbsd
cache-cross-binary: true
expect-file-re: "x86-64.+NetBSD"
expect-cross: "--expect-cross"
expect-stripped: ""
can-execute: false
- name: Windows-aarch64
runs-on: windows-latest
target: aarch64-pc-windows-msvc
cache-cross-binary: true
expect-file-re: "Windows.+ARM64"
expect-cross: ""
expect-stripped: ""
can-execute: false
- name: Windows-i686
runs-on: windows-latest
target: i686-pc-windows-msvc
cache-cross-binary: true
expect-file-re: "Windows.+Intel i386"
expect-cross: ""
expect-stripped: "--expect-stripped"
can-execute: true
- name: Windows-x86_64
runs-on: windows-latest
target: x86_64-pc-windows-msvc
cache-cross-binary: true
expect-file-re: "Windows.+x86-64"
expect-stripped: "--expect-stripped"
can-execute: true
- name: macOS-x86_64
runs-on: macOS-latest
target: x86_64-apple-darwin
cache-cross-binary: true
expect-file-re: "Mach-O.+x86_64"
expect-cross: ""
expect-stripped: "--expect-stripped"
can-execute: true
- name: macOS-aarch64
runs-on: macOS-latest
target: aarch64-apple-darwin
cache-cross-binary: true
expect-file-re: "Mach-O.+arm64"
expect-cross: ""
expect-stripped: "--expect-stripped"
can-execute: false
runs-on: ${{ matrix.platform.runs-on }}
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: Run both commands
uses: ./
with:
command: both
force-use-cross: ${{ matrix.platform.force-use-cross || false }}
cross-version: ${{ matrix.platform.cross-version }}
cache-cross-binary: ${{ matrix.platform.cache-cross-binary }}
target: ${{ matrix.platform.target }}
toolchain: ${{ matrix.platform.toolchain || 'stable' }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
if: ${{ matrix.platform.can-execute }}
- name: Run test command
uses: ./
with:
command: test
force-use-cross: ${{ matrix.platform.force-use-cross || false }}
cross-version: ${{ matrix.platform.cross-version }}
cache-cross-binary: ${{ matrix.platform.cache-cross-binary }}
target: ${{ matrix.platform.target }}
toolchain: ${{ matrix.platform.toolchain || 'stable' }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
if: ${{ matrix.platform.can-execute }}
- name: Run test command with args
uses: ./
with:
command: test
force-use-cross: ${{ matrix.platform.force-use-cross || false }}
cross-version: ${{ matrix.platform.cross-version }}
cache-cross-binary: ${{ matrix.platform.cache-cross-binary }}
target: ${{ matrix.platform.target }}
toolchain: ${{ matrix.platform.toolchain || 'stable' }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
args: "-- --ignored"
if: ${{ matrix.platform.can-execute }}
- name: Run build command
uses: ./
with:
command: build
force-use-cross: ${{ matrix.platform.force-use-cross || false }}
cross-version: ${{ matrix.platform.cross-version }}
cache-cross-binary: ${{ matrix.platform.cache-cross-binary }}
target: ${{ matrix.platform.target }}
toolchain: ${{ matrix.platform.toolchain || 'stable' }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
strip: true
# 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
run: |
set -e
set -x
cargo run --manifest-path ./run-tests/Cargo.toml -- \
--checkout-root "$PWD" \
--target "${{ matrix.platform.target }}" \
--expect-file-re "${{ matrix.platform.expect-file-re }}" \
--expect-cross-version "${{ matrix.platform.expect-cross-version }}" \
${{ matrix.platform.expect-cross }} \
${{ matrix.platform.expect-stripped }}
- name: Run build command for subdir
uses: ./
with:
command: build
force-use-cross: ${{ matrix.platform.force-use-cross || false }}
cross-version: ${{ matrix.platform.cross-version }}
cache-cross-binary: ${{ matrix.platform.cache-cross-binary }}
working-directory: subcrate
target: ${{ matrix.platform.target }}
toolchain: ${{ matrix.platform.toolchain || 'stable' }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
strip: true
- name: Check binary and cross for subcrate on ${{ matrix.platform.name }}
shell: bash
run: |
set -e
set -x
cargo run --manifest-path ./run-tests/Cargo.toml -- \
--checkout-root "$PWD" \
--target "${{ matrix.platform.target }}" \
--expect-file-re "${{ matrix.platform.expect-file-re }}" \
--expect-cross-version "${{ matrix.platform.expect-cross-version }}" \
${{ matrix.platform.expect-cross }} \
${{ matrix.platform.expect-stripped }} \
--is-subcrate
- name: Run bench command
uses: ./
with:
command: bench
force-use-cross: ${{ matrix.platform.force-use-cross || false }}
cross-version: ${{ matrix.platform.cross-version }}
cache-cross-binary: ${{ matrix.platform.cache-cross-binary }}
target: ${{ matrix.platform.target }}
working-directory: bench
toolchain: ${{ matrix.platform.toolchain || 'stable' }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
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:
name: Test validate-inputs
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Run tests
shell: bash
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