mirror of
https://github.com/sxyazi/yazi.git
synced 2024-12-25 17:54:57 +03:00
feat: add musl linux build targets (#759)
This commit is contained in:
parent
1835fba8ea
commit
cc54205cc7
22
.github/workflows/cachix.yml
vendored
22
.github/workflows/cachix.yml
vendored
@ -1,4 +1,3 @@
|
|||||||
# Publish the Nix flake outputs to Cachix
|
|
||||||
name: Cachix
|
name: Cachix
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
@ -13,17 +12,16 @@ jobs:
|
|||||||
os: [ubuntu-latest, macos-latest]
|
os: [ubuntu-latest, macos-latest]
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout sources
|
- uses: actions/checkout@v4
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Install nix
|
- name: Install Nix
|
||||||
uses: cachix/install-nix-action@v25
|
uses: cachix/install-nix-action@v25
|
||||||
|
|
||||||
- name: Authenticate with Cachix
|
- name: Authenticate with Cachix
|
||||||
uses: cachix/cachix-action@v14
|
uses: cachix/cachix-action@v14
|
||||||
with:
|
with:
|
||||||
name: yazi
|
name: yazi
|
||||||
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
|
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"
|
||||||
|
|
||||||
- name: Build nix flake
|
- name: Build Flake
|
||||||
run: nix build -L
|
run: nix build -L
|
||||||
|
122
.github/workflows/release.yml
vendored
122
.github/workflows/release.yml
vendored
@ -6,9 +6,7 @@ on:
|
|||||||
- "v[0-9]+.[0-9]+.[0-9]+"
|
- "v[0-9]+.[0-9]+.[0-9]+"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
release:
|
build-unix:
|
||||||
permissions:
|
|
||||||
contents: write
|
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
@ -20,6 +18,27 @@ jobs:
|
|||||||
target: x86_64-apple-darwin
|
target: x86_64-apple-darwin
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
target: aarch64-apple-darwin
|
target: aarch64-apple-darwin
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Install gcc-aarch64-linux-gnu
|
||||||
|
if: matrix.target == 'aarch64-unknown-linux-gnu'
|
||||||
|
run: sudo apt-get update && sudo apt-get install -yq gcc-aarch64-linux-gnu
|
||||||
|
|
||||||
|
- name: Build
|
||||||
|
run: ./scripts/build.sh ${{ matrix.target }}
|
||||||
|
|
||||||
|
- name: Upload artifact
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: yazi-${{ matrix.target }}.zip
|
||||||
|
path: yazi-${{ matrix.target }}.zip
|
||||||
|
|
||||||
|
build-windows:
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
- os: windows-latest
|
- os: windows-latest
|
||||||
target: x86_64-pc-windows-msvc
|
target: x86_64-pc-windows-msvc
|
||||||
- os: windows-latest
|
- os: windows-latest
|
||||||
@ -31,57 +50,92 @@ jobs:
|
|||||||
- name: Setup Rust toolchain
|
- name: Setup Rust toolchain
|
||||||
run: rustup toolchain install stable --profile minimal
|
run: rustup toolchain install stable --profile minimal
|
||||||
|
|
||||||
- name: Add aarch64 target
|
- name: Add target
|
||||||
if: contains(fromJson('["aarch64-unknown-linux-gnu", "aarch64-apple-darwin", "aarch64-pc-windows-msvc"]'), matrix.target)
|
|
||||||
run: rustup target add ${{ matrix.target }}
|
run: rustup target add ${{ matrix.target }}
|
||||||
|
|
||||||
- name: Install gcc-aarch64-linux-gnu
|
|
||||||
if: matrix.target == 'aarch64-unknown-linux-gnu'
|
|
||||||
run: |
|
|
||||||
sudo apt-get update
|
|
||||||
sudo apt-get install -yq gcc-aarch64-linux-gnu
|
|
||||||
|
|
||||||
- name: Setup Rust cache
|
|
||||||
uses: Swatinem/rust-cache@v2
|
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
env:
|
env:
|
||||||
YAZI_GEN_COMPLETIONS: true
|
YAZI_GEN_COMPLETIONS: true
|
||||||
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: /usr/bin/aarch64-linux-gnu-gcc
|
|
||||||
run: cargo build --release --locked --target ${{ matrix.target }}
|
run: cargo build --release --locked --target ${{ matrix.target }}
|
||||||
|
|
||||||
- name: Build snap
|
- name: Pack artifact
|
||||||
if: matrix.target == 'x86_64-unknown-linux-gnu'
|
|
||||||
uses: snapcore/action-build@v1
|
|
||||||
|
|
||||||
- name: Pack artifacts [Linux & macOS]
|
|
||||||
if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest'
|
|
||||||
env:
|
|
||||||
TARGET_NAME: yazi-${{ matrix.target }}
|
|
||||||
run: |
|
|
||||||
mkdir $TARGET_NAME
|
|
||||||
cp target/${{ matrix.target }}/release/yazi $TARGET_NAME
|
|
||||||
cp -r yazi-config/completions $TARGET_NAME
|
|
||||||
cp README.md LICENSE $TARGET_NAME
|
|
||||||
zip -r $TARGET_NAME.zip $TARGET_NAME
|
|
||||||
|
|
||||||
- name: Pack artifacts [Windows]
|
|
||||||
if: matrix.os == 'windows-latest'
|
if: matrix.os == 'windows-latest'
|
||||||
env:
|
env:
|
||||||
TARGET_NAME: yazi-${{ matrix.target }}
|
TARGET_NAME: yazi-${{ matrix.target }}
|
||||||
run: |
|
run: |
|
||||||
New-Item -ItemType Directory -Path ${env:TARGET_NAME}
|
New-Item -ItemType Directory -Path ${env:TARGET_NAME}
|
||||||
Copy-Item -Path "target\${{ matrix.target }}\release\yazi.exe" -Destination ${env:TARGET_NAME}
|
Copy-Item -Path "target\${{ matrix.target }}\release\yazi.exe" -Destination ${env:TARGET_NAME}
|
||||||
Copy-Item -Path "yazi-config\completions" -Destination ${env:TARGET_NAME} -Recurse
|
Copy-Item -Path "yazi-boot\completions" -Destination ${env:TARGET_NAME} -Recurse
|
||||||
Copy-Item -Path "README.md", "LICENSE" -Destination ${env:TARGET_NAME}
|
Copy-Item -Path "README.md", "LICENSE" -Destination ${env:TARGET_NAME}
|
||||||
Compress-Archive -Path ${env:TARGET_NAME} -DestinationPath "${env:TARGET_NAME}.zip"
|
Compress-Archive -Path ${env:TARGET_NAME} -DestinationPath "${env:TARGET_NAME}.zip"
|
||||||
|
|
||||||
|
- name: Upload artifact
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: yazi-${{ matrix.target }}.zip
|
||||||
|
path: yazi-${{ matrix.target }}.zip
|
||||||
|
|
||||||
|
build-musl:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- target: x86_64-unknown-linux-musl
|
||||||
|
image: rust-musl-cross:x86_64-musl
|
||||||
|
- target: aarch64-unknown-linux-musl
|
||||||
|
image: rust-musl-cross:aarch64-musl
|
||||||
|
container:
|
||||||
|
image: docker://ghcr.io/rust-cross/${{ matrix.image }}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Build
|
||||||
|
run: ./scripts/build.sh ${{ matrix.target }}
|
||||||
|
|
||||||
|
- name: Upload artifact
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: yazi-${{ matrix.target }}.zip
|
||||||
|
path: yazi-${{ matrix.target }}.zip
|
||||||
|
|
||||||
|
build-snap:
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- os: ubuntu-latest
|
||||||
|
target: x86_64-unknown-linux-gnu
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Build snap
|
||||||
|
uses: snapcore/action-build@v1
|
||||||
|
|
||||||
|
- name: Build
|
||||||
|
run: mv yazi_*.snap yazi-${{ matrix.target }}.snap
|
||||||
|
|
||||||
|
- name: Upload artifact
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: yazi-${{ matrix.target }}.snap
|
||||||
|
path: yazi-${{ matrix.target }}.snap
|
||||||
|
|
||||||
|
release:
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: [build-unix, build-windows, build-musl, build-snap]
|
||||||
|
steps:
|
||||||
|
- uses: actions/download-artifact@v4
|
||||||
|
with:
|
||||||
|
merge-multiple: true
|
||||||
|
|
||||||
- name: Release
|
- name: Release
|
||||||
uses: softprops/action-gh-release@v1
|
uses: softprops/action-gh-release@v1
|
||||||
if: startsWith(github.ref, 'refs/tags/')
|
if: startsWith(github.ref, 'refs/tags/')
|
||||||
with:
|
with:
|
||||||
draft: true
|
draft: true
|
||||||
files: |
|
files: |
|
||||||
yazi-${{ matrix.target }}.zip
|
yazi-*.zip
|
||||||
yazi*.snap
|
yazi-*.snap
|
||||||
generate_release_notes: true
|
generate_release_notes: true
|
||||||
|
@ -1,20 +1,26 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
export ARTIFACT_NAME="yazi-$1"
|
||||||
cd $SCRIPT_DIR/..
|
export YAZI_GEN_COMPLETIONS=1
|
||||||
|
export CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=/usr/bin/aarch64-linux-gnu-gcc
|
||||||
|
|
||||||
cargo +stable build --release --target aarch64-apple-darwin
|
# Setup Rust toolchain
|
||||||
cargo +stable build --release --target x86_64-apple-darwin
|
rustup toolchain install stable --profile minimal
|
||||||
cargo +stable build --release --target x86_64-unknown-linux-gnu
|
rustup target add "$1"
|
||||||
cargo +stable build --release --target x86_64-pc-windows-gnu
|
|
||||||
|
|
||||||
mv target/aarch64-apple-darwin/release/yazi yazi-aarch64-apple-darwin
|
# Build for the target
|
||||||
mv target/x86_64-apple-darwin/release/yazi yazi-x86_64-apple-darwin
|
cargo build --release --locked --target "$1"
|
||||||
mv target/x86_64-unknown-linux-gnu/release/yazi yazi-x86_64-unknown-linux-gnu
|
|
||||||
mv target/x86_64-pc-windows-gnu/release/yazi.exe yazi-x86_64-pc-windows-gnu.exe
|
|
||||||
|
|
||||||
zip -j yazi-aarch64-apple-darwin.zip yazi-aarch64-apple-darwin
|
# Create the artifact
|
||||||
zip -j yazi-x86_64-apple-darwin.zip yazi-x86_64-apple-darwin
|
mkdir "$ARTIFACT_NAME"
|
||||||
zip -j yazi-x86_64-unknown-linux-gnu.zip yazi-x86_64-unknown-linux-gnu
|
cp "target/$1/release/yazi" "$ARTIFACT_NAME"
|
||||||
zip -j yazi-x86_64-pc-windows-gnu.zip yazi-x86_64-pc-windows-gnu.exe
|
cp -r yazi-boot/completions "$ARTIFACT_NAME"
|
||||||
|
cp README.md LICENSE "$ARTIFACT_NAME"
|
||||||
|
|
||||||
|
# Zip the artifact
|
||||||
|
if ! command -v zip &> /dev/null
|
||||||
|
then
|
||||||
|
sudo apt-get update && sudo apt-get install -yq zip
|
||||||
|
fi
|
||||||
|
zip -r "$ARTIFACT_NAME.zip" "$ARTIFACT_NAME"
|
||||||
|
Loading…
Reference in New Issue
Block a user