diff --git a/.github/versions-matrix.R b/.github/versions-matrix.R index 33a7b24c0..1bc7dd517 100644 --- a/.github/versions-matrix.R +++ b/.github/versions-matrix.R @@ -1,14 +1,25 @@ list( + # Backend runs: DM_TEST_SRC selects the database backend + # (see tests/testthat/helper-src.R), and the custom after-install action + # provisions the matching server. The variables travel through the generic + # "env" matrix field, which the rcc-full job applies to the environment of + # all steps. SKIP_UPDATE_SNAPSHOTS opts these entries out of the snapshot + # updater, which would otherwise run the test suite a second time against + # the backend and accept backend-specific snapshots. data.frame( os = "ubuntu-22.04", r = "release", - test_src = c( - "test-mssql", - "test-postgres", - "test-maria", - "test-mysql-maria", - "test-duckdb", - "test-sqlite" + env = paste0( + "DM_TEST_SRC=", + c( + "test-mssql", + "test-postgres", + "test-maria", + "test-mysql-maria", + "test-duckdb", + "test-sqlite" + ), + "\nSKIP_UPDATE_SNAPSHOTS=true" ), covr = "true", desc = c( @@ -20,14 +31,14 @@ list( "SQLite with covr" ) ), - # Instrumented validation run. The DM_VALIDATE flag travels through the - # generic "env" matrix field to the custom before/after-install actions, - # which uncomment code marked "# INSTRUMENT: validate" and opt out of the - # snapshot updater. covr then builds and tests the instrumented sources. + # Instrumented validation run. DM_VALIDATE makes the custom after-install + # action uncomment code marked "# INSTRUMENT: validate"; covr then builds + # and tests the instrumented sources. SKIP_UPDATE_SNAPSHOTS opts out of the + # snapshot updater, which would otherwise run the instrumented tests twice. data.frame( os = "ubuntu-22.04", r = "release", - env = "DM_VALIDATE=true", + env = "DM_VALIDATE=true\nSKIP_UPDATE_SNAPSHOTS=true", covr = "true", desc = "instrumented validation" ) diff --git a/.github/workflows/custom/before-install/action.yml b/.github/workflows/custom/before-install/action.yml index 660a6a20f..cfb50641d 100644 --- a/.github/workflows/custom/before-install/action.yml +++ b/.github/workflows/custom/before-install/action.yml @@ -1,45 +1,19 @@ name: 'Custom steps to run before R packages are installed' -inputs: - env: - description: > - Additional environment variables (one KEY=VALUE per line) contributed by - the test matrix. Generic hook used by .github/versions-matrix.R to flag - special matrix entries (e.g. the instrumented-validation entry below). - required: false - default: "" +# Environment variables from the "env" field of test matrix entries +# (see .github/versions-matrix.R: DM_TEST_SRC, DM_VALIDATE, +# SKIP_UPDATE_SNAPSHOTS) are applied by the rcc-full job in R-CMD-check.yaml +# before this action runs, so they are already visible here +# and in all later steps. runs: using: "composite" steps: - - name: Apply environment variables from the test matrix - if: inputs.env != '' - env: - MATRIX_ENV: ${{ inputs.env }} - run: | - printf '%s\n' "$MATRIX_ENV" | tee -a "$GITHUB_ENV" - shell: bash - - # The instrumented-validation matrix entry sets DM_VALIDATE=true via the - # generic "env" field. Opt it out of the snapshot updater, which bypasses - # tests/testthat.R via testthat::test_local() and would otherwise run the - # instrumented tests twice. - - name: Opt out of the snapshot updater (instrumented validation) - if: env.DM_VALIDATE != '' - run: | - echo 'SKIP_UPDATE_SNAPSHOTS=true' | tee -a "$GITHUB_ENV" - shell: bash - - name: Define _R_CHECK_PKG_SIZES_THRESHOLD_ run: | echo '_R_CHECK_PKG_SIZES_THRESHOLD_=10' | tee -a $GITHUB_ENV shell: bash - - name: Define DM_TEST_SRC - run: | - echo "DM_TEST_SRC=${{ matrix.config.test-src }}" | tee -a $GITHUB_ENV - shell: bash - - name: Clean up broken mysql apt # FIXME: Remove if package becomes unavailable if: runner.os == 'Linux'