cyclops-CI workflow (cyclops-ui/cyclops)
The cyclops-CI workflow from cyclops-ui/cyclops, explained and optimized by Latchkey.
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.
What it does
This is the cyclops-CI workflow from the cyclops-ui/cyclops 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
name: cyclops-CI
on:
workflow_dispatch:
inputs:
version:
required: true
description: Version to be used as release name and image tagging
permissions:
contents: write
jobs:
test-UI:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v2
- name: Install dependencies
run: |
cd ${{ github.workspace }}/cyclops-ui
npm install --force
- name: Run tests
run: |
cd ${{ github.workspace }}/cyclops-ui
npm test
test-controller:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Unit tests
run: |
cd ${{ github.workspace }}/cyclops-ctrl
make unit-test
validate-crd-updates:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Validate Module
working-directory: cyclops-ctrl
run: |
diff \
<(yq -N 'select(.kind == "CustomResourceDefinition" and .metadata.name == "modules.cyclops-ui.com")' ../install/cyclops-install.yaml) \
<(yq -N config/crd/bases/cyclops-ui.com_modules.yaml)
- name: Validate TemplateAuthRule
working-directory: cyclops-ctrl
run: |
diff \
<(yq -N 'select(.kind == "CustomResourceDefinition" and .metadata.name == "templateauthrules.cyclops-ui.com")' ../install/cyclops-install.yaml) \
<(yq -N config/crd/bases/cyclops-ui.com_templateauthrules.yaml)
- name: Validate TemplateStore
working-directory: cyclops-ctrl
run: |
diff \
<(yq -N 'select(.kind == "CustomResourceDefinition" and .metadata.name == "templatestores.cyclops-ui.com")' ../install/cyclops-install.yaml) \
<(yq -N config/crd/bases/cyclops-ui.com_templatestores.yaml)
build-UI:
needs:
- test-UI
runs-on: ubuntu-latest
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v6
with:
context: "{{defaultContext}}:cyclops-ui"
platforms: linux/amd64,linux/arm64
build-args: |
VERSION=${{ github.event.inputs.version }}
push: true
tags: cyclopsui/cyclops-ui:${{ github.event.inputs.version }}
build-controller:
needs:
- test-controller
- validate-crd-updates
runs-on: ubuntu-latest
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v6
with:
context: "{{defaultContext}}:cyclops-ctrl"
platforms: linux/amd64,linux/arm64
build-args: |
VERSION=${{ github.event.inputs.version }}
push: true
tags: cyclopsui/cyclops-ctrl:${{ github.event.inputs.version }}
update-install-manifest:
needs:
- build-UI
- build-controller
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Extract branch name
shell: bash
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT
id: extract_branch
- name: update install manifest
run: |
TAG=${{ github.event.inputs.version }}
INSTALL_YAML=$GITHUB_WORKSPACE/install/cyclops-install.yaml
sed -i 's/cyclopsui\/cyclops-ctrl\:.*/cyclopsui\/cyclops-ctrl\:'$TAG'/' $INSTALL_YAML
sed -i 's/cyclopsui\/cyclops-ui\:.*/cyclopsui\/cyclops-ui\:'$TAG'/' $INSTALL_YAML
# update file
git fetch origin ${{ steps.extract_branch.outputs.branch }}
git checkout ${{ steps.extract_branch.outputs.branch }}
git config user.name 'github-actions[bot]'
git config user.email 'github-actions[bot]@users.noreply.github.com'
git status
git add $INSTALL_YAML
git commit -m '⚙️ update cyclops to '$TAG
git push origin HEAD:${{ steps.extract_branch.outputs.branch }}
release:
needs:
- update-install-manifest
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Extract branch name
shell: bash
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT
id: extract_branch
- name: Create release
env:
GH_TOKEN: ${{ github.token }}
run: |
if [ "${{ steps.extract_branch.outputs.branch }}" = "main" ]; then
gh release create ${{ github.event.inputs.version }} \
--repo="https://github.com/cyclops-ui/cyclops" \
--title="${{ github.event.inputs.version }}" \
--generate-notes
else
gh release create ${{ github.event.inputs.version }} \
--repo="https://github.com/cyclops-ui/cyclops" \
--title="${{ github.event.inputs.version }}" \
--generate-notes \
--target ${{ steps.extract_branch.outputs.branch }}\
--prerelease
fi
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: cyclops-CI on: workflow_dispatch: inputs: version: required: true description: Version to be used as release name and image tagging permissions: contents: write jobs: test-UI: timeout-minutes: 30 runs-on: latchkey-small steps: - name: Checkout code uses: actions/checkout@v2 - name: Set up Node.js uses: actions/setup-node@v2 with: cache: 'npm' - name: Install dependencies run: | cd ${{ github.workspace }}/cyclops-ui npm install --force - name: Run tests run: | cd ${{ github.workspace }}/cyclops-ui npm test test-controller: timeout-minutes: 30 runs-on: latchkey-small steps: - name: Checkout repository uses: actions/checkout@v2 - name: Unit tests run: | cd ${{ github.workspace }}/cyclops-ctrl make unit-test validate-crd-updates: timeout-minutes: 30 runs-on: latchkey-small steps: - name: Checkout repository uses: actions/checkout@v2 - name: Validate Module working-directory: cyclops-ctrl run: | diff \ <(yq -N 'select(.kind == "CustomResourceDefinition" and .metadata.name == "modules.cyclops-ui.com")' ../install/cyclops-install.yaml) \ <(yq -N config/crd/bases/cyclops-ui.com_modules.yaml) - name: Validate TemplateAuthRule working-directory: cyclops-ctrl run: | diff \ <(yq -N 'select(.kind == "CustomResourceDefinition" and .metadata.name == "templateauthrules.cyclops-ui.com")' ../install/cyclops-install.yaml) \ <(yq -N config/crd/bases/cyclops-ui.com_templateauthrules.yaml) - name: Validate TemplateStore working-directory: cyclops-ctrl run: | diff \ <(yq -N 'select(.kind == "CustomResourceDefinition" and .metadata.name == "templatestores.cyclops-ui.com")' ../install/cyclops-install.yaml) \ <(yq -N config/crd/bases/cyclops-ui.com_templatestores.yaml) build-UI: timeout-minutes: 30 needs: - test-UI runs-on: latchkey-small steps: - name: Set up QEMU uses: docker/setup-qemu-action@v3 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - name: Login to DockerHub uses: docker/login-action@v1 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - name: Build and push uses: docker/build-push-action@v6 with: context: "{{defaultContext}}:cyclops-ui" platforms: linux/amd64,linux/arm64 build-args: | VERSION=${{ github.event.inputs.version }} push: true tags: cyclopsui/cyclops-ui:${{ github.event.inputs.version }} build-controller: timeout-minutes: 30 needs: - test-controller - validate-crd-updates runs-on: latchkey-small steps: - name: Set up QEMU uses: docker/setup-qemu-action@v3 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - name: Login to DockerHub uses: docker/login-action@v1 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - name: Build and push uses: docker/build-push-action@v6 with: context: "{{defaultContext}}:cyclops-ctrl" platforms: linux/amd64,linux/arm64 build-args: | VERSION=${{ github.event.inputs.version }} push: true tags: cyclopsui/cyclops-ctrl:${{ github.event.inputs.version }} update-install-manifest: timeout-minutes: 30 needs: - build-UI - build-controller runs-on: latchkey-small steps: - uses: actions/checkout@v2 - name: Extract branch name shell: bash run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT id: extract_branch - name: update install manifest run: | TAG=${{ github.event.inputs.version }} INSTALL_YAML=$GITHUB_WORKSPACE/install/cyclops-install.yaml sed -i 's/cyclopsui\/cyclops-ctrl\:.*/cyclopsui\/cyclops-ctrl\:'$TAG'/' $INSTALL_YAML sed -i 's/cyclopsui\/cyclops-ui\:.*/cyclopsui\/cyclops-ui\:'$TAG'/' $INSTALL_YAML # update file git fetch origin ${{ steps.extract_branch.outputs.branch }} git checkout ${{ steps.extract_branch.outputs.branch }} git config user.name 'github-actions[bot]' git config user.email 'github-actions[bot]@users.noreply.github.com' git status git add $INSTALL_YAML git commit -m '⚙️ update cyclops to '$TAG git push origin HEAD:${{ steps.extract_branch.outputs.branch }} release: timeout-minutes: 30 needs: - update-install-manifest runs-on: latchkey-small steps: - uses: actions/checkout@v2 - name: Extract branch name shell: bash run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT id: extract_branch - name: Create release env: GH_TOKEN: ${{ github.token }} run: | if [ "${{ steps.extract_branch.outputs.branch }}" = "main" ]; then gh release create ${{ github.event.inputs.version }} \ --repo="https://github.com/cyclops-ui/cyclops" \ --title="${{ github.event.inputs.version }}" \ --generate-notes else gh release create ${{ github.event.inputs.version }} \ --repo="https://github.com/cyclops-ui/cyclops" \ --title="${{ github.event.inputs.version }}" \ --generate-notes \ --target ${{ steps.extract_branch.outputs.branch }}\ --prerelease fi
What changed
- Run on Latchkey managed runners with one line (
runs-on), which apply the fixes below automatically and self-heal transient failures. This example useslatchkey-small; pick the runner size that fits the job. - Cache dependency installs on the setup step so they are served from cache.
- Add a job timeout so a hung step cannot burn hours of runner time.
4 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:
- Dependency installs
- Container pulls and builds
This workflow runs 7 jobs per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.