CodeSee Map workflow (tensorspace-team/tensorspace)
The CodeSee Map workflow from tensorspace-team/tensorspace, explained and optimized by Latchkey.
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.
What it does
This is the CodeSee Map workflow from the tensorspace-team/tensorspace 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
on:
push:
branches:
- master
pull_request_target:
types: [opened, synchronize, reopened]
name: CodeSee Map
jobs:
test_map_action:
runs-on: ubuntu-latest
continue-on-error: true
name: Run CodeSee Map Analysis
steps:
- name: checkout
id: checkout
uses: actions/checkout@v2
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.event.pull_request.head.ref }}
fetch-depth: 0
# codesee-detect-languages has an output with id languages.
- name: Detect Languages
id: detect-languages
uses: Codesee-io/codesee-detect-languages-action@latest
- name: Configure JDK 16
uses: actions/setup-java@v2
if: ${{ fromJSON(steps.detect-languages.outputs.languages).java }}
with:
java-version: '16'
distribution: 'zulu'
# CodeSee Maps Go support uses a static binary so there's no setup step required.
- name: Configure Node.js 14
uses: actions/setup-node@v2
if: ${{ fromJSON(steps.detect-languages.outputs.languages).javascript }}
with:
node-version: '14'
- name: Configure Python 3.x
uses: actions/setup-python@v2
if: ${{ fromJSON(steps.detect-languages.outputs.languages).python }}
with:
python-version: '3.x'
architecture: 'x64'
- name: Configure Ruby '3.x'
uses: ruby/setup-ruby@v1
if: ${{ fromJSON(steps.detect-languages.outputs.languages).ruby }}
with:
ruby-version: '3.0'
# CodeSee Maps Rust support uses a static binary so there's no setup step required.
- name: Generate Map
id: generate-map
uses: Codesee-io/codesee-map-action@latest
with:
step: map
github_ref: ${{ github.ref }}
languages: ${{ steps.detect-languages.outputs.languages }}
- name: Upload Map
id: upload-map
uses: Codesee-io/codesee-map-action@latest
with:
step: mapUpload
api_token: ${{ secrets.CODESEE_ARCH_DIAG_API_TOKEN }}
github_ref: ${{ github.ref }}
- name: Insights
id: insights
uses: Codesee-io/codesee-map-action@latest
with:
step: insights
api_token: ${{ secrets.CODESEE_ARCH_DIAG_API_TOKEN }}
github_ref: ${{ github.ref }}
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.
on: push: branches: - master pull_request_target: types: [opened, synchronize, reopened] name: CodeSee Map concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: test_map_action: timeout-minutes: 30 runs-on: latchkey-small continue-on-error: true name: Run CodeSee Map Analysis steps: - name: checkout id: checkout uses: actions/checkout@v2 with: repository: ${{ github.event.pull_request.head.repo.full_name }} ref: ${{ github.event.pull_request.head.ref }} fetch-depth: 0 # codesee-detect-languages has an output with id languages. - name: Detect Languages id: detect-languages uses: Codesee-io/codesee-detect-languages-action@latest - name: Configure JDK 16 uses: actions/setup-java@v2 if: ${{ fromJSON(steps.detect-languages.outputs.languages).java }} with: java-version: '16' distribution: 'zulu' # CodeSee Maps Go support uses a static binary so there's no setup step required. - name: Configure Node.js 14 uses: actions/setup-node@v2 if: ${{ fromJSON(steps.detect-languages.outputs.languages).javascript }} with: cache: 'npm' node-version: '14' - name: Configure Python 3.x uses: actions/setup-python@v2 if: ${{ fromJSON(steps.detect-languages.outputs.languages).python }} with: python-version: '3.x' architecture: 'x64' - name: Configure Ruby '3.x' uses: ruby/setup-ruby@v1 if: ${{ fromJSON(steps.detect-languages.outputs.languages).ruby }} with: ruby-version: '3.0' # CodeSee Maps Rust support uses a static binary so there's no setup step required. - name: Generate Map id: generate-map uses: Codesee-io/codesee-map-action@latest with: step: map github_ref: ${{ github.ref }} languages: ${{ steps.detect-languages.outputs.languages }} - name: Upload Map id: upload-map uses: Codesee-io/codesee-map-action@latest with: step: mapUpload api_token: ${{ secrets.CODESEE_ARCH_DIAG_API_TOKEN }} github_ref: ${{ github.ref }} - name: Insights id: insights uses: Codesee-io/codesee-map-action@latest with: step: insights api_token: ${{ secrets.CODESEE_ARCH_DIAG_API_TOKEN }} github_ref: ${{ github.ref }}
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. - Cancel superseded runs when a branch or PR gets a newer push.
- 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.
3 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.
This workflow runs 1 job per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.