From 150e07f914bdb5c1afd65b7e40d8d10489ee42a0 Mon Sep 17 00:00:00 2001
From: Robert Brignull <robertbrignull@gmail.com>
Date: Wed, 12 Aug 2020 17:51:06 +0100
Subject: [PATCH] add test action

---
 .github/workflows/cli.yml     | 18 ++++++++++++++++++
 src/testdata/empty-sarif.sarf | 22 ++++++++++++++++++++++
 2 files changed, 40 insertions(+)
 create mode 100644 .github/workflows/cli.yml
 create mode 100644 src/testdata/empty-sarif.sarf

diff --git a/.github/workflows/cli.yml b/.github/workflows/cli.yml
new file mode 100644
index 000000000..1ce2fbfc4
--- /dev/null
+++ b/.github/workflows/cli.yml
@@ -0,0 +1,18 @@
+name: "CodeScanning CLI"
+
+on: [push, pull_request]
+
+jobs:
+  build:
+    runs-on: ubuntu-latest
+
+    steps:
+    - uses: actions/checkout@v2
+
+    # Build the CLI
+    - name: Build CLI
+      run: npm run build-cli
+
+    # Upload an empty SARIF file
+    - name: Upload with CLI
+      run: node cli/code-scanning-cli.js upload --sarif-file src/testdata/empty-sarif.sarif --repository $GITHUB_REPOSITORY --commit $GITHUB_SHA --ref $GITHUB_REF --github-url $GITHUB_API_URL --github-auth ${{ github.token }}
diff --git a/src/testdata/empty-sarif.sarf b/src/testdata/empty-sarif.sarf
new file mode 100644
index 000000000..0a7961f16
--- /dev/null
+++ b/src/testdata/empty-sarif.sarf
@@ -0,0 +1,22 @@
+{
+  "$schema": "https://raw.githubusercontent.com/oasis-tcs/sarif-spec/master/Schemata/sarif-schema-2.1.0.json",
+  "version": "2.1.0",
+  "runs": [
+    {
+      "tool": {
+        "driver": {
+          "name": "LGTM.com",
+          "organization": "Semmle",
+          "version": "1.24.0-SNAPSHOT",
+          "rules": []
+        }
+      },
+      "results": [],
+      "columnKind": "utf16CodeUnits",
+      "properties": {
+        "semmle.formatSpecifier": "2.1.0",
+        "semmle.sourceLanguage": "java"
+      }
+    }
+  ]
+}