diff --git a/.github/actions/dotnet/build/action.yml b/.github/actions/dotnet/build/action.yml index da1eee81..d80422f7 100644 --- a/.github/actions/dotnet/build/action.yml +++ b/.github/actions/dotnet/build/action.yml @@ -10,17 +10,21 @@ inputs: SHELL: required: false type: string - default: 'bash' + default: "bash" runs: using: composite steps: + - name: Create folder if not exist + shell: bash + run: mkdir -p ~/.nuget/packages-carbon + - name: Restore NuGet packages cache uses: actions/cache@v3 with: - path: ~/.nuget/packages - key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }} - restore-keys: ${{ runner.os }}-nuget- + path: ~/.nuget/packages-carbon + key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }} + restore-keys: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }} - name: Restore dependencies shell: ${{ inputs.SHELL }} diff --git a/.github/workflows/dotnet-workflow-common.yml b/.github/workflows/dotnet-workflow-common.yml index d77e851f..530596fd 100644 --- a/.github/workflows/dotnet-workflow-common.yml +++ b/.github/workflows/dotnet-workflow-common.yml @@ -96,7 +96,7 @@ jobs: CSHARPIER_VERSION: ${{ inputs.CSHARPIER_VERSION }} - name: Build - uses: zupit-it/pipeline-templates/.github/actions/dotnet/build@v1.23.2 + uses: zupit-it/pipeline-templates/.github/actions/dotnet/build@chore/better-caching with: WORKING_DIRECTORY: ${{ inputs.WORKING_DIRECTORY }} BUILD_CONFIG: "Debug" diff --git a/.github/workflows/node-step-format-lint-build.yml b/.github/workflows/node-step-format-lint-build.yml index 4c06db61..90647bf5 100644 --- a/.github/workflows/node-step-format-lint-build.yml +++ b/.github/workflows/node-step-format-lint-build.yml @@ -6,11 +6,11 @@ on: RUN_ON: required: false type: string - default: 'zupit-agents' + default: "zupit-agents" RUNNERS_CONTAINER_GROUP: required: false type: string - default: 'Container' + default: "Container" NODE_VERSION: required: true type: string @@ -45,40 +45,39 @@ jobs: working-directory: ${{ inputs.WORKING_DIRECTORY }} steps: - - uses: actions/checkout@v4 - - name: Use Node.js ${{ inputs.NODE_VERSION }} - uses: actions/setup-node@v3 - with: - node-version: ${{ inputs.NODE_VERSION }} -# cache: 'npm' -# cache-dependency-path: ${{ inputs.WORKING_DIRECTORY }}/package-lock.json + - uses: actions/checkout@v4 + with: + fetch-depth: 0 - # Set NPM cache directory to a new clean directory to avoid sharing with other runners - - name: Set NPM cache directory - run: echo "NPM_CONFIG_CACHE=~/.npm$(npm -v)" >> $GITHUB_ENV + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: ${{ inputs.NODE_VERSION }} + cache: "npm" + cache-dependency-path: "**/*/package-lock.json" - - name: Authenticate with private NPM package - if: ${{ env.github_token }} - run: echo "//npm.pkg.github.com/:_authToken=${{ env.github_token }}" > ~/.npmrc + - name: Authenticate with private NPM package + if: ${{ env.github_token }} + run: echo "//npm.pkg.github.com/:_authToken=${{ env.github_token }}" > ~/.npmrc - - run: npm ci + - run: npm ci - # GENERIC - - run: npm run ci:format:check - if: ${{ inputs.PROJECT == '' }} + # GENERIC + - run: npm run ci:format:check + if: ${{ inputs.PROJECT == '' }} - - run: npm run ci:lint - if: ${{ inputs.PROJECT == '' }} + - run: npm run ci:lint + if: ${{ inputs.PROJECT == '' }} - - run: npm run ci:build - if: ${{ inputs.PROJECT == '' }} + - run: npm run ci:build + if: ${{ inputs.PROJECT == '' }} - # PROJECT SPECIFIC - - run: npm run ${{ inputs.PROJECT }}:ci:format:check - if: ${{ inputs.PROJECT != '' }} + # PROJECT SPECIFIC + - run: npm run ${{ inputs.PROJECT }}:ci:format:check + if: ${{ inputs.PROJECT != '' }} - - run: npm run ${{ inputs.PROJECT }}:ci:lint - if: ${{ inputs.PROJECT != '' }} + - run: npm run ${{ inputs.PROJECT }}:ci:lint + if: ${{ inputs.PROJECT != '' }} - - run: npm run ${{ inputs.PROJECT }}:ci:build - if: ${{ inputs.PROJECT != '' }} + - run: npm run ${{ inputs.PROJECT }}:ci:build + if: ${{ inputs.PROJECT != '' }} diff --git a/.github/workflows/sonar-step-dotnet-analyze.yml b/.github/workflows/sonar-step-dotnet-analyze.yml index 2e35bfda..190f2475 100644 --- a/.github/workflows/sonar-step-dotnet-analyze.yml +++ b/.github/workflows/sonar-step-dotnet-analyze.yml @@ -102,8 +102,6 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v4 - with: - fetch-depth: 0 - name: Install .NET uses: zupit-it/pipeline-templates/.github/actions/dotnet/install@v1.23.2 @@ -135,7 +133,7 @@ jobs: "${params[@]}" - name: Build - uses: zupit-it/pipeline-templates/.github/actions/dotnet/build@v1.23.2 + uses: zupit-it/pipeline-templates/.github/actions/dotnet/build@chore/better-caching with: WORKING_DIRECTORY: ${{ inputs.WORKING_DIRECTORY }} BUILD_CONFIG: "Debug"