Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor pipelines to get R version only once for downstream workflows #2199

Merged
merged 5 commits into from
Nov 7, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 48 additions & 18 deletions .github/workflows/common.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,43 +33,61 @@ concurrency:
group: admiral-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

env:
R_VERSION: "4.1"

jobs:
get_r_version:
name: Get R version
runs-on: ubuntu-latest
outputs:
r-version: ${{ steps.get_r_version.outputs.R_VERSION }}
steps:
- name: Get R Version for Downstream Container Jobs
id: get_r_version
run: echo "R_VERSION=$R_VERSION" >> $GITHUB_OUTPUT
shell: bash
Comment on lines +40 to +49
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We also need to make similar changes in other repositories (ophtha etc)

style:
name: Code Style
uses: pharmaverse/admiralci/.github/workflows/style.yml@main
uses: pharmaverse/admiralci/.github/workflows/style.yml@no-get-r-version-job
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change these back to main when pharmaverse/admiralci#160 is merged

if: github.event_name == 'pull_request'
needs: get_r_version
with:
r-version: "4.1"
r-version: "${{ needs.get_r_version.outputs.r-version }}"
spellcheck:
name: Spelling
uses: pharmaverse/admiralci/.github/workflows/spellcheck.yml@main
uses: pharmaverse/admiralci/.github/workflows/spellcheck.yml@no-get-r-version-job
if: github.event_name == 'pull_request'
needs: get_r_version
with:
r-version: "4.1"
r-version: "${{ needs.get_r_version.outputs.r-version }}"
readme:
name: Render README
uses: pharmaverse/admiralci/.github/workflows/readme-render.yml@main
uses: pharmaverse/admiralci/.github/workflows/readme-render.yml@no-get-r-version-job
if: github.event_name == 'push'
needs: get_r_version
with:
r-version: "4.1"
r-version: "${{ needs.get_r_version.outputs.r-version }}"
validation:
name: Validation
uses: pharmaverse/admiralci/.github/workflows/r-pkg-validation.yml@main
uses: pharmaverse/admiralci/.github/workflows/r-pkg-validation.yml@no-get-r-version-job
if: github.event_name == 'release'
needs: get_r_version
with:
r-version: "4.1"
r-version: "${{ needs.get_r_version.outputs.r-version }}"
check:
name: Check
uses: pharmaverse/admiralci/.github/workflows/r-cmd-check.yml@main
uses: pharmaverse/admiralci/.github/workflows/r-cmd-check.yml@no-get-r-version-job
with:
error-on: warning # TODO: find a way to ignore specific notes
if: github.event_name == 'pull_request'
docs:
name: Documentation
uses: pharmaverse/admiralci/.github/workflows/pkgdown.yml@main
uses: pharmaverse/admiralci/.github/workflows/pkgdown.yml@no-get-r-version-job
if: github.event_name == 'push' || startsWith(github.ref, 'refs/tags/v')
needs: get_r_version
with:
r-version: "4.1"
r-version: "${{ needs.get_r_version.outputs.r-version }}"
# Whether to skip multiversion docs
# Note that if you have multiple versions of docs,
# your URL links are likely to break due to path changes
Expand All @@ -80,28 +98,40 @@ jobs:
^cran-release$|^v([0-9]+\\.)?([0-9]+\\.)?([0-9]+)$
linter:
name: Lint
uses: pharmaverse/admiralci/.github/workflows/lintr.yml@main
uses: pharmaverse/admiralci/.github/workflows/lintr.yml@no-get-r-version-job
needs: get_r_version
if: github.event_name == 'pull_request'
with:
r-version: "4.1"
r-version: "${{ needs.get_r_version.outputs.r-version }}"
links:
name: Links
uses: pharmaverse/admiralci/.github/workflows/links.yml@main
uses: pharmaverse/admiralci/.github/workflows/links.yml@no-get-r-version-job
if: github.event_name == 'pull_request'
coverage:
name: Code Coverage
uses: pharmaverse/admiralci/.github/workflows/code-coverage.yml@main
uses: pharmaverse/admiralci/.github/workflows/code-coverage.yml@no-get-r-version-job
if: >
github.event_name != 'release'
needs: get_r_version
with:
r-version: "4.1"
r-version: "${{ needs.get_r_version.outputs.r-version }}"
# Whether to skip code coverage badge creation
# Setting to 'false' will require you to create
# an orphan branch called 'badges' in your repository
skip-coverage-badges: false
man-pages:
name: Man Pages
uses: pharmaverse/admiralci/.github/workflows/man-pages.yml@main
uses: pharmaverse/admiralci/.github/workflows/man-pages.yml@no-get-r-version-job
if: github.event_name == 'pull_request'
needs: get_r_version
with:
r-version: "${{ needs.get_r_version.outputs.r-version }}"
templates:
name: Check Templates
uses: pharmaverse/admiralci/.github/workflows/check-templates.yml@no-get-r-version-job
secrets: inherit
if: github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch'
needs: get_r_version
with:
r-version: "4.1"
r-version: "${{ needs.get_r_version.outputs.r-version }}"
push-templates-data: true
17 changes: 0 additions & 17 deletions .github/workflows/templates.yml

This file was deleted.

Loading