-
-
Notifications
You must be signed in to change notification settings - Fork 0
ci: split CI workflow into separate jobs with reusable actions and build artifacts #32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ci: split CI workflow into separate jobs with reusable actions and build artifacts #32
Conversation
|
@copilot Only use these runners:
Additionally, the original main job should be split into multiple separate jobs:
Only test and e2e should use matrix strategies. |
Updated in commit ac12be8. The workflow now has four separate jobs:
|
|
@copilot Extract reusable composite GitHub Actions, for example:
|
Extracted in commit 5962d6b. Created three composite actions:
The CI workflow now uses these actions across all jobs, reducing ~235 lines to ~170 lines. |
|
@copilot The composite actions need permissions or checkout
|
Fixed in commit 45df7ea. The repository is now checked out before using composite actions. The workflow now:
The checkout logic is now in the workflow itself rather than inside a composite action. |
|
@copilot e2e jobs should use a build artifact from the build job as their package |
Implemented in commit d1bc953. The e2e jobs now:
The build job uploads the |
LayZeeDK
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LayZeeDK
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Co-authored-by: LayZeeDK <6364586+LayZeeDK@users.noreply.github.com>
Co-authored-by: LayZeeDK <6364586+LayZeeDK@users.noreply.github.com>
Co-authored-by: LayZeeDK <6364586+LayZeeDK@users.noreply.github.com>
Co-authored-by: LayZeeDK <6364586+LayZeeDK@users.noreply.github.com>
Co-authored-by: LayZeeDK <6364586+LayZeeDK@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: LayZeeDK <6364586+LayZeeDK@users.noreply.github.com>
Co-authored-by: LayZeeDK <6364586+LayZeeDK@users.noreply.github.com>
…lable Co-authored-by: LayZeeDK <6364586+LayZeeDK@users.noreply.github.com>
Co-authored-by: LayZeeDK <6364586+LayZeeDK@users.noreply.github.com>
Co-authored-by: LayZeeDK <6364586+LayZeeDK@users.noreply.github.com>
Co-authored-by: LayZeeDK <6364586+LayZeeDK@users.noreply.github.com>
Co-authored-by: LayZeeDK <6364586+LayZeeDK@users.noreply.github.com>
…d action.yml Co-authored-by: LayZeeDK <6364586+LayZeeDK@users.noreply.github.com>
- Change build job to build all projects instead of only affected ones - Always use --excludeTaskDependencies in e2e job for consistency - Add documentation explaining the rationale for these changes Co-authored-by: LayZeeDK <6364586+LayZeeDK@users.noreply.github.com>
Co-authored-by: LayZeeDK <6364586+LayZeeDK@users.noreply.github.com>
Co-authored-by: LayZeeDK <6364586+LayZeeDK@users.noreply.github.com>
…us-check Co-authored-by: LayZeeDK <6364586+LayZeeDK@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
c5c7952 to
5db32f4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 18 out of 20 changed files in this pull request and generated 1 comment.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Summary
This pull request splits the CI workflow into separate jobs: build, lint, test, and e2e. The test and e2e jobs are tested across various operating systems, CPU architectures, and Node.js versions.
This pull request introduces a new custom GitHub Action for posting commit status checks, along with supporting configuration, tests, and project setup files. It also adds two utility actions for setting Nx SHAs and setting up Node.js with package installation. Additionally, the CI workflow is updated to use the new build job and an ARM-based runner.
New GitHub Actions and Project Setup
post-status-checkfor posting pending or outcome status checks to commits, including robust token handling, event filtering, and error reporting (.github/actions/post-status-check/action.yml,.github/actions/post-status-check/src/main.js). [1] [2]post-status-checkaction, covering all major scenarios and error handling (.github/actions/post-status-check/src/main.spec.js)..github/actions/post-status-check/project.json,.github/actions/post-status-check/tsconfig.*.json,.github/actions/post-status-check/eslint.config.js,.github/actions/post-status-check/jest.config.js,.github/actions/post-status-check/package.json). [1] [2] [3] [4] [5] [6] [7]Utility Actions
set-nx-shasaction to derive SHAs for Nx affected commands (.github/actions/set-nx-shas/action.yml).setup-node-and-installaction for Node.js setup with caching and npm package installation (.github/actions/setup-node-and-install/action.yml).CI Workflow Update
build, set its runner toubuntu-24.04-arm, and updated permissions for posting commit statuses (.github/workflows/ci.yml).These changes enhance workflow automation, improve CI reliability, and provide reusable actions for future workflow development.
Changes Made
Restored Build Target for Type-Checking
Build Target:
@nx/esbuild:esbuildexecutor withbundle: falsedist/.github/actions/post-status-checkBenefits:
JavaScript Action with Workspace Dependencies
No Build Required in CI:
How It Works:
.github/actions/*patternnpm ciin CI installs all workspace dependenciesBenefits:
Fixed job-status Input
Action Definition:
job-statusinput fromrequired: truetorequired: falsein action.ymlConverted post-status-check to JavaScript Action
Refactored Implementation:
node24runtime@actions/corefor inputs and outputs instead of environment variables@actions/githubREST API instead ofghCLIPackage Structure:
package.jsonto.github/actions/post-status-checkwith@actions/coreand@actions/githubdependenciesnpm installpackage.jsononlyTesting:
src/__tests__/main.spec.jswith 8 unit testsNx Integration:
Benefits:
ghCLI in runtimeNx Output Style
CI Workflow:
--output-style=staticto all Nx commands exceptformat:checkbuild,lint,test, ande2eformat:checkcommand remains unchanged (no flag added)Benefits:
Task Dependencies and Build Artifacts
Project Configuration:
"dependsOn": ["^build"]in workspace-e2e/project.json for local developmentCI Workflow:
--exclude-task-dependenciesflag to the e2e commandneeds: buildfor proper sequencingBenefits:
nx e2eautomatically builds dependenciesBuild Artifacts for E2E Tests
The e2e jobs use build artifacts from the build job instead of rebuilding:
Build Job:
dist/) after buildingE2E Job:
needs: buildto create dependency on build job--exclude-task-dependenciesto skip rebuildingBenefits:
Fixed Composite Action Issue
The composite actions couldn't be found because the repository wasn't checked out first. Fixed by:
checkout-and-set-nx-shastoset-nx-shas(simplified to only set Nx SHAs)Composite Actions and JavaScript Action
The workflow now uses two composite actions and one JavaScript action:
Set Nx SHAs (
.github/actions/set-nx-shas) - Composite Actionnx affectedcommandsSet up Node.js and install packages (
.github/actions/setup-node-and-install) - Composite ActionPost status check (
.github/actions/post-status-check) - JavaScript ActionWorkflow Structure
Each job now:
Fixes #31