refactor: remove redundant field resets from transition functions
#535
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Workflow derived from https://github.com/r-lib/actions/tree/v2/examples | |
| # Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - master | |
| pull_request: | |
| branches: | |
| - main | |
| - master | |
| workflow_dispatch: | |
| inputs: | |
| debug_enabled: | |
| type: boolean | |
| description: 'Run the build with tmate debugging enabled' | |
| required: false | |
| default: false | |
| os: | |
| type: string | |
| description: 'Only run for specified OS' | |
| required: false | |
| default: "all" | |
| name: R-CMD-check | |
| jobs: | |
| R-CMD-check: | |
| if: >- | |
| ${{ | |
| ( | |
| github.event_name != 'push' || | |
| !contains(github.event.head_commit.message, '[ci skip]') | |
| ) && | |
| ( | |
| github.event_name != 'pull_request' || | |
| ( | |
| !contains(github.event.pull_request.title, '[ci skip]') && | |
| !contains(github.event.pull_request.body, '[ci skip]') | |
| ) | |
| ) | |
| }} | |
| runs-on: ${{ matrix.config.os }} | |
| name: ${{ matrix.config.os }} (${{ matrix.config.r }}) | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| config: | |
| - {os: windows-latest, r: 'release', not_cran: false} | |
| - {os: macOS-latest, r: 'release', not_cran: false} | |
| - {os: ubuntu-latest, r: 'devel', not_cran: true} | |
| env: | |
| GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | |
| R_KEEP_PKG_SOURCE: true | |
| NOT_CRAN: ${{ matrix.config.not_cran }} | |
| RGL_USE_NULL: true | |
| # for check non-character input in `base::numeric_version()` | |
| _R_CHECK_STOP_ON_INVALID_NUMERIC_VERSION_INPUTS_: true | |
| DISPLAY: 99 # for rgl | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - uses: r-lib/actions/setup-r@v2 | |
| with: | |
| r-version: ${{ matrix.config.r }} | |
| use-public-rspm: true | |
| - uses: r-lib/actions/setup-pandoc@v2 | |
| - uses: r-lib/actions/setup-r-dependencies@v2 | |
| with: | |
| extra-packages: any::rcmdcheck, any::pkgload | |
| needs: check | |
| - name: Locate DuckDB extension cache | |
| id: duckdb-ext-cache | |
| if: ${{ matrix.config.os == 'ubuntu-latest' && matrix.config.not_cran }} | |
| run: | | |
| home <- tools::R_user_dir("duckdb", "data") | |
| dir <- file.path(home, "extensions") | |
| dir.create(dir, recursive = TRUE, showWarnings = FALSE) | |
| out <- Sys.getenv("GITHUB_OUTPUT") | |
| cat("path=", dir, "\n", file = out, append = TRUE, sep = "") | |
| cat("version=", as.character(utils::packageVersion("duckdb")), "\n", file = out, append = TRUE, sep = "") | |
| # DuckDB otherwise uses a per-session temp directory that later checks cannot share. | |
| cat("DUCKDB_R_HOME=", home, "\n", file = Sys.getenv("GITHUB_ENV"), append = TRUE, sep = "") | |
| shell: Rscript {0} | |
| - name: Restore DuckDB extension cache | |
| id: cache-duckdb-ext | |
| if: ${{ matrix.config.os == 'ubuntu-latest' && matrix.config.not_cran }} | |
| uses: actions/cache/restore@v4 | |
| with: | |
| path: ${{ steps.duckdb-ext-cache.outputs.path }} | |
| key: ${{ runner.os }}-${{ runner.arch }}-duckdb-ext-${{ steps.duckdb-ext-cache.outputs.version }}-sqlite-v1 | |
| - name: Restore EnergyPlus cache | |
| id: cache-eplus | |
| if: ${{ matrix.config.os == 'ubuntu-latest' && matrix.config.not_cran }} | |
| uses: actions/cache/restore@v4 | |
| with: | |
| path: ~/.local/EnergyPlus-* | |
| key: ${{ runner.os }}-energyplus-${{ hashFiles('R/constants.R') }}-latest | |
| - name: Prepare EnergyPlus | |
| if: ${{ matrix.config.os == 'ubuntu-latest' && matrix.config.not_cran }} | |
| run: | | |
| pkgload::load_all(".", quiet = TRUE, export_all = FALSE) | |
| latest <- get("LATEST_EPLUS_VER", asNamespace("eplusr")) | |
| if (!eplusr::is_avail_eplus(latest)) eplusr::install_eplus(latest, local = TRUE) | |
| stopifnot(eplusr::is_avail_eplus(latest)) | |
| message("EnergyPlus ", latest, ": ", eplusr::eplus_config(latest)$dir) | |
| shell: Rscript {0} | |
| - name: Install DuckDB SQLite extension | |
| if: ${{ matrix.config.os == 'ubuntu-latest' && matrix.config.not_cran }} | |
| run: | | |
| pkgload::load_all(".", quiet = TRUE, export_all = FALSE) | |
| eplusr::install_duckdb_sqlite() | |
| shell: Rscript {0} | |
| - name: Save DuckDB extension cache | |
| if: ${{ matrix.config.os == 'ubuntu-latest' && matrix.config.not_cran && steps.cache-duckdb-ext.outputs.cache-hit != 'true' }} | |
| continue-on-error: true | |
| uses: actions/cache/save@v4 | |
| with: | |
| path: ${{ steps.duckdb-ext-cache.outputs.path }} | |
| key: ${{ steps.cache-duckdb-ext.outputs.cache-primary-key }} | |
| - name: Save EnergyPlus cache | |
| if: ${{ matrix.config.os == 'ubuntu-latest' && matrix.config.not_cran && steps.cache-eplus.outputs.cache-hit != 'true' }} | |
| uses: actions/cache/save@v4 | |
| with: | |
| path: ~/.local/EnergyPlus-* | |
| key: ${{ steps.cache-eplus.outputs.cache-primary-key }} | |
| - uses: r-lib/actions/check-r-package@v2 | |
| # Enable tmate debugging of manually-triggered workflows if the input option was provided | |
| - name: Setup tmate session | |
| uses: mxschmitt/action-tmate@v3 | |
| if: ${{ github.event_name == 'workflow_dispatch' && inputs.debug_enabled && (inputs.os == matrix.config.os || inputs.os == 'all') }} | |
| with: | |
| limit-access-to-actor: true |