Skip to content

GitHub Action - R Package Validation

Source: r.pkg.template/validation.yaml at main ยท insightsengineering/r.pkg.template (github.com)

name: R Package Validation report ๐Ÿ“ƒ

on:
  push:
    tags:
      - "v*"
    branches:
      - main
  pull_request:
    branches:
      - main
      - pre-release
  workflow_call:
    inputs:
      install-system-dependencies:
        description: Check for and install system dependencies
        required: false
        default: false
        type: boolean
      enable-staged-dependencies-check:
        description: Enable staged dependencies YAML check
        required: false
        default: true
        type: boolean
    secrets:
      REPO_GITHUB_TOKEN:
        description: |
          Github token with read access to repositories, required for staged.dependencies installation
        required: false

jobs:
  r-pkg-validation:
    name: Create report ๐Ÿ“ƒ
    runs-on: ubuntu-latest
    if: "! contains(github.event.commits[0].message, '[skip validation]')"
    container:
      image: ghcr.io/insightsengineering/rstudio_4.1.2_bioc_3.14:latest
    env:
      GITHUB_PAT: ${{ secrets.REPO_GITHUB_TOKEN }}
    permissions:
      contents: write
      packages: write
      deployments: write
    steps:
      - name: Checkout repo ๐Ÿ›Ž
        uses: actions/checkout@v2

      - name: Run Staged dependencies ๐ŸŽฆ
        uses: insightsengineering/staged-dependencies-action@v1
        with:
          run-system-dependencies: ${{ inputs.install-system-dependencies }}
        env:
          SD_ENABLE_CHECK: ${{ inputs.enable-staged-dependencies-check }}

      - name: Build report ๐Ÿ—
        uses: insightsengineering/thevalidatoR@v1.1.2

      - name: Upload report for review โฌ†
        if: github.ref != 'refs/heads/main'
        uses: actions/upload-artifact@v2
        with:
          name: validation_report.pdf
          path: validation_report.pdf

  upload-release-assets:
    name: Upload report to release ๐Ÿ”ผ
    needs: r-pkg-validation
    runs-on: ubuntu-latest
    if: startsWith(github.ref, 'refs/tags/v')
    steps:
      - name: Wait for release to succeed โณ
        timeout-minutes: 2
        uses: lewagon/wait-on-check-action@v1.1.1
        with:
          ref: "${{ github.ref }}"
          check-name: "Release ๐Ÿš€"
          repo-token: ${{ secrets.GITHUB_TOKEN }}
          wait-interval: 10

      - name: Download artifact โฌ
        uses: actions/download-artifact@v2
        with:
          name: validation_report.pdf

      - name: Upload report to release ๐Ÿ”ผ
        uses: svenstaro/upload-release-action@v2
        with:
          file: ./validation_report.pdf
          asset_name: validation-report.pdf
          repo_token: ${{ secrets.GITHUB_TOKEN }}
          tag: ${{ github.ref }}
          overwrite: false

Backlinks:

list from [[GitHub Action - R Package Validation]] AND -"Changelog"