From fd266587a9acc2d5d55565b20d537c80f709581e Mon Sep 17 00:00:00 2001
From: Spencer Wilson <spencer.wilson@uwaterloo.ca>
Date: Mon, 2 Oct 2023 14:20:45 -0400
Subject: [PATCH] Add weekly CircleCI workflow for NIST KATs

---
 .circleci/config.yml | 33 ++++++++++++++++++++++++++++++++-
 1 file changed, 32 insertions(+), 1 deletion(-)

diff --git a/.circleci/config.yml b/.circleci/config.yml
index 16ec900244..27cacef05a 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -315,6 +315,8 @@ workflows:
       and:
         - not:
             equal: [ main, << pipeline.git.branch >> ]
+        - not:
+            equal: [ scheduled_pipeline, << pipeline.trigger_source >> ]
         - not:
             matches: { pattern: "^ghactionsonly-.*", value: << pipeline.git.branch >> }
     jobs:
@@ -393,7 +395,36 @@ workflows:
 
   commit-to-main:
     when:
-      equal: [ main, << pipeline.git.branch >> ]
+      and:
+        - not:
+            equal: [ scheduled_pipeline, << pipeline.trigger_source >> ]
+        - equal: [ main, << pipeline.git.branch >> ]
     jobs:
       - trigger-downstream-ci:
           context: openquantumsafe
+
+  nistkat:
+    when:
+      and:
+        - equal: [ scheduled_pipeline, << pipeline.trigger_source >> ]
+        - equal: [ "NIST KATs", << pipeline.schedule.name >> ]
+    jobs:
+      - linux_oqs:
+          <<: *require_buildcheck
+          name: nistkat-generic
+          context: openquantumsafe
+          CONTAINER: openquantumsafe/ci-ubuntu-focal-x86_64:latest
+          CMAKE_ARGS: -DOQS_OPT_TARGET=generic
+          PYTEST_ARGS: --numprocesses=auto -k 'test_kat_all'
+      - linux_oqs:
+          <<: *require_buildcheck
+          name: nistkat-avx2
+          context: openquantumsafe
+          CONTAINER: openquantumsafe/ci-ubuntu-focal-x86_64:latest
+          CMAKE_ARGS: -DOQS_DIST_BUILD=OFF
+          PYTEST_ARGS: --numprocesses=auto -k 'test_kat_all'
+      - arm_machine:
+          <<: *require_buildcheck
+          name: nistkat-aarch64
+          CMAKE_ARGS: -DOQS_DIST_BUILD=OFF
+          PYTEST_ARGS: --numprocesses=auto --maxprocesses=10 -k 'test_kat_all'