Add support for more architectures
This commit is contained in:
parent
5daa983034
commit
d66a01e7da
2 changed files with 73 additions and 13 deletions
75
.github/workflows/ci.yml
vendored
75
.github/workflows/ci.yml
vendored
|
|
@ -8,29 +8,82 @@ permissions:
|
||||||
contents: write
|
contents: write
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build-nix:
|
||||||
name: Build packages
|
name: Build ${{ matrix.target }}
|
||||||
runs-on: ubuntu-latest
|
runs-on: ${{ matrix.runner }}
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
- system: x86_64-linux
|
- target: x86_64-unknown-linux-gnu
|
||||||
|
runner: ubuntu-latest
|
||||||
|
system: x86_64-linux
|
||||||
|
package: default
|
||||||
|
- target: x86_64-unknown-linux-musl
|
||||||
|
runner: ubuntu-latest
|
||||||
|
system: x86_64-linux
|
||||||
|
package: x86_64-linux-musl
|
||||||
|
- target: aarch64-unknown-linux-gnu
|
||||||
|
runner: ubuntu-latest
|
||||||
|
system: x86_64-linux
|
||||||
|
package: aarch64-linux
|
||||||
|
- target: x86_64-apple-darwin
|
||||||
|
runner: macos-13
|
||||||
|
system: x86_64-darwin
|
||||||
|
package: default
|
||||||
|
- target: aarch64-apple-darwin
|
||||||
|
runner: macos-latest
|
||||||
|
system: aarch64-darwin
|
||||||
|
package: default
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- uses: DeterminateSystems/nix-installer-action@main
|
- uses: DeterminateSystems/nix-installer-action@main
|
||||||
# - uses: DeterminateSystems/magic-nix-cache-action@main
|
|
||||||
|
|
||||||
- run: nix --print-build-logs build .#packages.$SYSTEM.default
|
- run: nix --print-build-logs build .#packages.${{ matrix.system }}.${{ matrix.package }}
|
||||||
env:
|
|
||||||
SYSTEM: ${{ matrix.system }}
|
|
||||||
|
|
||||||
- name: Prepare release artifact
|
- name: Prepare release artifact
|
||||||
if: startsWith(github.ref, 'refs/tags/')
|
if: startsWith(github.ref, 'refs/tags/')
|
||||||
run: cp result/bin/mkv mkv-${{ matrix.system }}
|
run: cp result/bin/mkv mkv-${{ matrix.target }}
|
||||||
|
|
||||||
|
- name: Upload artifact
|
||||||
|
if: startsWith(github.ref, 'refs/tags/')
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: mkv-${{ matrix.target }}
|
||||||
|
path: mkv-${{ matrix.target }}
|
||||||
|
|
||||||
|
build-windows:
|
||||||
|
name: Build x86_64-pc-windows-msvc
|
||||||
|
runs-on: windows-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- uses: dtolnay/rust-toolchain@stable
|
||||||
|
|
||||||
|
- run: cargo build --release
|
||||||
|
|
||||||
|
- name: Prepare release artifact
|
||||||
|
if: startsWith(github.ref, 'refs/tags/')
|
||||||
|
run: cp target/release/mkv.exe mkv-x86_64-pc-windows-msvc.exe
|
||||||
|
|
||||||
|
- name: Upload artifact
|
||||||
|
if: startsWith(github.ref, 'refs/tags/')
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: mkv-x86_64-pc-windows-msvc
|
||||||
|
path: mkv-x86_64-pc-windows-msvc.exe
|
||||||
|
|
||||||
|
release:
|
||||||
|
name: Create release
|
||||||
|
needs: [build-nix, build-windows]
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
if: startsWith(github.ref, 'refs/tags/')
|
||||||
|
steps:
|
||||||
|
- uses: actions/download-artifact@v4
|
||||||
|
with:
|
||||||
|
path: artifacts
|
||||||
|
merge-multiple: true
|
||||||
|
|
||||||
- name: Create release
|
- name: Create release
|
||||||
if: startsWith(github.ref, 'refs/tags/')
|
|
||||||
uses: softprops/action-gh-release@v2
|
uses: softprops/action-gh-release@v2
|
||||||
with:
|
with:
|
||||||
files: mkv-${{ matrix.system }}
|
files: artifacts/*
|
||||||
|
|
|
||||||
11
flake.nix
11
flake.nix
|
|
@ -12,14 +12,17 @@
|
||||||
darwinBuildInputs = pkgs.lib.optionals pkgs.stdenv.hostPlatform.isDarwin [
|
darwinBuildInputs = pkgs.lib.optionals pkgs.stdenv.hostPlatform.isDarwin [
|
||||||
pkgs.libiconv
|
pkgs.libiconv
|
||||||
];
|
];
|
||||||
mkv = pkgs.rustPlatform.buildRustPackage {
|
mkMkv = pkgs': pkgs'.rustPlatform.buildRustPackage {
|
||||||
pname = "mkv";
|
pname = "mkv";
|
||||||
version = "0.1.0";
|
version = "0.1.0";
|
||||||
cargoLock.lockFile = ./Cargo.lock;
|
cargoLock.lockFile = ./Cargo.lock;
|
||||||
src = pkgs.lib.cleanSource ./.;
|
src = pkgs.lib.cleanSource ./.;
|
||||||
buildInputs = darwinBuildInputs;
|
buildInputs = pkgs'.lib.optionals pkgs'.stdenv.hostPlatform.isDarwin [
|
||||||
|
pkgs'.libiconv
|
||||||
|
];
|
||||||
doCheck = false;
|
doCheck = false;
|
||||||
};
|
};
|
||||||
|
mkv = mkMkv pkgs;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
devShells.default = pkgs.mkShell {
|
devShells.default = pkgs.mkShell {
|
||||||
|
|
@ -33,5 +36,9 @@
|
||||||
packages.default = mkv;
|
packages.default = mkv;
|
||||||
checks.default = mkv.overrideAttrs { doCheck = true; };
|
checks.default = mkv.overrideAttrs { doCheck = true; };
|
||||||
}
|
}
|
||||||
|
// pkgs.lib.optionalAttrs pkgs.stdenv.hostPlatform.isLinux {
|
||||||
|
packages.x86_64-linux-musl = mkMkv pkgs.pkgsCross.musl64;
|
||||||
|
packages.aarch64-linux = mkMkv pkgs.pkgsCross.aarch64-multiplatform;
|
||||||
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue