Skip to content
Latchkey

wee-slack workflow (wee-slack/wee-slack)

The wee-slack workflow from wee-slack/wee-slack, explained and optimized by Latchkey.

F

CI health: F - at risk

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

Grade your own workflow free or run it on Latchkey →
Source: wee-slack/wee-slack.github/workflows/wee-slack.ymlLicense MITView source

What it does

This is the wee-slack workflow from the wee-slack/wee-slack 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: wee-slack
on: [push, pull_request]

jobs:
  test:
    if: >
      github.event_name == 'push' || (
        github.event_name == 'pull_request' &&
        github.event.pull_request.head.repo.full_name != github.repository
      )

    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]

    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-python@v5
        with:
          python-version: ${{ matrix.python-version }}
      - uses: astral-sh/setup-uv@v5

      - name: Install system dependencies
        run: |
          sudo apt-get update
          sudo apt-get install libleveldb-dev

      - run: uv sync --locked --all-extras

      - run: uv run ruff format --check

      - run: uv run ruff check

      - run: uv run pyright

      - run: uv run pytest tests

  build:
    if: >
      github.event_name == 'push' || (
        github.event_name == 'pull_request' &&
        github.event.pull_request.head.repo.full_name != github.repository
      )

    needs: test
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v4
      - uses: astral-sh/setup-uv@v5

      - run: uv sync --locked

      - name: Install WeeChat, tmux and python3-websocket
        run: |
          sudo apt-get update
          sudo apt-get install weechat-headless tmux python3-websocket

      - run: ./build.sh

      - name: Load slack.py in WeeChat
        run: |
          WEECHAT_DIR=$(mktemp -d)
          tmux new-session -d "weechat-headless --dir $WEECHAT_DIR -r '/script load $PWD/build/slack.py; /quit'"
          while pidof -q tmux; do :; done
          cat $WEECHAT_DIR/logs/core.weechat.weechatlog
          grep -q 'python: registered script "slack"' $WEECHAT_DIR/logs/core.weechat.weechatlog

      - uses: actions/upload-artifact@v4
        with:
          name: slack.py
          path: build/slack.py

      - uses: pyTooling/Actions/releaser@r1
        if: github.ref == 'refs/heads/master'
        with:
          token: ${{ secrets.GITHUB_TOKEN }}
          tag: nightly
          files: |
            build/slack.py

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: wee-slack
on: [push, pull_request]
 
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true
 
jobs:
  test:
    timeout-minutes: 30
    if: >
      github.event_name == 'push' || (
        github.event_name == 'pull_request' &&
        github.event.pull_request.head.repo.full_name != github.repository
      )
 
    runs-on: latchkey-small
    strategy:
      fail-fast: false
      matrix:
        python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
 
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-python@v5
        with:
          cache: 'pip'
          python-version: ${{ matrix.python-version }}
      - uses: astral-sh/setup-uv@v5
 
      - name: Install system dependencies
        run: |
          sudo apt-get update
          sudo apt-get install libleveldb-dev
 
      - run: uv sync --locked --all-extras
 
      - run: uv run ruff format --check
 
      - run: uv run ruff check
 
      - run: uv run pyright
 
      - run: uv run pytest tests
 
  build:
    timeout-minutes: 30
    if: >
      github.event_name == 'push' || (
        github.event_name == 'pull_request' &&
        github.event.pull_request.head.repo.full_name != github.repository
      )
 
    needs: test
    runs-on: latchkey-small
 
    steps:
      - uses: actions/checkout@v4
      - uses: astral-sh/setup-uv@v5
 
      - run: uv sync --locked
 
      - name: Install WeeChat, tmux and python3-websocket
        run: |
          sudo apt-get update
          sudo apt-get install weechat-headless tmux python3-websocket
 
      - run: ./build.sh
 
      - name: Load slack.py in WeeChat
        run: |
          WEECHAT_DIR=$(mktemp -d)
          tmux new-session -d "weechat-headless --dir $WEECHAT_DIR -r '/script load $PWD/build/slack.py; /quit'"
          while pidof -q tmux; do :; done
          cat $WEECHAT_DIR/logs/core.weechat.weechatlog
          grep -q 'python: registered script "slack"' $WEECHAT_DIR/logs/core.weechat.weechatlog
 
      - uses: actions/upload-artifact@v4
        with:
          name: slack.py
          path: build/slack.py
 
      - uses: pyTooling/Actions/releaser@r1
        if: github.ref == 'refs/heads/master'
        with:
          token: ${{ secrets.GITHUB_TOKEN }}
          tag: nightly
          files: |
            build/slack.py
 

What changed

2 third-party actions are referenced by a movable tag. Pin them to the commit SHA (Latchkey resolves and applies this automatically) so a repointed tag cannot change what runs.

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 (7 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