RWX
Selective detects RWX automatically (including runs still using the MINT environment). No setup step is needed beyond the secret.
Create a secret named SELECTIVE_API_KEY, make it available to the task, and swap the command:
- key: tests run: bundle exec selective rspecRun the task in parallel to add nodes. A working definition is in the selective-ruby-rspec repository.
Daily map recording
Section titled “Daily map recording”Test selection needs a fresh map of which files each test executes. Add a cron trigger that passes an init value, and set SELECTIVE_TEST_MAP_RECORD from it:
on: github: pull_request: init: record-map: false cron: - key: selective-map-recording schedule: "0 6 * * *" init: record-map: true
tasks: - key: tests run: bundle exec selective rspec env: SELECTIVE_TEST_MAP_RECORD: ${{ init.record-map }}The cron run prints Recording a test map. See keeping the map fresh.
The repository snapshot
Section titled “The repository snapshot”Selection compares the commit’s files against the map. The runner reads them from the git checkout, but RWX’s git/clone doesn’t keep .git by default, so on RWX Selective fetches the commit’s file tree from GitHub instead. That needs the Selective GitHub App installed on the repository.
Warm-up
Section titled “Warm-up”With test selection on, a task that tells Selective about the run as soon as the code is cloned has the commit’s file tree, the map and the semantic decision ready by the time the test nodes connect. Without it, selection still works; it takes longer to apply once the nodes are up. See warm-up.
- key: selective-warmup use: code cache: false run: | curl -sS --max-time 20 -X POST https://app.selective.ci/warmup \ -H "authorization: $SELECTIVE_API_KEY" -H "content-type: application/json" \ -d '{"sha": "'"$RWX_GIT_COMMIT_SHA"'", "git_repo_full_name": "'"$RWX_GIT_REPOSITORY_NAME"'", "branch": "'"$RWX_GIT_REF_NAME"'"}' \ || true env: SELECTIVE_API_KEY: ${{ vaults.your-vault.secrets.SELECTIVE_API_KEY }}No test task should use it. The runner reports no base commit or target branch on RWX unless you set SELECTIVE_BASE_SHA or SELECTIVE_TARGET_BRANCH, so the warm-up leaves them out as well. If you do set them, send the same values here. Use one warm-up per suite, each with that suite’s key.