[Optimize] Add CI optimization step using Graphite action (#4115)

tl;dr: https://graphite.dev/docs/stacking-and-ci#reducing-ci-runs-for-github-actions

<!-- start pr-codex -->

---

## PR-Codex overview
This PR optimizes the CI workflow by adding a step to skip unnecessary processes based on a condition.

### Detailed summary
- Added `optimize_ci` job with skip condition
- Updated `build`, `lint`, `test`, `e2e`, and `size` jobs to depend on `optimize_ci` and skip if condition is met

> ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}`

<!-- end pr-codex -->
This commit is contained in:
jnsdls
2024-08-15 21:22:24 +00:00
parent 825352476c
commit d3f43a757b
2 changed files with 41 additions and 1 deletions
+22 -1
View File
@@ -19,7 +19,21 @@ env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
jobs:
optimize_ci:
runs-on: ubuntu-latest
outputs:
skip: ${{ steps.check_skip.outputs.skip }}
steps:
- name: Optimize CI
id: check_skip
uses: withgraphite/graphite-ci-action@main
with:
graphite_token: ${{ secrets.GRAPHITE_OMTIMIZE_TOKEN }}
build:
needs: optimize_ci
if: needs.optimize_ci.outputs.skip == 'false'
runs-on: ubuntu-latest
name: Build Packages
steps:
@@ -33,6 +47,8 @@ jobs:
run: pnpm build:packages
lint:
needs: optimize_ci
if: needs.optimize_ci.outputs.skip == 'false'
timeout-minutes: 15
name: Lint Packages
runs-on: ubuntu-latest
@@ -51,6 +67,8 @@ jobs:
- run: pnpm lint
test:
needs: optimize_ci
if: needs.optimize_ci.outputs.skip == 'false'
timeout-minutes: 15
name: Unit Tests
runs-on: ubuntu-latest
@@ -77,6 +95,8 @@ jobs:
verbose: true
e2e:
needs: optimize_ci
if: needs.optimize_ci.outputs.skip == 'false'
timeout-minutes: 15
name: E2E Tests
runs-on: ubuntu-latest
@@ -144,8 +164,9 @@ jobs:
fi
size:
needs: optimize_ci
# only run on pull requests
if: github.event_name == 'pull_request'
if: github.event_name == 'pull_request' && needs.optimize_ci.outputs.skip == 'false'
timeout-minutes: 15
name: "Size"
runs-on: ubuntu-latest
+19
View File
@@ -27,7 +27,20 @@ env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
jobs:
optimize_ci:
runs-on: ubuntu-latest
outputs:
skip: ${{ steps.check_skip.outputs.skip }}
steps:
- name: Optimize CI
id: check_skip
uses: withgraphite/graphite-ci-action@main
with:
graphite_token: ${{ secrets.GRAPHITE_OMTIMIZE_TOKEN }}
build:
needs: optimize_ci
if: needs.optimize_ci.outputs.skip == 'false'
runs-on: ubuntu-latest
name: Build Packages
steps:
@@ -41,6 +54,8 @@ jobs:
run: pnpm build:legacy_packages
lint:
needs: optimize_ci
if: needs.optimize_ci.outputs.skip == 'false'
timeout-minutes: 15
name: Lint Packages
runs-on: ubuntu-latest
@@ -54,6 +69,8 @@ jobs:
- run: pnpm lint:legacy
test:
needs: optimize_ci
if: needs.optimize_ci.outputs.skip == 'false'
timeout-minutes: 15
name: Unit Tests
runs-on: ubuntu-latest
@@ -74,6 +91,8 @@ jobs:
verbose: true
e2e:
needs: optimize_ci
if: needs.optimize_ci.outputs.skip == 'false'
timeout-minutes: 15
name: E2E Tests
runs-on: ubuntu-latest