1

I have enabled cache in .angular.json:

"cli": {
  "cache": {
    "enabled": true,
    "environment": "all"
  }
}

And cache the .angular folder in GitHub actions:

steps:
  - name: Cache Angular build
    uses: actions/cache@v3
    id: cache-build
    env:
      cache-name: cache-build
    with:
      path: .angular
      key: ${{ runner.OS }}-build${{ env.NODE_VERSION }}-${{ hashFiles('package-lock.json') }}

  - name: Create Build
    shell: bash
    run: |
      ls -la .angular/cache
      npm run build ${{ inputs.product }} -- --configuration=${{ inputs.angularConfig }} --output-path=${{ inputs.buildPath }}

But the build takes around 6 mins. Without cache it was around 7 mins. Whereas locally it'll take less than 1 min to build locally with cache and 6 mins without cache.

I tried multiple builds like this:

  - name: Create Build
    shell: bash
    run: |
      npm run build ${{ inputs.product }} -- --configuration=${{ inputs.angularConfig }} --output-path=${{ inputs.buildPath }}

  - name: Create Build 2
    shell: bash
    run: |
      npm run build ${{ inputs.product }} -- --configuration=${{ inputs.angularConfig }} --output-path=${{ inputs.buildPath }}

And the second build is around 1 minute! So I assume something is wrong. Maybe there's an Angular CLI cache in ~/ folder or somewhere else. Any ideas?

I'm expecting relatively same time for local and CI builds.

1 Answer 1

1

Same here. If you turn on --verbose on ng-build, you will get some cacheing errors on first build in ci. The second one is fast and without errors.

Sign up to request clarification or add additional context in comments.

1 Comment

Your answer seems like it would fit better as a comment on the question. Consider adding it there!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.