demarches-normaliennes/.github/actions/ci-setup-split-tests/action.yml
2021-11-09 08:32:31 +01:00

46 lines
1.7 KiB
YAML

name: 'Setup split-tests'
description: 'Setup the environment for splitting tests'
inputs:
results_path:
description: 'Glob pattern to the JUnit files to save'
required: true
runs:
using: composite
steps:
- name: Setup split_tests binary
run: |
curl --no-progress-meter -L https://github.com/leonid-shevtsov/split_tests/releases/download/v0.3.0/split_tests.linux.gz | gunzip -c > split_tests
chmod +x split_tests
shell: bash
- name: Generate an unique random value
run: echo dummy_random_value=$RANDOM >> $GITHUB_ENV
shell: bash
# Restore previous runs timing from the cache.
#
# NB: at the end of the job, the `actions/cache@v2` action will attempt
# to save the results back to the same key. However at this stage only
# tests results for a single instance will be available.
#
# To avoid the cache being overwritten with this single result, we define
# a random cache key, which the action will use to save the single-instance
# report to a dummy location.
#
# The actual retrieval uses the `restore-keys` instead.
- name: Restore previous runs timings
uses: actions/cache@v2
with:
path: ${{ inputs.results_path }}
key: single-instance-report-${{ github.sha }}-${{ env.dummy_random_value }}
restore-keys: |
tests-reports-${{ github.ref }}-${{ github.sha }}-${{ github.run_id }}
tests-reports-${{ github.ref }}-${{ github.sha }}-
tests-reports-${{ github.ref }}-
tests-reports-
- name: Display previous runs timings used for splitting tests
run: ls ${{ inputs.results_path }} || true
shell: bash