Skip to content
Latchkey

PyLS Release workflow (palantir/python-language-server)

The PyLS Release workflow from palantir/python-language-server, explained and optimized by Latchkey.

A

CI health: A - excellent

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

Grade your own workflow free or run it on Latchkey →
Source: palantir/python-language-server.github/workflows/release.ymlLicense MITView source

What it does

This is the PyLS Release workflow from the palantir/python-language-server 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: PyLS Release

on:
  release:
    types:
      - created


jobs:
  build:
    name: Linux Py${{ matrix.PYTHON_VERSION }}
    runs-on: ubuntu-latest
    env:
      CI: 'true'
      OS: 'linux'
      PYTHON_VERSION: ${{ matrix.PYTHON_VERSION }}
    strategy:
      fail-fast: false
      matrix:
        PYTHON_VERSION: ['3.8']
    timeout-minutes: 10
    steps:
      - uses: actions/cache@v1
        with:
          path: ~/.cache/pip
          key: ${{ runner.os }}-${{ matrix.PYTHON_VERSION }}-pip-${{ hashFiles('setup.py') }}
          restore-keys: ${{ runner.os }}-${{ matrix.PYTHON_VERSION }}-pip-
      - uses: actions/checkout@v2
        with:
          fetch-depth: 0
      - uses: actions/setup-python@v2
        with:
          python-version: ${{ matrix.PYTHON_VERSION }}
          architecture: 'x64'
      - run: python -m pip install --upgrade pip setuptools wheel twine
      - name: Build and publish python-language-server
        env:
          TWINE_USERNAME: __token__
          TWINE_PASSWORD: ${{ secrets.PYPI_PYLS_TOKEN }}
        run: |
          python setup.py bdist_wheel --universal
          python setup.py sdist
          python -m twine check dist/*
          python -m twine upload dist/*

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: PyLS Release
 
on:
  release:
    types:
      - created
 
 
jobs:
  build:
    name: Linux Py${{ matrix.PYTHON_VERSION }}
    runs-on: latchkey-small
    env:
      CI: 'true'
      OS: 'linux'
      PYTHON_VERSION: ${{ matrix.PYTHON_VERSION }}
    strategy:
      fail-fast: false
      matrix:
        PYTHON_VERSION: ['3.8']
    timeout-minutes: 10
    steps:
      - uses: actions/cache@v1
        with:
          path: ~/.cache/pip
          key: ${{ runner.os }}-${{ matrix.PYTHON_VERSION }}-pip-${{ hashFiles('setup.py') }}
          restore-keys: ${{ runner.os }}-${{ matrix.PYTHON_VERSION }}-pip-
      - uses: actions/checkout@v2
        with:
          fetch-depth: 0
      - uses: actions/setup-python@v2
        with:
          cache: 'pip'
          python-version: ${{ matrix.PYTHON_VERSION }}
          architecture: 'x64'
      - run: python -m pip install --upgrade pip setuptools wheel twine
      - name: Build and publish python-language-server
        env:
          TWINE_USERNAME: __token__
          TWINE_PASSWORD: ${{ secrets.PYPI_PYLS_TOKEN }}
        run: |
          python setup.py bdist_wheel --universal
          python setup.py sdist
          python -m twine check dist/*
          python -m twine upload dist/*
 

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 per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.

Actions used in this workflow