From 9e20e4e58f111c35fd985d045406456244748db0 Mon Sep 17 00:00:00 2001
From: Milan Malfait <m.malfait@ucl.ac.uk>
Date: Mon, 12 Aug 2024 09:41:57 +0100
Subject: [PATCH] Set up CI

---
 .Rbuildignore                      |  1 +
 .github/.gitignore                 |  1 +
 .github/workflows/R-CMD-check.yaml | 34 ++++++++++++++++++++++++++++++
 README.md                          |  1 +
 4 files changed, 37 insertions(+)
 create mode 100644 .github/.gitignore
 create mode 100644 .github/workflows/R-CMD-check.yaml

diff --git a/.Rbuildignore b/.Rbuildignore
index 3b61984..7cad094 100644
--- a/.Rbuildignore
+++ b/.Rbuildignore
@@ -8,3 +8,4 @@ dev_history.R
 $run_dev.*
 ^.here$
 ^LICENSE\.md$
+^\.github$
diff --git a/.github/.gitignore b/.github/.gitignore
new file mode 100644
index 0000000..2d19fc7
--- /dev/null
+++ b/.github/.gitignore
@@ -0,0 +1 @@
+*.html
diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml
new file mode 100644
index 0000000..a5ee068
--- /dev/null
+++ b/.github/workflows/R-CMD-check.yaml
@@ -0,0 +1,34 @@
+# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
+# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
+on:
+  push:
+    branches: [main, master]
+  pull_request:
+    branches: [main, master]
+
+name: R-CMD-check.yaml
+
+permissions: read-all
+
+jobs:
+  R-CMD-check:
+    runs-on: ubuntu-latest
+    env:
+      GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
+      R_KEEP_PKG_SOURCE: yes
+    steps:
+      - uses: actions/checkout@v4
+
+      - uses: r-lib/actions/setup-r@v2
+        with:
+          use-public-rspm: true
+
+      - uses: r-lib/actions/setup-r-dependencies@v2
+        with:
+          extra-packages: any::rcmdcheck
+          needs: check
+
+      - uses: r-lib/actions/check-r-package@v2
+        with:
+          upload-snapshots: true
+          build_args: 'c("--no-manual","--compact-vignettes=gs+qpdf")'
diff --git a/README.md b/README.md
index a0a07ee..acc2391 100644
--- a/README.md
+++ b/README.md
@@ -2,6 +2,7 @@
 
 <!-- badges: start -->
 [![Lifecycle: experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://lifecycle.r-lib.org/articles/stages.html#experimental)
+[![R-CMD-check](https://github.com/UCLH-Foundry/omop-data-catalogue/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/UCLH-Foundry/omop-data-catalogue/actions/workflows/R-CMD-check.yaml)
 <!-- badges: end -->
 
 The goal of calypso is to provide a summary of OMOP data and display it in a public data catalogue