Skip to content

Instantly share code, notes, and snippets.

@jlantz
Last active September 29, 2024 17:08
Show Gist options
  • Select an option

  • Save jlantz/cb2fe5349a3e61df2876acca5c014b86 to your computer and use it in GitHub Desktop.

Select an option

Save jlantz/cb2fe5349a3e61df2876acca5c014b86 to your computer and use it in GitHub Desktop.
Opportunities for Optimizing D2X's Release 2GP Workflow With Multiple Jobs

D2X's Release 2GP flow could be optimized by splitting into separate jobs. The advantages include:

  1. Faster build times by running jobs in parallel
  2. Better integration into GitHub's web user experience for viewing Actions Workflow executions
  3. Retry only failed jobs instead of re-running everything (release promotion + test)

This sets up the reusable workflow as callable and requires the dev-hub-auth-url secret:

name: Release 2GP

on:
  workflow_call:
    secrets:
      dev-hub-auth-url:
        required: true

Then, everything runs serially in a single job:

jobs:
    release-test:
        name: "Release 2GP"
        runs-on: ubuntu-latest
        container:
            image: ghcr.io/muselab-d2x/d2x:latest
            options: --user root
            credentials:
                username: ${{ github.actor }}
                password: ${{ secrets.github-token }}
            env:
                DEV_HUB_AUTH_URL: "${{ secrets.dev-hub-auth-url }}"
        steps:
            - name: Checkout
              uses: actions/checkout@v2
            - name: Auth to DevHub
              run: /usr/local/bin/devhub.sh
            - name: Set default org
              run: cci org default release

The next step creates a scratch org and installs dependencies to prepare it for the release test:

            - name: Install Dependencies for Resolution
              run: cci flow run dependencies

Installing dependencies could happen in parallel with promoting and publishing the release to GitHub but we can't because we're stuck in a single job:

            - name: Promote Latest Beta
              run: cci flow run release_2gp_production
              shell: bash

Release testing could be faster if dependencies were preinstalling in parallel with release creation:

            - name: Run Release Test
              run: cci flow run ci_release

And finally, scratch org deletion would be nicer as its own Job in the GitHub Actions UI:

            - name: Delete Scratch Org
              if: ${{ always() }}
              run: |
                cci org scratch_delete release
              shell: bash
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment