Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
850196012a | ||
|
|
55a48f5dca |
No files matched your search
@@ -0,0 +1,116 @@
|
|||||||
|
name: Build binaries
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [master]
|
||||||
|
tags: ['v*']
|
||||||
|
pull_request:
|
||||||
|
branches: [master]
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
env:
|
||||||
|
CARGO_TERM_COLOR: always
|
||||||
|
# Measure before stripping; the packaged copy is stripped below.
|
||||||
|
CARGO_PROFILE_RELEASE_STRIP: none
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
name: Build (${{ matrix.target }})
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
timeout-minutes: 60
|
||||||
|
env:
|
||||||
|
TARGET: ${{ matrix.target }}
|
||||||
|
defaults:
|
||||||
|
run:
|
||||||
|
shell: bash
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
# Supported by Gitea 28; bound concurrent cross-build memory use.
|
||||||
|
max-parallel: 2
|
||||||
|
matrix:
|
||||||
|
target:
|
||||||
|
- x86_64-musl
|
||||||
|
- i686-musl
|
||||||
|
- arm-musleabi
|
||||||
|
- arm-musleabihf
|
||||||
|
- armv7-musleabi
|
||||||
|
- armv7-musleabihf
|
||||||
|
- aarch64-musl
|
||||||
|
- mips-musl
|
||||||
|
- mipsel-musl
|
||||||
|
- mips64-muslabi64
|
||||||
|
- mips64el-muslabi64
|
||||||
|
- riscv64gc-musl
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: builtin:checkout
|
||||||
|
|
||||||
|
- name: Configure Rust directories
|
||||||
|
# Cross remote's symlink traversal skips hidden directories under /root.
|
||||||
|
run: |
|
||||||
|
echo "CARGO_HOME=$RUNNER_TEMP/cargo" >> "$GITHUB_ENV"
|
||||||
|
echo "RUSTUP_HOME=$RUNNER_TEMP/rustup" >> "$GITHUB_ENV"
|
||||||
|
echo "$RUNNER_TEMP/cargo/bin" >> "$GITHUB_PATH"
|
||||||
|
|
||||||
|
- name: Install Rust toolchain
|
||||||
|
uses: actions-rust-lang/setup-rust-toolchain@ecabd13d1c56bd1345c230e542e9144811ad706f # v2
|
||||||
|
with:
|
||||||
|
toolchain: ${{ startsWith(matrix.target, 'mips') && 'nightly' || 'stable' }}
|
||||||
|
cache: false
|
||||||
|
build-warnings: warn
|
||||||
|
|
||||||
|
- name: Install cross and binary tools
|
||||||
|
run: |
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install -y --no-install-recommends binutils llvm
|
||||||
|
cargo install --git https://github.com/cross-rs/cross --locked cross
|
||||||
|
echo "RUST_TARGET=${TARGET%-*}-unknown-linux-${TARGET#*-}" >> "$GITHUB_ENV"
|
||||||
|
|
||||||
|
- name: Build release binary
|
||||||
|
env:
|
||||||
|
# MIPS build-std lacks Rust's bundled CRT objects; use the cross GCC copies.
|
||||||
|
RUSTFLAGS: ${{ startsWith(matrix.target, 'mips') && '-C target-feature=+crt-static -C link-self-contained=no' || '-C target-feature=+crt-static' }}
|
||||||
|
# Copy toolchains and sources instead of translating nested bind mounts.
|
||||||
|
CROSS_REMOTE: "true"
|
||||||
|
# Cross's per-artifact JSON capture hides compiler diagnostics.
|
||||||
|
CROSS_REMOTE_COPY_FULL_TARGET_DIR: ${{ startsWith(matrix.target, 'mips') && 'true' || 'false' }}
|
||||||
|
run: |
|
||||||
|
cross build --release --locked --target "$RUST_TARGET"
|
||||||
|
|
||||||
|
- name: Verify, package, and summarize binary
|
||||||
|
run: |
|
||||||
|
binary="target/${RUST_TARGET}/release/sqm-autorate-rust"
|
||||||
|
readelf --program-headers "$binary" > /tmp/program-headers.txt
|
||||||
|
readelf --dynamic "$binary" > /tmp/dynamic-section.txt
|
||||||
|
if grep -q INTERP /tmp/program-headers.txt || grep -q NEEDED /tmp/dynamic-section.txt; then
|
||||||
|
echo "Binary is not statically linked" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
mkdir -p dist
|
||||||
|
stripped="dist/sqm-autorate-rust-${TARGET}"
|
||||||
|
artifact="${stripped}.tar.gz"
|
||||||
|
cp "$binary" "$stripped"
|
||||||
|
llvm-strip --strip-all "$stripped"
|
||||||
|
# Tar preserves executable permissions when downloading the artifact.
|
||||||
|
tar -czf "$artifact" -C dist "sqm-autorate-rust-${TARGET}"
|
||||||
|
|
||||||
|
size() {
|
||||||
|
stat -c %s "$1" | numfmt --to=iec-i --suffix=B --format='%.1f'
|
||||||
|
}
|
||||||
|
{
|
||||||
|
echo '| Target | Unstripped | Stripped | Compressed |'
|
||||||
|
echo '|:--|--:|--:|--:|'
|
||||||
|
printf '| %s | %s | %s | %s |\n' \
|
||||||
|
"$TARGET" "$(size "$binary")" "$(size "$stripped")" "$(size "$artifact")"
|
||||||
|
} >> "$GITHUB_STEP_SUMMARY"
|
||||||
|
|
||||||
|
- name: Upload binary
|
||||||
|
# Use the v3 artifact protocol supported by Gitea.
|
||||||
|
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
|
||||||
|
with:
|
||||||
|
name: sqm-autorate-rust-${{ matrix.target }}
|
||||||
|
path: dist/sqm-autorate-rust-${{ matrix.target }}.tar.gz
|
||||||
|
if-no-files-found: error
|
||||||
@@ -52,8 +52,11 @@ jobs:
|
|||||||
- name: Install actionlint
|
- name: Install actionlint
|
||||||
run: go install "github.com/rhysd/actionlint/cmd/actionlint@v${ACTIONLINT_VERSION}"
|
run: go install "github.com/rhysd/actionlint/cmd/actionlint@v${ACTIONLINT_VERSION}"
|
||||||
- name: Check workflow syntax
|
- name: Check workflow syntax
|
||||||
|
# actionlint does not recognize Gitea's built-in checkout action.
|
||||||
run: |
|
run: |
|
||||||
"$(go env GOPATH)/bin/actionlint" \
|
"$(go env GOPATH)/bin/actionlint" \
|
||||||
|
-ignore 'specifying action "builtin:checkout" in invalid format' \
|
||||||
|
.gitea/workflows/build.yml \
|
||||||
.gitea/workflows/ci.yml \
|
.gitea/workflows/ci.yml \
|
||||||
.gitea/workflows/supply-chain.yml \
|
.gitea/workflows/supply-chain.yml \
|
||||||
.github/workflows/actions-security.yml \
|
.github/workflows/actions-security.yml \
|
||||||
|
|||||||
Generated
+7
-7
@@ -25,7 +25,7 @@ checksum = "82f6aeea286b8eb4dd3431a1be1b59d290ace00f5bfd8e2a159bc2a05e2c1667"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 3.0.6",
|
"syn 3.0.9",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -597,7 +597,7 @@ checksum = "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 3.0.6",
|
"syn 3.0.9",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -710,9 +710,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "syn"
|
name = "syn"
|
||||||
version = "3.0.6"
|
version = "3.0.9"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "8593e8e72159ed2257d083c7a454a85cbf854f37a0966d8d483aff8c8a3ebcee"
|
checksum = "d78c8dee4c7bf0e14673097256fed6142ce9d3b85a408189d07482442145823b"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
@@ -751,7 +751,7 @@ checksum = "fe5197923287db20a58125f0bc85c062f7f2c892de97b18c356f9efb14b28524"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 3.0.6",
|
"syn 3.0.9",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -779,7 +779,7 @@ checksum = "78773a2a397f451582ce068015985c33193cf6dea8b74d2a639fe457b2f07b0e"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 3.0.6",
|
"syn 3.0.9",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -842,7 +842,7 @@ version = "0.1.0"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 3.0.6",
|
"syn 3.0.9",
|
||||||
"trybuild",
|
"trybuild",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|||||||
+37
@@ -1,3 +1,40 @@
|
|||||||
[target.x86_64-unknown-freebsd]
|
[target.x86_64-unknown-freebsd]
|
||||||
image.name = "ghcr.io/cross-rs/x86_64-unknown-freebsd:local"
|
image.name = "ghcr.io/cross-rs/x86_64-unknown-freebsd:local"
|
||||||
image.toolchain = ["linux/arm64=aarch64-unknown-linux-gnu"]
|
image.toolchain = ["linux/arm64=aarch64-unknown-linux-gnu"]
|
||||||
|
|
||||||
|
[build]
|
||||||
|
# Vendored UCI searches CMAKE_LIBRARY_PATH for libubox built outside the sysroot.
|
||||||
|
pre-build = [
|
||||||
|
"apt-get update && apt-get install -y --no-install-recommends pkg-config",
|
||||||
|
'echo "set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY BOTH)" >> /opt/toolchain.cmake',
|
||||||
|
# Rust's musl std links -lunwind; MIPS cross GCC supplies the unwinder as libgcc_eh.a.
|
||||||
|
'''
|
||||||
|
for cc in /usr/local/bin/mips*-gcc; do
|
||||||
|
[ -x "$cc" ] || continue
|
||||||
|
archive=$("$cc" -print-file-name=libgcc_eh.a)
|
||||||
|
test -f "$archive" || exit 1
|
||||||
|
ln -sf libgcc_eh.a "$(dirname "$archive")/libunwind.a"
|
||||||
|
done
|
||||||
|
''',
|
||||||
|
]
|
||||||
|
|
||||||
|
# This target's image was added after the cross 0.2.5 release.
|
||||||
|
[target.riscv64gc-unknown-linux-musl]
|
||||||
|
image = "ghcr.io/cross-rs/riscv64gc-unknown-linux-musl:main"
|
||||||
|
|
||||||
|
# MIPS images exist but are excluded from cross's automatic image selection.
|
||||||
|
[target.mips-unknown-linux-musl]
|
||||||
|
image = "ghcr.io/cross-rs/mips-unknown-linux-musl:main"
|
||||||
|
build-std = ["std", "panic_abort"]
|
||||||
|
|
||||||
|
[target.mipsel-unknown-linux-musl]
|
||||||
|
image = "ghcr.io/cross-rs/mipsel-unknown-linux-musl:main"
|
||||||
|
build-std = ["std", "panic_abort"]
|
||||||
|
|
||||||
|
[target.mips64-unknown-linux-muslabi64]
|
||||||
|
image = "ghcr.io/cross-rs/mips64-unknown-linux-muslabi64:main"
|
||||||
|
build-std = ["std", "panic_abort"]
|
||||||
|
|
||||||
|
[target.mips64el-unknown-linux-muslabi64]
|
||||||
|
image = "ghcr.io/cross-rs/mips64el-unknown-linux-muslabi64:main"
|
||||||
|
build-std = ["std", "panic_abort"]
|
||||||
Reference in new issue
Block a user