From f118e9fc51697f60e4b2f2e5a2c53a77b1e69728 Mon Sep 17 00:00:00 2001
From: Allan Blanchard <allan.blanchard@cea.fr>
Date: Fri, 12 May 2023 10:50:26 +0200
Subject: [PATCH] [alias] Move CI to Frama-C CI

---
 nix/frama-c.nix                  |  2 ++
 nix/internal-tests.nix           |  2 ++
 nix/plugins-tests.nix            |  1 +
 src/plugins/alias/.gitlab-ci.yml | 40 ------------------------------
 src/plugins/alias/nix/alias.nix  | 10 --------
 src/plugins/alias/nix/ci.sh      | 42 --------------------------------
 src/plugins/alias/nix/pkgs.nix   | 16 ------------
 7 files changed, 5 insertions(+), 108 deletions(-)
 delete mode 100644 src/plugins/alias/.gitlab-ci.yml
 delete mode 100644 src/plugins/alias/nix/alias.nix
 delete mode 100755 src/plugins/alias/nix/ci.sh
 delete mode 100644 src/plugins/alias/nix/pkgs.nix

diff --git a/nix/frama-c.nix b/nix/frama-c.nix
index aa1ac64409e..34beab7c25a 100644
--- a/nix/frama-c.nix
+++ b/nix/frama-c.nix
@@ -33,6 +33,7 @@
 , ppx_deriving_yaml
 , ppx_deriving_yojson
 , ppx_import
+, unionFind
 , yojson
 , which
 , why3
@@ -91,6 +92,7 @@ stdenvNoCC.mkDerivation rec {
     ppx_deriving_yaml
     ppx_deriving_yojson
     ppx_import
+    unionFind
     yojson
     which
     why3
diff --git a/nix/internal-tests.nix b/nix/internal-tests.nix
index 9e71c73b64f..34cf7a9b1e0 100644
--- a/nix/internal-tests.nix
+++ b/nix/internal-tests.nix
@@ -33,6 +33,7 @@
 , ppx_deriving_yaml
 , ppx_deriving_yojson
 , ppx_import
+, unionFind
 , yojson
 , which
 , why3
@@ -92,6 +93,7 @@ stdenvNoCC.mkDerivation rec {
     ppx_deriving_yaml
     ppx_deriving_yojson
     ppx_import
+    unionFind
     yojson
     which
     yaml
diff --git a/nix/plugins-tests.nix b/nix/plugins-tests.nix
index cbbeb33d9d2..a500d6d0ce1 100644
--- a/nix/plugins-tests.nix
+++ b/nix/plugins-tests.nix
@@ -17,6 +17,7 @@ mk_tests {
       @tests/scope/ptests \
       @tests/sparecode/ptests \
       @src/plugins/aorai/tests/ptests \
+      @src/plugins/alias/tests/ptests \
       @src/plugins/dive/tests/ptests \
       @src/plugins/instantiate/tests/ptests \
       @src/plugins/loop_analysis/tests/ptests \
diff --git a/src/plugins/alias/.gitlab-ci.yml b/src/plugins/alias/.gitlab-ci.yml
deleted file mode 100644
index d4c9ff04cbd..00000000000
--- a/src/plugins/alias/.gitlab-ci.yml
+++ /dev/null
@@ -1,40 +0,0 @@
-################################################################################
-### STAGES
-
-stages:
-  - tests
-
-################################################################################
-### DEFAULT JOB PARAMETERS
-
-default:
-  tags: [nix-v2]
-
-################################################################################
-### VARIABLES
-
-variables:
-  DEFAULT: "master"
-  OCAML: "4.11"
-
-################################################################################
-### TESTS
-
-build-and-test:
-  stage: tests
-  script:
-    - ./nix/ci.sh
-
-check-headers:
-  stage: tests
-  variables:
-    CI_MODE: "check-headers"
-  script:
-    - ./nix/ci.sh
-
-lint:
-  stage: tests
-  variables:
-    CI_MODE: "lint"
-  script:
-    - ./nix/ci.sh
diff --git a/src/plugins/alias/nix/alias.nix b/src/plugins/alias/nix/alias.nix
deleted file mode 100644
index 59e4b01d497..00000000000
--- a/src/plugins/alias/nix/alias.nix
+++ /dev/null
@@ -1,10 +0,0 @@
-{ mk_plugin,
-  unionFind }:
-
-mk_plugin {
-  plugin-name = "alias" ;
-  plugin-src = fetchGit { shallow=true ; url=./.. ; } ;
-  additional-build-inputs = [
-    unionFind
-  ] ;
-}
diff --git a/src/plugins/alias/nix/ci.sh b/src/plugins/alias/nix/ci.sh
deleted file mode 100755
index 698565a0b4d..00000000000
--- a/src/plugins/alias/nix/ci.sh
+++ /dev/null
@@ -1,42 +0,0 @@
-#!/usr/bin/env bash
-
-set -euxo pipefail
-
-DEFAULT=${DEFAULT:-master}
-NIX_TARGET="alias"
-#           <plugin>   /nix       /ci.sh
-PLUGIN_DIR="$(dirname "$(dirname "$(readlink -f "$0")")")"
-
-CURRENT_BRANCH="${CI_MERGE_REQUEST_SOURCE_BRANCH_NAME:-}"
-: "${CURRENT_BRANCH:="${CI_COMMIT_REF_NAME:-}"}"
-: "${CURRENT_BRANCH:="$(git branch --show-current)"}"
-
-# prints
-# - "$CURRENT_BRANCH" if it is a branch name in remote $1,
-# - else "$DEFAULT" if it is set and $DEFAULT is a branch name in remote $1,
-# - else master
-get_matching_branch () {
-  if   git ls-remote --quiet --exit-code "$1" "$CURRENT_BRANCH" >/dev/null 2>/dev/null;
-  then echo "$CURRENT_BRANCH"
-  elif git ls-remote --quiet --exit-code "$1" "$DEFAULT" >/dev/null 2>/dev/null;
-  then echo "$DEFAULT"
-  else echo master
-  fi
-}
-
-TMP_DIR="$(mktemp -d)"
-
-cleanup () {
-  rm -rf $TMP_DIR
-}
-
-trap cleanup EXIT
-
-mkdir -p $TMP_DIR/frama-ci
-frama_ci_repo="$(readlink -f $TMP_DIR/frama-ci)"
-frama_ci_url="git@git.frama-c.com:frama-c/Frama-CI.git"
-frama_ci_branch="$(get_matching_branch "$frama_ci_url")"
-echo "using branch $frama_ci_branch of Frama-CI repo at $frama_ci_repo"
-git clone --depth=1 --branch="$frama_ci_branch" "$frama_ci_url" "$frama_ci_repo"
-
-source $frama_ci_repo/common-plugin-ci.sh
diff --git a/src/plugins/alias/nix/pkgs.nix b/src/plugins/alias/nix/pkgs.nix
deleted file mode 100644
index fd59e529bc8..00000000000
--- a/src/plugins/alias/nix/pkgs.nix
+++ /dev/null
@@ -1,16 +0,0 @@
-{ frama-c-repo ? builtins.trace "alias: defaulting frama-c-repo to ${toString ../../frama-c}" ../../frama-c }:
-let
-  ocamlOverlay = oself: osuper: {
-    alias = oself.callPackage ./alias.nix {};
-  };
-  overlay = self: super: {
-    ocaml-ng = super.lib.mapAttrs (
-      name: value:
-        if builtins.hasAttr "overrideScope'" value
-        then value.overrideScope' ocamlOverlay
-        else value
-    ) super.ocaml-ng;
-  };
-  pkgs = (import (frama-c-repo + "/nix/pkgs.nix")).appendOverlays [ overlay ];
-in
-pkgs
-- 
GitLab