Skip to content

Commit

Permalink
chore: migrated tests to separate file
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kolomanski committed Jan 9, 2025
1 parent c52bbec commit 28dcd67
Show file tree
Hide file tree
Showing 2 changed files with 86 additions and 20 deletions.
27 changes: 7 additions & 20 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,20 +32,23 @@ jobs:
id: get_r_version
run: echo "R_VERSION=$R_VERSION" >> $GITHUB_OUTPUT
shell: bash

spellcheck:
name: Spelling
uses: ./.github/workflows/spellcheck.yml
if: github.event_name == 'pull_request'
needs: get_r_version
with:
r-version: "${{ needs.get_r_version.outputs.r-version }}"

linter:
name: Lint
uses: ./.github/workflows/lintr.yml
needs: get_r_version
if: github.event_name == 'pull_request'
with:
r-version: "${{ needs.get_r_version.outputs.r-version }}"

man-pages:
name: Man Pages
uses: ./.github/workflows/man-pages.yml
Expand All @@ -56,28 +59,12 @@ jobs:

tests:
name: Tests
runs-on: ubuntu-latest
uses: ./.github/workflows/test.yml
needs: get_r_version
container:
image: "ghcr.io/pharmaverse/admiralci-${{ needs.get_r_version.outputs.r-version }}:latest"
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Install system dependencies
run: |
apt-get install -y --no-install-recommends \
libudunits2-dev
- name: Install dependencies
run: |
Rscript -e 'remotes::install_deps(dependencies = TRUE)'
if: github.event_name == 'pull_request'
with:
r-version: "${{ needs.get_r_version.outputs.r-version }}"

- name: Run tests
shell: Rscript {0}
run: |
devtools::load_all(".")
devtools::test()
check:
name: Check
uses: ./.github/workflows/r-cmd-check.yml
Expand Down
79 changes: 79 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: Spelling

on:
workflow_dispatch:
inputs:
r-version:
description: "The version of R to use"
default: "release"
required: false
type: choice
options:
- devel
- latest
workflow_call:
inputs:
r-version:
description: "The version of R to use"
default: "release"
required: false
type: string

concurrency:
group: spelling-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
tests:
name: Tests
runs-on: ubuntu-latest
container:
image: "ghcr.io/pharmaverse/admiralci-${{ inputs.r-version }}:latest"
steps:
- name: Get branch names
id: branch-name
uses: tj-actions/branch-names@v8

- name: Checkout repo (PR) 🛎
uses: actions/[email protected]
if: github.event_name == 'pull_request'
with:
ref: ${{ steps.branch-name.outputs.head_ref_branch }}
repository: ${{ github.event.pull_request.head.repo.full_name }}

- name: Checkout repository
uses: actions/[email protected]
if: github.event_name != 'pull_request'
with:
ref: ${{ steps.branch-name.outputs.head_ref_branch }}

- name: Restore cache
uses: actions/cache@v4
with:
path: |
~/.staged.dependencies
key: staged-deps

- name: Run Staged dependencies
uses: insightsengineering/staged-dependencies-action@v1
with:
run-system-dependencies: true
renv-restore: false
enable-check: false
direction: upstream
git-ref: ${{ steps.branch-name.outputs.current_branch }}
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}

- name: Install dependencies from DESCRIPTION
run: |
remotes::install_local(force = TRUE, dependencies = TRUE)
shell: Rscript {0}
env:
R_REMOTES_STANDALONE: "true"

- name: Run tests
shell: Rscript {0}
run: |
devtools::load_all(".")
devtools::test()

0 comments on commit 28dcd67

Please sign in to comment.