Skip to content
Latchkey

Test ASReview core workflow (asreview/asreview)

The Test ASReview core workflow from asreview/asreview, explained and optimized by Latchkey.

D

CI health: D - needs work

Point runs-on at Latchkey and get caching, run de-duplication, job timeouts, self-healing for flaky steps, and up to 58% lower cost, applied automatically.

Grade your own workflow free or run it on Latchkey →
Source: asreview/asreview.github/workflows/ci-core.ymlLicense Apache-2.0View source

What it does

This is the Test ASReview core workflow from the asreview/asreview repository, a real project running GitHub Actions. It is shown here with attribution under its Apache-2.0 license.

Below, Latchkey shows a faster, safer version produced by its optimization engine.

The workflow

workflow (.yml)
name: Test ASReview core
on: [push, pull_request]
jobs:
  ruff:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-python@v5
        with:
          python-version: "3.13"
      - name: Install ruff
        run: |
          pip install .[dev]
      - name: Lint Python
        run: |
          ruff check --exclude=asreview/webapp
  test-asreview-core:
    name: test-asreview-core
    strategy:
      matrix:
        os: [ubuntu-latest, windows-latest]
        python: ["3.10", "3.13"]
    runs-on: ${{ matrix.os }}
    steps:
      - uses: actions/checkout@v4
        with:
          submodules: recursive
          fetch-depth: 0
          fetch-tags: true
      - uses: actions/setup-python@v5
        with:
          python-version: ${{ matrix.python }}
      - name: Install packages
        run: |
          pip install pytest
          pip install --no-cache-dir .[test]
          pip install --no-cache-dir .
      - name: Cache synergy dataset
        uses: actions/cache@v4
        with:
          path: ~/.synergy_dataset_source
          key: synergy-dataset-${{ runner.os }}-v1.0
      - name: Download synergy dataset
        run: |
          python -c "
          from synergy_dataset.base import _dataset_available, download_raw_dataset
          if not _dataset_available():
              try:
                  download_raw_dataset(source='dataverse')
              except Exception:
                  download_raw_dataset(source='github')
          print('Synergy dataset available:', _dataset_available())
          "
      - name: Cache OSF test data
        uses: actions/cache@v4
        with:
          path: ~/.cache/asreview_tests
          key: osf-test-data-v1
      - name: Download OSF test data
        run: |
          python -c "
          from pathlib import Path
          import urllib.request
          from asreview.utils import _get_filename_from_url
          url = 'https://osf.io/download/fg93a/'
          cache_dir = Path('~/.cache/asreview_tests').expanduser()
          cache_dir.mkdir(parents=True, exist_ok=True)
          cache_file = cache_dir / _get_filename_from_url(url)
          if not cache_file.exists():
              urllib.request.urlretrieve(url, cache_file)
              print('Downloaded OSF fg93a as', cache_file.name)
          else:
              print('OSF fg93a already cached as', cache_file.name)
          "
      - name: Build project
        run: |
          python -m pip install build
          python -m build
      - name: Run test suite with pytest
        run: |
          pytest tests/

The same workflow, on Latchkey

Estimated ~20% faster on cache hits, plus fewer wasted runs and a safer supply chain. Added and changed lines are highlighted.

name: Test ASReview core
on: [push, pull_request]
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true
 
jobs:
  ruff:
    timeout-minutes: 30
    runs-on: latchkey-small
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-python@v5
        with:
          cache: 'pip'
          python-version: "3.13"
      - name: Install ruff
        run: |
          pip install .[dev]
      - name: Lint Python
        run: |
          ruff check --exclude=asreview/webapp
  test-asreview-core:
    timeout-minutes: 30
    name: test-asreview-core
    strategy:
      matrix:
        os: [ubuntu-latest, windows-latest]
        python: ["3.10", "3.13"]
    runs-on: ${{ matrix.os }}
    steps:
      - uses: actions/checkout@v4
        with:
          submodules: recursive
          fetch-depth: 0
          fetch-tags: true
      - uses: actions/setup-python@v5
        with:
          cache: 'pip'
          python-version: ${{ matrix.python }}
      - name: Install packages
        run: |
          pip install pytest
          pip install --no-cache-dir .[test]
          pip install --no-cache-dir .
      - name: Cache synergy dataset
        uses: actions/cache@v4
        with:
          path: ~/.synergy_dataset_source
          key: synergy-dataset-${{ runner.os }}-v1.0
      - name: Download synergy dataset
        run: |
          python -c "
          from synergy_dataset.base import _dataset_available, download_raw_dataset
          if not _dataset_available():
              try:
                  download_raw_dataset(source='dataverse')
              except Exception:
                  download_raw_dataset(source='github')
          print('Synergy dataset available:', _dataset_available())
          "
      - name: Cache OSF test data
        uses: actions/cache@v4
        with:
          path: ~/.cache/asreview_tests
          key: osf-test-data-v1
      - name: Download OSF test data
        run: |
          python -c "
          from pathlib import Path
          import urllib.request
          from asreview.utils import _get_filename_from_url
          url = 'https://osf.io/download/fg93a/'
          cache_dir = Path('~/.cache/asreview_tests').expanduser()
          cache_dir.mkdir(parents=True, exist_ok=True)
          cache_file = cache_dir / _get_filename_from_url(url)
          if not cache_file.exists():
              urllib.request.urlretrieve(url, cache_file)
              print('Downloaded OSF fg93a as', cache_file.name)
          else:
              print('OSF fg93a already cached as', cache_file.name)
          "
      - name: Build project
        run: |
          python -m pip install build
          python -m build
      - name: Run test suite with pytest
        run: |
          pytest tests/
 

What changed

What Latchkey heals here

This workflow has steps that commonly fail on transient issues (network, registries, flaky browsers). On Latchkey managed runners they are detected, retried, and self-healed instead of failing your build:

This workflow runs 2 jobs (5 with the matrix expanded) per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.

Actions used in this workflow