Add CI workflow using Nix

This commit is contained in:
YoshiRulz 2021-02-16 22:18:21 +10:00
parent d5dbef2c22
commit 33e3fddee8
No known key found for this signature in database
GPG Key ID: C4DE31C245353FB7
2 changed files with 62 additions and 0 deletions

View File

@ -0,0 +1,27 @@
name: CMake Build (Nix on Ubuntu x86-64)
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: cachix/install-nix-action@v12
with:
nix_path: nixpkgs=https://github.com/NixOS/nixpkgs/archive/a127deeb889b111138f5152e54681577706ab741.tar.gz
# ^ this is also specified in the expression file, but I think using any other value here may cause superfluous downloads from the binary cache
- name: Grab dependencies and build # and move output to CWD
run: |
nix-build ./ci-build-drv.nix
cp -r "$(realpath "$PWD/result")/bin" ${{runner.workspace}}
- uses: actions/upload-artifact@v2
with:
name: melonDS
path: ${{runner.workspace}}/bin

35
ci-build-drv.nix Normal file
View File

@ -0,0 +1,35 @@
# mostly copied from nixpkgs: https://github.com/NixOS/nixpkgs/blob/a127deeb889b111138f5152e54681577706ab741/pkgs/misc/emulators/melonDS/default.nix
# grab updates from there (at master, maybe bump pinned nixpkgs too), though I don't expect any huge changes
{ pkgs ? import (fetchTarball "https://github.com/NixOS/nixpkgs/archive/a127deeb889b111138f5152e54681577706ab741.tar.gz") {}
, mkDerivation ? pkgs.stdenv.mkDerivation
, cmake ? pkgs.cmake
, pkg-config ? pkgs.pkg-config
, SDL2 ? pkgs.SDL2
, qtbase ? pkgs.qt5.qtbase
, epoxy ? pkgs.epoxy
, libarchive ? pkgs.libarchive
, libpcap ? pkgs.libpcap
, libslirp ? pkgs.libslirp
, pcre ? pkgs.pcre
, wrapGAppsHook ? pkgs.wrapGAppsHook
}:
mkDerivation {
name = "melonDS-git-ci";
src = builtins.path { path = ./.; name = "melonDS"; }; # use the directory this file is in (as opposed to downloading a source tarball)
nativeBuildInputs = [ cmake pkg-config wrapGAppsHook ];
buildInputs = [
SDL2
qtbase
epoxy
libarchive
libpcap
libslirp
pcre
];
cmakeFlags = [ "-UUNIX_PORTABLE" ];
}