From 7082e8bb75619e2213cd9387c4d25379a1e6b9b5 Mon Sep 17 00:00:00 2001
From: Aidan Gauland <aidalgol@fastmail.net>
Date: Sat, 18 Nov 2023 17:13:41 +1300
Subject: [PATCH] Add GH Workflow

GitHub Workflow to ensure all plugins build.
---
 .github/workflows/build.yml | 16 ++++++
 test-build.nix              | 97 +++++++++++++++++++++++++++++++++++++
 test-build.sh               |  3 ++
 3 files changed, 116 insertions(+)
 create mode 100644 .github/workflows/build.yml
 create mode 100644 test-build.nix
 create mode 100755 test-build.sh

diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
new file mode 100644
index 0000000..078c86e
--- /dev/null
+++ b/.github/workflows/build.yml
@@ -0,0 +1,16 @@
+name: Test
+on:
+  pull_request:
+jobs:
+  build:
+    runs-on: ubuntu-latest
+    steps:
+    - uses: actions/checkout@v3
+    - uses: cachix/install-nix-action@v22
+      with:
+        nix_path: nixpkgs=channel:nixos-unstable
+    - uses: cachix/cachix-action@v12
+      with:
+        name: nix-community
+        authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
+    - run: nix-build --show-trace --argstr vs-overlay $GITHUB_WORKSPACE test-build.nix
diff --git a/test-build.nix b/test-build.nix
new file mode 100644
index 0000000..12269f1
--- /dev/null
+++ b/test-build.nix
@@ -0,0 +1,97 @@
+{vs-overlay}:
+with import <nixpkgs> {
+  config.allowUnfree = true;
+  overlays = [(import vs-overlay)];
+  # Force default Python to 3.x
+  config.packageOverrides = pkgs: {
+    python = pkgs.python3;
+  };
+};
+# TODO: Fix broken packages, which are commented out below.
+  runCommand "vs-overlay-plugins-build-test" {
+    buildInputs = [
+      vapoursynthPlugins.adaptivegrain
+      vapoursynthPlugins.addgrain
+      vapoursynthPlugins.autocrop
+      vapoursynthPlugins.awarpsharp2
+      vapoursynthPlugins.bestaudiosource
+      vapoursynthPlugins.beziercurve
+      vapoursynthPlugins.bifrost
+      vapoursynthPlugins.bilateral
+      vapoursynthPlugins.bm3d
+      vapoursynthPlugins.cas
+      vapoursynthPlugins.cnr2
+      vapoursynthPlugins.combmask
+      vapoursynthPlugins.continuityfixer
+      vapoursynthPlugins.ctmf
+      # vapoursynthPlugins.d2vsource
+      vapoursynthPlugins.dctfilter
+      vapoursynthPlugins.deblock
+      vapoursynthPlugins.decross
+      vapoursynthPlugins.descale
+      vapoursynthPlugins.dfttest
+      vapoursynthPlugins.eedi2
+      vapoursynthPlugins.eedi3m
+      # vapoursynthPlugins.f3kdb
+      vapoursynthPlugins.ffms2
+      vapoursynthPlugins.fft3dfilter
+      vapoursynthPlugins.fillborders
+      vapoursynthPlugins.fluxsmooth
+      vapoursynthPlugins.fmtconv
+      vapoursynthPlugins.histogram
+      vapoursynthPlugins.hqdn3d
+      vapoursynthPlugins.imwri
+      vapoursynthPlugins.knlmeanscl
+      # vapoursynthPlugins.lsmashsource
+      vapoursynthPlugins.median
+      vapoursynthPlugins.minideen
+      vapoursynthPlugins.miscfilters-obsolete
+      vapoursynthPlugins.motionmask
+      vapoursynthPlugins.msmoosh
+      vapoursynthPlugins.mvtools
+      vapoursynthPlugins.nnedi3
+      vapoursynthPlugins.nnedi3cl
+      vapoursynthPlugins.ocr
+      # vapoursynthPlugins.placebo
+      vapoursynthPlugins.readmpls
+      vapoursynthPlugins.remap
+      vapoursynthPlugins.removegrain
+      vapoursynthPlugins.retinex
+      vapoursynthPlugins.sangnom
+      vapoursynthPlugins.scxvid
+      vapoursynthPlugins.subtext
+      vapoursynthPlugins.tcanny
+      vapoursynthPlugins.temporalmedian
+      vapoursynthPlugins.temporalsoften2
+      vapoursynthPlugins.tnlmeans
+      vapoursynthPlugins.ttempsmooth
+      vapoursynthPlugins.vivtc
+      # Requires non-redistributable unfree TensorRT.
+      # vapoursynthPlugins.vstrt
+      vapoursynthPlugins.wwxd
+      vapoursynthPlugins.znedi3
+
+      # vapoursynthPlugins.acsuite
+      vapoursynthPlugins.adjust
+      vapoursynthPlugins.astdr
+      # vapoursynthPlugins.awsmfunc
+      # vapoursynthPlugins.debandshit
+      vapoursynthPlugins.dfmderainbow
+      vapoursynthPlugins.edi_rpow2
+      vapoursynthPlugins.finedehalo
+      vapoursynthPlugins.fvsfunc
+      vapoursynthPlugins.havsfunc
+      vapoursynthPlugins.kagefunc
+      # vapoursynthPlugins.lvsfunc
+      vapoursynthPlugins.mt_lutspa
+      vapoursynthPlugins.muvsfunc
+      vapoursynthPlugins.mvsfunc
+      vapoursynthPlugins.nnedi3_resample
+      vapoursynthPlugins.nnedi3_rpow2
+      # vapoursynthPlugins.rekt
+      # vapoursynthPlugins.vardefunc
+      # vapoursynthPlugins.vsTAAmbk
+      # vapoursynthPlugins.vsgan
+      vapoursynthPlugins.vsutil
+    ];
+  } "touch $out"
diff --git a/test-build.sh b/test-build.sh
new file mode 100755
index 0000000..21d8568
--- /dev/null
+++ b/test-build.sh
@@ -0,0 +1,3 @@
+#!/usr/bin/env bash
+
+nix-build --show-trace --argstr vs-overlay $PWD test-build.nix