diff --git a/.Rbuildignore b/.Rbuildignore index 97cadc2e..531fcbbf 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -27,4 +27,4 @@ ^admiralci.*\.tgz$ ^staged_dependencies.yaml$ ^README.Rmd$ -^.devcontainer +^.devcontainer \ No newline at end of file diff --git a/.github/workflows/check-templates.yml b/.github/workflows/check-templates.yml index 5af0fc0f..059c44ae 100644 --- a/.github/workflows/check-templates.yml +++ b/.github/workflows/check-templates.yml @@ -365,13 +365,18 @@ jobs: id: branch run: | repo_name=$(basename "${{ github.repository }}") - echo "source-branch=${{ env.source-branch }}_${repo_name}@devel" >> $GITHUB_OUTPUT + source_br="${{ env.source-branch }}_${repo_name}" + source_grep=$(git branch -a | grep $source_br) + if [ -z $source_grep ]; then branch_exists=false; else branch_exists=true; fi + echo "source-branch=$source_br" >> $GITHUB_OUTPUT + echo "branch-exists=$branch_exists" >> $GITHUB_OUTPUT + warn_msg="WARNING:: the branch $source_br already exists in pharmaverseadam, please merge it and delete it, and re-execute this job" + if [ '${{ steps.changes.outputs.diff }}' == 'true' ] && [ '$branch_exists' == 'true' ]; then echo "$warn_msg"; fi shell: bash {0} - # if diff detected, push changes - name: Commit and push changes in {{ env.repo }} - if: ${{ inputs.push-templates-data && steps.changes.outputs.diff == 'true' }} + if: ${{ inputs.push-templates-data && steps.changes.outputs.diff == 'true' && steps.branch.outputs.branch-exists == 'false' }} uses: stefanzweifel/git-auto-commit-action@v4 with: commit_message: templates data updates from ${{ github.repository }} @@ -382,7 +387,7 @@ jobs: create_branch: true - name: Create Pull Request - if: ${{ inputs.push-templates-data && steps.changes.outputs.diff == 'true' }} + if: ${{ inputs.push-templates-data && steps.changes.outputs.diff == 'true' && steps.branch.outputs.branch-exists == 'false' }} uses: actions/github-script@v6 with: github-token: ${{ secrets.PHARMAVERSE_BOT }} diff --git a/.github/workflows/propagate.yml b/.github/workflows/propagate.yml index 3160f9db..ef04b288 100644 --- a/.github/workflows/propagate.yml +++ b/.github/workflows/propagate.yml @@ -13,6 +13,7 @@ on: - renv/** - .Rprofile - .devcontainer/* + workflow_dispatch: # give possibility to run it manually jobs: integrity: diff --git a/.github/workflows/push-docker-image.yml b/.github/workflows/push-docker-image.yml index d85cb83c..5d2677ec 100644 --- a/.github/workflows/push-docker-image.yml +++ b/.github/workflows/push-docker-image.yml @@ -8,6 +8,8 @@ on: paths: - 'renv/profiles/**/renv.lock' workflow_dispatch: # give possibility to run it manually + schedule: + - cron: '0 0 * * *' # Run every day at midnight UTC permissions: write-all env: @@ -50,6 +52,7 @@ jobs: echo "renv=[\"$renv_list\"]" >> $GITHUB_OUTPUT deploy-image: + if: github.event_name != 'schedule' needs: [ get_renv_list ] runs-on: ubuntu-latest strategy: @@ -77,10 +80,10 @@ jobs: run: | package_name=$(grep "Package:" DESCRIPTION | awk '{print $NF}') r_version=$(basename $(dirname ${{ matrix.value }})) # TODO: check here if legacy renv (if yes, delete _legacy suffix and add _legacy suffix to docker im?) - echo "r_version=$r_version" >> $GITHUB_OUTPUT - echo "image_name=$package_name-$r_version" >> $GITHUB_OUTPUT renv=$(echo "${{ matrix.value }}" | tr -d '"') echo "renv_lock_path=$renv" >> $GITHUB_OUTPUT + echo "r_version=$r_version" >> $GITHUB_OUTPUT + echo "image_name=$package_name-$r_version" >> $GITHUB_OUTPUT - name: Call deploy docker image action for every renv uses: insightsengineering/r-image-creator@v1 @@ -94,5 +97,40 @@ jobs: repo-user: ${{ github.actor }} # pharmaverse-bot repo-token: "${{ secrets.GITHUB_TOKEN }}" # ${{ secrets.PHARMAVERSE_BOT }} + deploy-image-devel: + runs-on: ubuntu-latest + # Token permissions + permissions: + contents: read + packages: write + + steps: + - name: Checkout repo + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Set image specs + id: image_specs + run: | + package_name=$(grep "Package:" DESCRIPTION | awk '{print $NF}') + echo "image_name=$package_name-devel" >> $GITHUB_OUTPUT + + - name: Call deploy docker image action devel + uses: insightsengineering/r-image-creator@v1 + with: + image-name: "${{ steps.image_specs.outputs.image_name }}" + tag-latest: true + base-image: "rocker/rstudio:devel" + sysdeps: qpdf,libxt-dev,curl,npm,libicu-dev,libcurl4-openssl-dev,libssl-dev,make,zlib1g-dev,libfontconfig1-dev,libfreetype6-dev,libfribidi-dev,libharfbuzz-dev,libjpeg-dev,libpng-dev,libtiff-dev,pandoc,libxml2-dev,libgit2-dev,libgit2-dev,jq + description-file: "./DESCRIPTION" + repository-owner: ${{ github.repository_owner }} + repo-user: ${{ github.actor }} # pharmaverse-bot + repo-token: "${{ secrets.GITHUB_TOKEN }}" # ${{ secrets.PHARMAVERSE_BOT }} + + +# refacto todo: image-name, sysdeps on get-renv-list job + + # note: in case of 403 error when pushing to ghcr : link current repo to the given package registry - https://github.com/docker/build-push-action/issues/687 # (got to https://github.com/?tab=packages to go to packages settings) and there https://github.com/users//packages/container/admiralci-4.0/settings \ No newline at end of file diff --git a/.github/workflows/r-cmd-check.yml b/.github/workflows/r-cmd-check.yml index 93f487ba..8af921dd 100644 --- a/.github/workflows/r-cmd-check.yml +++ b/.github/workflows/r-cmd-check.yml @@ -37,6 +37,7 @@ jobs: - {r: '4.1', repos: 'https://packagemanager.posit.co/cran/2021-05-03/'} - {r: '4.2', repos: 'https://packagemanager.posit.co/cran/2022-01-03/'} - {r: '4.3', repos: 'https://packagemanager.posit.co/cran/__linux__/focal/latest'} + - {r: 'devel', repos: 'https://packagemanager.posit.co/cran/__linux__/focal/latest'} # not needed for devel ? env: GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} @@ -81,11 +82,33 @@ jobs: GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} #####################c##################### + - name: Check Version + id: check_version + run: | + maintenance_version="F" + description_dat <- readLines("DESCRIPTION") + for (i in seq_along(description_dat)) { + if (grepl("^Version:", description_dat[i])) { + current_version <- sub("^Version: ", "", description_dat[i]) + version_parts <- strsplit(current_version, "\\.")[[1]] + # check if maintenance version - if yes, temp update the DESCRIPTION for rcmdchecks + if (length(version_parts) == 4) { + print("Maintenance version detected (format X.Y.Z.M with M >= 9000)") + maintenance_version="T" + } + } + } + cat(sprintf("maintenance_version=%s", maintenance_version), file = Sys.getenv("GITHUB_OUTPUT"), append = TRUE) + shell: Rscript {0} + - name: Check env: _R_CHECK_CRAN_INCOMING_REMOTE_: false _R_CHECK_FORCE_SUGGESTS_: false run: | + if ("${{steps.check_version.outputs.maintenance_version}}" == "T"){ + Sys.setenv("_R_CHECK_CRAN_INCOMING_SKIP_LARGE_VERSION_" = TRUE) + } if (!requireNamespace("rcmdcheck", quietly = TRUE)) install.packages("rcmdcheck") options(crayon.enabled = TRUE) check_error_on <- "${{ inputs.error-on }}" @@ -103,5 +126,5 @@ jobs: if: failure() uses: actions/upload-artifact@main with: - name: ${{ runner.os }}-r${{ matrix.config.r }}-results - path: check + name: r${{ matrix.config.r }}-results + path: check \ No newline at end of file