Skip to content
Latchkey

Nightly tests workflow (hsahovic/poke-env)

The Nightly tests workflow from hsahovic/poke-env, explained and optimized by Latchkey.

C

CI health: C - fair

Point runs-on at Latchkey and get caching, 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: hsahovic/poke-env.github/workflows/nightly.ymlLicense MITView source

What it does

This is the Nightly tests workflow from the hsahovic/poke-env 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: Nightly tests

on:
  schedule:
    - cron: '0 0 * * *'
  workflow_dispatch:

jobs:
  nightly:
    uses: ./.github/workflows/tests.yml
    secrets: inherit
  nightly-extra:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repository code
        uses: actions/checkout@v7

      # Setup Python
      - name: Setup Python
        uses: actions/setup-python@v6
        with:
          python-version: "3.14"

      - name: Setup uv
        uses: astral-sh/setup-uv@v7
        with:
          enable-cache: true

      - name: Install dependencies
        run: uv sync --dev

      - name: Setup node
        uses: actions/setup-node@v6
        with:
          node-version: 18

      - name: Checkout PS
        uses: actions/checkout@v7
        with:
          repository: smogon/pokemon-showdown
          path: pokemon-showdown
          submodules: recursive

      - name: Get last showdown commit hash
        id: showdown-hash
        run: |
          cd pokemon-showdown/
          export hash=`git log -1 --pretty=format:%H`
          echo "hash=$hash" >> $GITHUB_OUTPUT

      - name: Restore server cache
        uses: actions/cache@v6
        with:
          path: pokemon-showdown/node_modules
          key: showdown-python3.13-${{ steps.showdown-hash.outputs.hash }}
          restore-keys: showdown-python3.13-

      - name: Install PS dependencies and start server
        run: bash scripts/ci_setup_showdown.sh

      - name: Run nightly-only checks
        run: uv run pytest -x strict_integration_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: Nightly tests
 
on:
  schedule:
    - cron: '0 0 * * *'
  workflow_dispatch:
 
jobs:
  nightly:
    timeout-minutes: 30
    uses: ./.github/workflows/tests.yml
    secrets: inherit
  nightly-extra:
    timeout-minutes: 30
    runs-on: latchkey-small
    steps:
      - name: Checkout repository code
        uses: actions/checkout@v7
 
      # Setup Python
      - name: Setup Python
        uses: actions/setup-python@v6
        with:
          python-version: "3.14"
 
      - name: Setup uv
        uses: astral-sh/setup-uv@v7
        with:
          enable-cache: true
 
      - name: Install dependencies
        run: uv sync --dev
 
      - name: Setup node
        uses: actions/setup-node@v6
        with:
          cache: 'npm'
          node-version: 18
 
      - name: Checkout PS
        uses: actions/checkout@v7
        with:
          repository: smogon/pokemon-showdown
          path: pokemon-showdown
          submodules: recursive
 
      - name: Get last showdown commit hash
        id: showdown-hash
        run: |
          cd pokemon-showdown/
          export hash=`git log -1 --pretty=format:%H`
          echo "hash=$hash" >> $GITHUB_OUTPUT
 
      - name: Restore server cache
        uses: actions/cache@v6
        with:
          path: pokemon-showdown/node_modules
          key: showdown-python3.13-${{ steps.showdown-hash.outputs.hash }}
          restore-keys: showdown-python3.13-
 
      - name: Install PS dependencies and start server
        run: bash scripts/ci_setup_showdown.sh
 
      - name: Run nightly-only checks
        run: uv run pytest -x strict_integration_tests/
 

What changed

1 third-party action is referenced by a movable tag. Pin it to the commit SHA (Latchkey resolves and applies this automatically) so a repointed tag cannot change what runs.

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

Actions used in this workflow