Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 40 additions & 4 deletions .github/workflows/pr_targets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ name: Upload Impacted Targets
run-name: pr targets for ${{ github.ref_name }}
on: pull_request

permissions:
contents: read

jobs:
compute_pr_targets:
name: compute
Expand All @@ -10,7 +13,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
with:
lfs: truefilenames.sort();
lfs: true

- uses: dtolnay/rust-toolchain@stable

Expand All @@ -19,10 +22,43 @@ jobs:
with:
tools: gh jq

- name: download mq
- name: Download mq binary
run: |
gh release download --pattern='*.gz' --output mq.gz --clobber
tar -xf mq.gz
# Determine target triple based on runner OS and architecture
if [[ "${{ runner.os }}" == "Linux" ]]; then
if [[ "${{ runner.arch }}" == "X64" ]]; then
TARGET="x86_64-unknown-linux-gnu"
EXT="tar.gz"
elif [[ "${{ runner.arch }}" == "ARM64" ]]; then
TARGET="aarch64-unknown-linux-gnu"
EXT="tar.gz"
else
echo "Unsupported Linux architecture: ${{ runner.arch }}"
exit 1
fi
elif [[ "${{ runner.os }}" == "macOS" ]]; then
if [[ "${{ runner.arch }}" == "ARM64" ]]; then
TARGET="aarch64-apple-darwin"
EXT="zip"
else
echo "Unsupported macOS architecture: ${{ runner.arch }} (only ARM64 is supported)"
exit 1
fi
else
echo "Unsupported OS: ${{ runner.os }}"
exit 1
fi

# Download and extract the binary
PATTERN="mq-*-${TARGET}.${EXT}"
gh release download --pattern="$PATTERN" --output "mq.${EXT}" --clobber

if [[ "$EXT" == "zip" ]]; then
unzip -o mq.zip
else
tar -xf mq.tar.gz
fi
chmod +x mq
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Expand Down
38 changes: 29 additions & 9 deletions .github/workflows/prerelease.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,14 @@ jobs:
matrix:
include:
- target: x86_64-unknown-linux-gnu
runs-on: [ubuntu-22.04]
runs-on: ubuntu-22.04
os: linux
- target: aarch64-unknown-linux-gnu
runs-on: ubuntu-22.04
os: linux
- target: aarch64-apple-darwin
runs-on: macos-14
os: macos
runs-on: ${{ matrix.runs-on }}

steps:
Expand All @@ -25,20 +32,25 @@ jobs:
- name: Set up toolchains
run: |
rustup target add ${{ matrix.target }}
if [[ ${{ matrix.target }} == "aarch64-unknown-linux-gnu" ]]; then
if [[ "${{ matrix.target }}" == "aarch64-unknown-linux-gnu" ]]; then
sudo apt update;
sudo apt install -y binutils-aarch64-linux-gnu gcc-aarch64-linux-gnu;
fi

- name: update version
run:
sed -i "s/version = \"0.0.0\"/version = \"${{ github.event.inputs.release_tag }}\"/"
Cargo.toml
run: |
if [[ "${{ runner.os }}" == "macOS" ]]; then
sed -i '' "s/version = \"0.0.0\"/version = \"${{ github.event.inputs.release_tag }}\"/" Cargo.toml
else
sed -i "s/version = \"0.0.0\"/version = \"${{ github.event.inputs.release_tag }}\"/" Cargo.toml
fi

- name: Build --release
run: cargo build --release --target ${{ matrix.target }}
env:
HORTON_RELEASE: ${{ github.event.inputs.release_tag }}
CC_aarch64_unknown_linux_gnu: aarch64-linux-gnu-gcc
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc

- uses: actions/upload-artifact@v4
with:
Expand Down Expand Up @@ -68,14 +80,22 @@ jobs:
for target in $(ls build)
do
chmod u+x build/${target}/mq
tar czvf \
build/mq-${{ github.event.inputs.release_tag }}-${target}.tar.gz \
-C build/${target} mq
if [[ "${target}" == *"apple-darwin"* ]]; then
# macOS binaries use zip format
cd build/${target}
zip ../mq-${{ github.event.inputs.release_tag }}-${target}.zip mq
cd ../..
else
# Linux binaries use tar.gz format
tar czvf \
build/mq-${{ github.event.inputs.release_tag }}-${target}.tar.gz \
-C build/${target} mq
fi
done

- name: Create GH release and upload binary
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create --target ${{ github.ref }} \
${{ github.event.inputs.release_tag }} ./build/*.tar.gz --generate-notes --prerelease
${{ github.event.inputs.release_tag }} ./build/*.{tar.gz,zip} --generate-notes --prerelease
Copy link

Copilot AI Nov 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The glob pattern './build/.{tar.gz,zip}' may not work as expected in bash. If no .zip files exist, the literal string './build/.zip' will be passed to gh release. Consider using a more robust approach like 'shopt -s nullglob' before the command or finding files explicitly with 'find'.

Suggested change
${{ github.event.inputs.release_tag }} ./build/*.{tar.gz,zip} --generate-notes --prerelease
${{ github.event.inputs.release_tag }} $(find ./build -maxdepth 1 -type f \( -name "*.tar.gz" -o -name "*.zip" \)) --generate-notes --prerelease

Copilot uses AI. Check for mistakes.
38 changes: 29 additions & 9 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,14 @@ jobs:
matrix:
include:
- target: x86_64-unknown-linux-gnu
runs-on: [ubuntu-22.04]
runs-on: ubuntu-22.04
os: linux
- target: aarch64-unknown-linux-gnu
runs-on: ubuntu-22.04
os: linux
- target: aarch64-apple-darwin
runs-on: macos-14
os: macos
runs-on: ${{ matrix.runs-on }}

steps:
Expand All @@ -25,20 +32,25 @@ jobs:
- name: Set up toolchains
run: |
rustup target add ${{ matrix.target }}
if [[ ${{ matrix.target }} == "aarch64-unknown-linux-gnu" ]]; then
if [[ "${{ matrix.target }}" == "aarch64-unknown-linux-gnu" ]]; then
sudo apt update;
sudo apt install -y binutils-aarch64-linux-gnu gcc-aarch64-linux-gnu;
fi

- name: update version
run:
sed -i "s/version = \"0.0.0\"/version = \"${{ github.event.inputs.release_tag }}\"/"
Cargo.toml
run: |
if [[ "${{ runner.os }}" == "macOS" ]]; then
sed -i '' "s/version = \"0.0.0\"/version = \"${{ github.event.inputs.release_tag }}\"/" Cargo.toml
else
sed -i "s/version = \"0.0.0\"/version = \"${{ github.event.inputs.release_tag }}\"/" Cargo.toml
fi

- name: Build --release
run: cargo build --release --target ${{ matrix.target }}
env:
HORTON_RELEASE: ${{ github.event.inputs.release_tag }}
CC_aarch64_unknown_linux_gnu: aarch64-linux-gnu-gcc
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc

- uses: actions/upload-artifact@v4
with:
Expand Down Expand Up @@ -68,14 +80,22 @@ jobs:
for target in $(ls build)
do
chmod u+x build/${target}/mq
tar czvf \
build/mq-${{ github.event.inputs.release_tag }}-${target}.tar.gz \
-C build/${target} mq
if [[ "${target}" == *"apple-darwin"* ]]; then
# macOS binaries use zip format
cd build/${target}
zip ../mq-${{ github.event.inputs.release_tag }}-${target}.zip mq
cd ../..
else
# Linux binaries use tar.gz format
tar czvf \
build/mq-${{ github.event.inputs.release_tag }}-${target}.tar.gz \
-C build/${target} mq
fi
done

- name: Create GH release and upload binary
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create --target ${{ github.ref }} \
${{ github.event.inputs.release_tag }} ./build/*.tar.gz --generate-notes
${{ github.event.inputs.release_tag }} ./build/*.{tar.gz,zip} --generate-notes
Copy link

Copilot AI Nov 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The glob pattern './build/.{tar.gz,zip}' may not work as expected in bash. If no .zip files exist, the literal string './build/.zip' will be passed to gh release. Consider using a more robust approach like 'shopt -s nullglob' before the command or finding files explicitly with 'find'.

Suggested change
${{ github.event.inputs.release_tag }} ./build/*.{tar.gz,zip} --generate-notes
${{ github.event.inputs.release_tag }} $(find ./build -maxdepth 1 -type f \( -name "*.tar.gz" -o -name "*.zip" \)) --generate-notes

Copilot uses AI. Check for mistakes.
4 changes: 0 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,6 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}

- name: Trunk Code Quality
uses: trunk-io/trunk-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}