An open-source, faster Devin alternative
TypeScript
managed-agents CI: cache installed node_modules in a shared setup action
Igor Zalutski via Computer26be9599e8bb
diff --git a/.github/actions/managed-agents-setup/action.yml b/.github/actions/managed-agents-setup/action.ymlnew file mode 100644index 00000000..c771e20b--- /dev/null+++ b/.github/actions/managed-agents-setup/action.yml@@ -0,0 +1,28 @@+name: Set up managed-agents+description: >-+ Install Node and the dependencies of services/managed-agents and its+ workerd-runtime, restoring both node_modules trees from cache when the+ lockfiles have not changed.++runs:+ using: composite+ steps:+ - id: node+ uses: actions/setup-node@v4+ with:+ node-version: 22+ # The installed trees, not just npm's download cache: npm ci spends most+ # of its time extracting and linking, which a download cache does not save.+ # The key carries the exact Node version so a native module is never+ # reused across ABIs.+ - id: cache+ uses: actions/cache@v4+ with:+ path: |+ services/managed-agents/node_modules+ services/managed-agents/src/workerd-runtime/node_modules+ key: managed-agents-node-modules-${{ runner.os }}-${{ runner.arch }}-node${{ steps.node.outputs.node-version }}-${{ hashFiles('services/managed-agents/package-lock.json', 'services/managed-agents/src/workerd-runtime/package-lock.json') }}+ - if: steps.cache.outputs.cache-hit != 'true'+ shell: bash+ working-directory: services/managed-agents+ run: npm ci --no-audit --no-fund && npm ci --no-audit --no-fund --prefix src/workerd-runtimediff --git a/.github/workflows/managed-agents.yml b/.github/workflows/managed-agents.ymlindex 20e7c710..be07ecb9 100644--- a/.github/workflows/managed-agents.yml+++ b/.github/workflows/managed-agents.yml@@ -9,11 +9,13 @@ on:paths:- services/managed-agents/**- .github/workflows/managed-agents.yml+ - .github/actions/managed-agents-setup/**push:branches: [main]paths:- services/managed-agents/**- .github/workflows/managed-agents.yml+ - .github/actions/managed-agents-setup/**permissions:contents: read@@ -87,14 +89,7 @@ jobs:- uses: actions/checkout@v4with:persist-credentials: false- - uses: actions/setup-node@v4- with:- node-version: 22- cache: npm- cache-dependency-path: |- services/managed-agents/package-lock.json- services/managed-agents/src/workerd-runtime/package-lock.json- - run: npm ci && npm ci --prefix src/workerd-runtime+ - uses: ./.github/actions/managed-agents-setup- run: npm test -- ${{ matrix.projects }}static:@@ -105,14 +100,7 @@ jobs:- uses: actions/checkout@v4with:persist-credentials: false- - uses: actions/setup-node@v4- with:- node-version: 22- cache: npm- cache-dependency-path: |- services/managed-agents/package-lock.json- services/managed-agents/src/workerd-runtime/package-lock.json- - run: npm ci && npm ci --prefix src/workerd-runtime+ - uses: ./.github/actions/managed-agents-setup- run: npm run check- run: npm run build- name: Dry-run each Worker