Skip to content

Commit

Permalink
fix: Add explicit git-ref for SD action
Browse files Browse the repository at this point in the history
  • Loading branch information
cicdguy committed Nov 5, 2024
1 parent 4c183d1 commit a86f33c
Show file tree
Hide file tree
Showing 14 changed files with 47 additions and 30 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/check-r-tags.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ concurrency:

jobs:
check-r-release:
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
steps:
- name: List rocker/rstudio tags
run: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/check-templates.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
name: Verify
if: >
!contains(github.event.commits[0].message, '[skip check_templates]')
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
container:
image: "ghcr.io/pharmaverse/admiralci-${{ inputs.r-version }}:latest"
env:
Expand All @@ -56,7 +56,7 @@ jobs:

- name: Add safe directory
run: |
git config --global --add safe.directory "${GITHUB_WORKSPACE}" # open issue: git dubious ownership running in docker container context: https://github.com/actions/runner/issues/2033
git config --global --add safe.directory "${GITHUB_WORKSPACE}"
shell: bash

- name: Normalize inputs
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/code-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ concurrency:
jobs:
coverage:
name: Test Coverage
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
container:
image: "ghcr.io/pharmaverse/admiralci-${{ inputs.r-version }}:latest"
if: >
Expand Down Expand Up @@ -81,6 +81,7 @@ jobs:
renv-restore: false
enable-check: false
direction: upstream
git-ref: ${{ steps.branch-name.outputs.current_branch }}
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/common.yml.inactive
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ env:
jobs:
get_r_version:
name: Get R version
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
outputs:
r-version: ${{ steps.get_r_version.outputs.R_VERSION }}
steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/cran-status.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ concurrency:
jobs:
cran-status:
name: Check Status
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
container:
image: rocker/tidyverse:latest
steps:
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/lintr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ concurrency:
jobs:
lint:
name: Lint
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
container:
image: "ghcr.io/pharmaverse/admiralci-${{ inputs.r-version }}:latest"
if: >
Expand Down Expand Up @@ -96,6 +96,7 @@ jobs:
renv-restore: false
enable-check: false
direction: upstream
git-ref: ${{ steps.branch-name.outputs.current_branch }}
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}

Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/man-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ concurrency:
jobs:
lint:
name: Roxygen
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
container:
image: "ghcr.io/pharmaverse/admiralci-${{ inputs.r-version }}:latest"
if: >
Expand Down Expand Up @@ -66,6 +66,7 @@ jobs:
renv-restore: false
enable-check: false
direction: upstream
git-ref: ${{ steps.branch-name.outputs.current_branch }}
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}

Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ concurrency:
jobs:
pkgdown:
name: pkgdown
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
container:
image: "ghcr.io/pharmaverse/admiralci-${{ inputs.r-version }}:latest"
env:
Expand Down Expand Up @@ -149,6 +149,7 @@ jobs:
renv-restore: false
enable-check: false
direction: upstream
git-ref: ${{ steps.branch-name.outputs.current_branch }}
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}

Expand Down Expand Up @@ -267,7 +268,7 @@ jobs:
multi-version-docs:
name: Multi-version docs
needs: pkgdown
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
if: >
!inputs.skip-multiversion-docs &&
!contains(github.event.commits[0].message, '[skip docs]')
Expand Down
36 changes: 23 additions & 13 deletions .github/workflows/push-docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ concurrency:

jobs:
get_old_release:
runs-on: ubuntu-22.04
name: Get Old Release Version
runs-on: ubuntu-latest
outputs:
oldrel: ${{ steps.oldrelease.outputs.oldrelease }}

Expand All @@ -28,10 +29,11 @@ jobs:
run: echo "oldrelease=${{ env.OLD_RELEASE }}" >> $GITHUB_OUTPUT

deploy-image:
runs-on: ubuntu-22.04
name: Deploy Image
runs-on: ubuntu-latest
needs: ["get_old_release"]
strategy:
fail-fast: false # if one of the job "deploy-image" fails, the other parallel jobs will just continue
fail-fast: false
matrix:
tags: ["devel", "latest", "${{ needs.get_old_release.outputs.oldrel }}"]

Expand All @@ -46,19 +48,27 @@ jobs:
with:
fetch-depth: 0

- name: Print message
run: |
echo "updating docker image for R version ${{ matrix.tags }}"
- name: Set image specs
id: image_specs
run: |
package_name=$(grep "Package:" DESCRIPTION | awk '{print $NF}')
if [ "${{ matrix.tags }}" == "latest" ]; then image_name="${package_name}-release"; else image_name="${package_name}-${{ matrix.tags }}"; fi
if [ "${{ matrix.tags }}" == "devel" ]; then R_REPOS="https://packagemanager.posit.co/cran/__linux__/focal/latest"; fi
echo "r_repos=$R_REPOS" >> $GITHUB_OUTPUT
r_version="${{ matrix.tags }}"
if [ "$r_version" == "${{ env.OLD_RELEASE }}" ]; then image_name="${package_name}-oldrel"; fi
########### LATEST aka RELEAESE IMAGE NAME ###########
if [ "${{ matrix.tags }}" == "latest" ]; then
image_name="${package_name}-release"
else
image_name="${package_name}-${{ matrix.tags }}"
fi
########### DEVEL IMAGE NAME ###########
if [ "${{ matrix.tags }}" == "devel" ]; then
R_REPOS="https://packagemanager.posit.co/cran/__linux__/focal/latest"
fi
########### OLDREL IMAGE NAME ###########
if [ "$r_version" == "${{ env.OLD_RELEASE }}" ]; then
image_name="${package_name}-oldrel"
fi
#### Set outputs ####
echo "r_repos=$R_REPOS" >> $GITHUB_OUTPUT
echo "image_name=${image_name}" >> $GITHUB_OUTPUT
- name: Call deploy docker image action ${{ matrix.tags }}
Expand Down Expand Up @@ -122,8 +132,8 @@ jobs:
xmlparsedata
store_deps:
name: Store Deps
runs-on: ubuntu-22.04
name: Upload Image Manifests
runs-on: ubuntu-latest
needs: ["get_old_release", "deploy-image"]
container:
image: "ghcr.io/pharmaverse/admiralci-${{ matrix.tags }}:latest"
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/r-cmd-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ concurrency:

jobs:
R-CMD-check:
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
container:
image: "ghcr.io/pharmaverse/admiralci-${{ matrix.r_version }}:latest"
name: (${{ matrix.r_version }})
Expand Down Expand Up @@ -73,8 +73,6 @@ jobs:
github.event_name != 'pull_request'
with:
ref: ${{ steps.branch-name.outputs.head_ref_branch }}
set-safe-directory: true
fetch-depth: 0

- name: Restore cache
uses: actions/cache@v4
Expand All @@ -89,6 +87,7 @@ jobs:
(github.event_name == 'workflow_dispatch' && matrix.r_version == 'devel') ||
matrix.r_version != 'devel'
with:
git-ref: ${{ steps.branch-name.outputs.current_branch }}
run-system-dependencies: false
renv-restore: false
enable-check: false
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/r-pkg-validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ on:
jobs:
r-pkg-validation:
name: Generate
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
container:
image: "ghcr.io/pharmaverse/admiralci-${{ inputs.r-version }}:latest"
# Set Github token permissions
Expand Down Expand Up @@ -69,6 +69,7 @@ jobs:
enable-check: false
cran-repos: "RSPM=${{ env.R_REPOS }}"
direction: upstream
git-ref: ${{ steps.branch-name.outputs.current_branch }}
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}

Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/readme-render.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ on:
jobs:
render:
name: Render
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
container:
image: "ghcr.io/pharmaverse/admiralci-${{ inputs.r-version }}:latest"
env:
Expand Down Expand Up @@ -70,6 +70,7 @@ jobs:
renv-restore: false
enable-check: false
direction: upstream
git-ref: ${{ steps.branch-name.outputs.current_branch }}
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}

Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/spellcheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ concurrency:
jobs:
spellcheck:
name: Spellcheck
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
container:
image: "ghcr.io/pharmaverse/admiralci-${{ inputs.r-version }}:latest"
env:
Expand Down Expand Up @@ -77,6 +77,7 @@ jobs:
renv-restore: false
enable-check: false
direction: upstream
git-ref: ${{ steps.branch-name.outputs.current_branch }}
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
##################### END boilerplate steps #####################
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/style.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ concurrency:
jobs:
style:
name: Code Style
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
container:
image: "ghcr.io/pharmaverse/admiralci-${{ inputs.r-version }}:latest"
if: >
Expand Down Expand Up @@ -65,6 +65,7 @@ jobs:
renv-restore: false
enable-check: false
direction: upstream
git-ref: ${{ steps.branch-name.outputs.current_branch }}
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
##################### END boilerplate steps #####################
Expand Down

0 comments on commit a86f33c

Please sign in to comment.