Skip to content
Latchkey

CI-Windows-macOS workflow (massquantity/LibRecommender)

The CI-Windows-macOS workflow from massquantity/LibRecommender, explained and optimized by Latchkey.

C

CI health: C - fair

Run this on Latchkey for self-healing, caching, and up to 58% lower cost.

Grade your own workflow free or run it on Latchkey →
Source: massquantity/LibRecommender.github/workflows/ci_win_mac.ymlLicense MITView source

What it does

This is the CI-Windows-macOS workflow from the massquantity/LibRecommender repository, a real project running GitHub Actions. It is shown here with attribution under its MIT license.

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

The workflow

workflow (.yml)
name: CI-Windows-macOS

on:
  pull_request:
    branches:
      - master
  # Manual run
  workflow_dispatch:

jobs:
  testing:
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        os: [macos-latest, windows-latest]
        python-version: [3.8, '3.10']

    steps:
      - uses: actions/checkout@v4
      - name: Set up Python ${{ matrix.python-version }}
        uses: actions/setup-python@v5
        with:
          python-version: ${{ matrix.python-version }}
          cache: 'pip'

      - name: Display Python version
        run: python -c "import sys; print(sys.version)"

      - name: Install dependencies
        run: |
          python -m pip install -U pip wheel setuptools
          python -m pip install numpy>=1.19.5
          python -m pip install "scipy>=1.2.1,<1.13.0"
          python -m pip install pandas>=1.0.0
          python -m pip install scikit-learn>=0.20.0
          python -m pip install "tensorflow>=1.15.0,<2.16.0"
          python -m pip install torch>=1.10.0
          python -m pip install "smart_open<7.0.0"
          python -m pip install gensim>=4.0.0
          python -m pip install tqdm
          python -m pip install -e .

      - name: Install DGL on Windows
        run: python -m pip install 'dgl<=1.1.0' -f https://data.dgl.ai/wheels/repo.html
        if: matrix.os == 'windows-latest'

      - name: Install DGL on macOS
        run: |
          python -m pip install 'dgl<2.0.0' -f https://data.dgl.ai/wheels/repo.html
        if: matrix.os == 'macos-latest'

      - name: Install dataclasses
        run: |
          python -m pip install dataclasses
        if: matrix.python-version == '3.6'

      - name: Install recfarm
        run: |
          python -m pip install recfarm
        if: matrix.python-version != '3.6'

      - name: Test with pytest
        run: |
          python -m pip install pytest
          python -m pytest tests/ --ignore="tests/serving"

The same workflow, on Latchkey

Removes redundant runs and caps runaway jobs. Added and changed lines are highlighted.

name: CI-Windows-macOS
 
on:
  pull_request:
    branches:
      - master
  # Manual run
  workflow_dispatch:
 
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true
 
jobs:
  testing:
    timeout-minutes: 30
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        os: [macos-latest, windows-latest]
        python-version: [3.8, '3.10']
 
    steps:
      - uses: actions/checkout@v4
      - name: Set up Python ${{ matrix.python-version }}
        uses: actions/setup-python@v5
        with:
          python-version: ${{ matrix.python-version }}
          cache: 'pip'
 
      - name: Display Python version
        run: python -c "import sys; print(sys.version)"
 
      - name: Install dependencies
        run: |
          python -m pip install -U pip wheel setuptools
          python -m pip install numpy>=1.19.5
          python -m pip install "scipy>=1.2.1,<1.13.0"
          python -m pip install pandas>=1.0.0
          python -m pip install scikit-learn>=0.20.0
          python -m pip install "tensorflow>=1.15.0,<2.16.0"
          python -m pip install torch>=1.10.0
          python -m pip install "smart_open<7.0.0"
          python -m pip install gensim>=4.0.0
          python -m pip install tqdm
          python -m pip install -e .
 
      - name: Install DGL on Windows
        run: python -m pip install 'dgl<=1.1.0' -f https://data.dgl.ai/wheels/repo.html
        if: matrix.os == 'windows-latest'
 
      - name: Install DGL on macOS
        run: |
          python -m pip install 'dgl<2.0.0' -f https://data.dgl.ai/wheels/repo.html
        if: matrix.os == 'macos-latest'
 
      - name: Install dataclasses
        run: |
          python -m pip install dataclasses
        if: matrix.python-version == '3.6'
 
      - name: Install recfarm
        run: |
          python -m pip install recfarm
        if: matrix.python-version != '3.6'
 
      - name: Test with pytest
        run: |
          python -m pip install pytest
          python -m pytest tests/ --ignore="tests/serving"
 

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 1 job (4 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