r-hyperspec / hySpc.read.txt

Import ASCII formatted data into hyperSpec
https://r-hyperspec.github.io/hySpc.read.txt/
MIT License
0 stars 1 forks source link

Simplify GHA script #16

Closed bryanhanson closed 4 years ago

bryanhanson commented 4 years ago

Test whether the GHA script can be simplified to deploy to just the master branch. This is issue https://github.com/r-hyperspec/hySpc.pkgs/issues/3

GegznaV commented 4 years ago

I was experimenting with drat workflow.

The script is below.

drat.yaml ```yaml on: push: branches: - master # Note on the above: if more than one branch given one may stomp on the other name: drat jobs: drat: runs-on: ${{ matrix.config.os }} name: ${{ matrix.config.os }} (R-${{ matrix.config.r }}) strategy: fail-fast: false matrix: config: - {os: ubuntu-16.04, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/xenial/latest"} # - {os: ubuntu-16.04, r: 'oldrel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/xenial/latest"} # - {os: ubuntu-16.04, r: 'devel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/xenial/latest"} # - {os: windows-latest, r: 'release'} # - {os: windows-latest, r: 'oldrel'} # - {os: windows-latest, r: 'devel'} # - {os: macOS-latest, r: 'release'} # - {os: macOS-latest, r: 'oldrel'} # - {os: macOS-latest, r: 'devel'} env: R_REMOTES_NO_ERRORS_FROM_WARNINGS: true RSPM: ${{ matrix.config.rspm }} SOURCE_REPO: ${{ github.repository }} DEST_REPO: r-hyperspec/hySpc.pkgs TMP_DIR: tmp_dir steps: - uses: actions/checkout@v2 - uses: r-lib/actions/setup-r@master with: r-version: ${{ matrix.config.r }} - name: Query dependencies run: | install.packages('remotes') saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2) writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version") shell: Rscript {0} - name: Cache R packages if: runner.os != 'Windows' uses: actions/cache@v1 with: path: ${{ env.R_LIBS_USER }} key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }} restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1- - name: Install system dependencies if: runner.os == 'Linux' env: RHUB_PLATFORM: linux-x86_64-ubuntu-gcc run: | Rscript -e "remotes::install_github('r-hub/sysreqs')" sysreqs=$(Rscript -e "cat(sysreqs::sysreq_commands('DESCRIPTION'))") sudo -s eval "$sysreqs" - name: Install dependencies run: | remotes::install_cran(c("rcmdcheck", "roxygen2", "drat")) remotes::install_deps(dependencies = TRUE) shell: Rscript {0} - name: Roxygenize run: roxygen2::roxygenize() shell: Rscript {0} - name: Build and Check env: _R_CHECK_CRAN_INCOMING_REMOTE_: false run: | rcmdcheck::rcmdcheck( args = c("--no-manual", "--as-cran"), error_on = "warning", check_dir = "check" ) shell: Rscript {0} - name: Upload check results if: failure() uses: actions/upload-artifact@master with: name: ${{ runner.os }}-r${{ matrix.config.r }}-results path: check # The steps to include built package in ${DEST_REPO} - name: Git clone ${{ env.DEST_REPO }} uses: actions/checkout@v2 with: repository: ${{ env.DEST_REPO }} # e.g., 'r-hyperspec/hySpc.pkgs' ref: 'master' path: "${{ env.TMP_DIR }}" token: "${{ secrets.DEPLOY_DRAT_TOKEN }}" # fetch-depth: '' - name: Drat -- insert if: success() run: | built_package <- list.files( path = "check", pattern = "[.]tar[.]gz", full.names = TRUE ) drat::insertPackage( file = built_package, repodir = Sys.getenv("TMP_DIR"), action = "archive" ) shell: Rscript {0} - name: Drat -- update README.md if: success() run: | cd ${TMP_DIR} # grab the portion of the file we want to re-use awk '/^# hySpc\.pkgs$/, /^Packages currently residing here:$/' README.md > README.tmp # Append the listing of .tar.gz present, along a little formating # (appending to .md that will be parsed and displayed by GH) echo "" > README.tmp # add blank line ls -lhR --time-style=long-iso | grep \.tar\.gz$ | awk '{print "- "$8, " ("$6")"}' >> README.tmp mv README.tmp README.md - name: Drat -- commit and push if: success() run: | git config --global user.email "actions@github.com" git config --global user.name "GitHub Actions" cd ${TMP_DIR} # move into the subdir, which is Git controlled git add * git commit -m "Update from ${SOURCE_REPO}" || echo "Nothing to commit" git push origin master || echo "Nothing to commit" ```
GegznaV commented 4 years ago

I tried this workflow in my other project, but I'm still facing the issue that the dates are updated incorrectly when several packages are used (see the details in https://github.com/r-hyperspec/hySpc.pkgs/issues/4)

bryanhanson commented 4 years ago

I’m currently making some significant changes to make it more robust.

On Aug 15, 2020, at 9:36 PM, Vilmantas Gegzna notifications@github.com wrote:

I tried this workflow in my other project, but I'm still facing the issue that the dates are updated incorrectly when several packages are used (see the details in r-hyperspec/hySpc.pkgs#4 https://github.com/r-hyperspec/hySpc.pkgs/issues/4)

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/r-hyperspec/hySpc.read.txt/issues/16#issuecomment-674466223, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABCIPXEUEO43MQQJ5WNAQLSA4Z2ZANCNFSM4QAP5REA.

bryanhanson commented 4 years ago

Just completed an overhaul. I don't think the previous version really worked, I think it gave the appearance of working, combined with the occasional change in hySpc.pkgs it was very misleading.

The new version works quite robustly. It's on feature/issue-16.

Sunday I will incorporate many of the suggestions you shared above in drat.yml Solid work my friend.

bryanhanson commented 4 years ago

Closed via https://github.com/r-hyperspec/hySpc.read.txt/commit/96832bed7f48fadec0e9f047f12cacb0faeba53e