Skip to content

Commit fea924d

Browse files
authored
Runtime Version Scanner: Run tests in CI (#227)
1 parent 24daae5 commit fea924d

File tree

17 files changed

+2564
-8
lines changed

17 files changed

+2564
-8
lines changed

.github/workflows/extensions.yml

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@ jobs:
186186
# Be sure the extension name and directory name it is in are the same
187187
publisher-command-center: ${{ steps.changes.outputs.publisher-command-center }}
188188
package-vulnerability-scanner: ${{ steps.changes.outputs.package-vulnerability-scanner }}
189+
runtime-version-scanner: ${{ steps.changes.outputs.runtime-version-scanner }}
189190

190191
steps:
191192
- uses: actions/checkout@v4
@@ -200,6 +201,7 @@ jobs:
200201
filters: |
201202
publisher-command-center: extensions/publisher-command-center/**
202203
package-vulnerability-scanner: extensions/package-vulnerability-scanner/**
204+
runtime-version-scanner: extensions/runtime-version-scanner/**
203205
204206
# Creates and releases the Publisher Command Center extension using a custom
205207
# workflow
@@ -220,6 +222,15 @@ jobs:
220222
uses: ./.github/workflows/package-vulnerability-scanner.yml
221223
secrets: inherit
222224

225+
# Creates and releases the Runtime Version Scanner extension using a custom workflow
226+
runtime-version-scanner:
227+
needs: [complex-extension-changes]
228+
# Only runs if the `complex-extension-changes` job detects changes in the
229+
# runtime-version-scanner extension directory
230+
if: ${{ needs.complex-extension-changes.outputs.runtime-version-scanner == 'true' }}
231+
uses: ./.github/workflows/runtime-version-scanner.yml
232+
secrets: inherit
233+
223234
# All extensions have been linted, packaged, and released, if necessary
224235
# Continuing to update the extension list with the latest release data
225236

@@ -230,7 +241,12 @@ jobs:
230241
runs-on: ubuntu-latest
231242
# Requires that the `simple-extensions` and all custom workflow jobs are
232243
# completed before running this job
233-
needs: [simple-extension-release, publisher-command-center, package-vulnerability-scanner]
244+
needs: [
245+
simple-extension-release,
246+
publisher-command-center,
247+
package-vulnerability-scanner,
248+
runtime-version-scanner
249+
]
234250
if: ${{ always() }}
235251
outputs:
236252
releases: ${{ steps.fetch-releases.outputs.releases }}
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
name: Runtime Version Scanner
2+
3+
# Re-usable workflows use the `workflow_call` trigger
4+
# https://docs.github.com/en/actions/sharing-automations/reusing-workflows#creating-a-reusable-workflow
5+
on:
6+
workflow_call:
7+
8+
# Setup the environment with the extension name for easy re-use
9+
# Also set the GH_TOKEN for the release-extension action to be able to use gh
10+
env:
11+
EXTENSION_NAME: runtime-version-scanner
12+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
13+
14+
jobs:
15+
extension:
16+
runs-on: ubuntu-latest
17+
defaults:
18+
run:
19+
working-directory: ./extensions/${{ env.EXTENSION_NAME }}
20+
21+
steps:
22+
# Checkout the repository so the rest of the actions can run with no issue
23+
- uses: actions/checkout@v4
24+
25+
# We want to fail quickly if the linting fails, do that first
26+
- uses: ./.github/actions/lint-extension
27+
with:
28+
extension-name: ${{ env.EXTENSION_NAME }}
29+
30+
# ---
31+
# Run R tests
32+
# ---
33+
34+
- uses: r-lib/actions/setup-r@v2
35+
with:
36+
r-version: '4.3.3'
37+
38+
- uses: r-lib/actions/setup-renv@v2
39+
with:
40+
working-directory: extensions/${{ env.EXTENSION_NAME }}
41+
42+
- run: Rscript -e 'install.packages("testthat")'
43+
working-directory: extensions/${{ env.EXTENSION_NAME }}
44+
45+
- run: Rscript -e 'testthat::test_dir("tests/testthat")'
46+
working-directory: extensions/${{ env.EXTENSION_NAME }}
47+
48+
# Now that the extension is built we need to upload an artifact to pass
49+
# to the package-extension action that contains the files we want to be
50+
# included in the extension
51+
# This only includes necessary files for the extension to run leaving out
52+
# the files that were used to build the /dist/ directory
53+
- name: Upload built extension
54+
uses: actions/upload-artifact@v4
55+
with:
56+
name: ${{ env.EXTENSION_NAME }}
57+
# Replace the below with the files your content needs
58+
path: |
59+
extensions/${{ env.EXTENSION_NAME }}/app.R
60+
extensions/${{ env.EXTENSION_NAME }}/connect_module.R
61+
extensions/${{ env.EXTENSION_NAME }}/get_usage.R
62+
extensions/${{ env.EXTENSION_NAME }}/renv.lock
63+
extensions/${{ env.EXTENSION_NAME }}/version_ordering.R
64+
extensions/${{ env.EXTENSION_NAME }}/www/styles.css
65+
extensions/${{ env.EXTENSION_NAME }}/manifest.json
66+
67+
# Package up the extension into a TAR using the package-extension action
68+
- uses: ./.github/actions/package-extension
69+
with:
70+
extension-name: ${{ env.EXTENSION_NAME }}
71+
artifact-name: ${{ env.EXTENSION_NAME }}
72+
73+
connect-integration-tests:
74+
needs: extension
75+
uses: ./.github/workflows/connect-integration-tests.yml
76+
secrets: inherit
77+
with:
78+
extensions: '["runtime-version-scanner"]' # JSON array format to match the workflow input schema
79+
80+
release:
81+
runs-on: ubuntu-latest
82+
needs: [extension, connect-integration-tests]
83+
# Release the extension using the release-extension action
84+
# Will only create a GitHub release if merged to `main` and the semver
85+
# version has been updated
86+
steps:
87+
# Checkout the repository so the rest of the actions can run with no issue
88+
- uses: actions/checkout@v4
89+
90+
- uses: ./.github/actions/release-extension
91+
with:
92+
extension-name: ${{ env.EXTENSION_NAME }}

extensions/eol-runtime-scanner/Makefile

Lines changed: 0 additions & 4 deletions
This file was deleted.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.PHONY: test
2+
3+
test:
4+
Rscript -e 'testthat::test_dir("tests/testthat")'
File renamed without changes.

0 commit comments

Comments
 (0)