From 85ac514e9ae5042ec75b16f6669bc3af1b5b3ede Mon Sep 17 00:00:00 2001 From: Saleem Abdulrasool Date: Mon, 14 Apr 2025 14:43:21 -0700 Subject: [PATCH 1/2] setup-sccache: correct indentation (NFC) Adjust the indentation to be consistent. The repository uses 2 space indents, the script was a mixture of 2-space indents and 4-space indents. --- .github/actions/setup-sccache/action.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/actions/setup-sccache/action.yml b/.github/actions/setup-sccache/action.yml index 0e949f83..d6dde19b 100644 --- a/.github/actions/setup-sccache/action.yml +++ b/.github/actions/setup-sccache/action.yml @@ -31,15 +31,15 @@ runs: $AWSArn = '${{ inputs.aws-arn }}' if ($AWSArn) { $requiredParams = @{ - 's3-bucket' = '${{ inputs.s3-bucket }}' - 's3-bucket-encryption' = '${{ inputs.s3-bucket-encryption }}' - 'aws-region' = '${{ inputs.aws-region }}' + 's3-bucket' = '${{ inputs.s3-bucket }}' + 's3-bucket-encryption' = '${{ inputs.s3-bucket-encryption }}' + 'aws-region' = '${{ inputs.aws-region }}' } foreach ($param in $requiredParams.GetEnumerator()) { - if ([string]::IsNullOrEmpty($param.Value)) { - Write-Error -Message "$($param.Key) input cannot be empty when aws-arn is provided" -ErrorAction Stop - } + if ([string]::IsNullOrEmpty($param.Value)) { + Write-Error -Message "$($param.Key) input cannot be empty when aws-arn is provided" -ErrorAction Stop + } } Write-Host "Using S3 bucket ${{ inputs.s3-bucket }} for cache storage." From ee4ff2fb7be9d5fd4a321f7cca6479d18451bdfb Mon Sep 17 00:00:00 2001 From: Saleem Abdulrasool Date: Mon, 14 Apr 2025 14:56:51 -0700 Subject: [PATCH 2/2] setup-sccache: enable sccache debug logging with debugging The additional logging in sccache can be beneficial for understanding failures. In the case that step debugging is enabled, we should enable the debug logging in sccache as well. --- .github/actions/setup-sccache/action.yml | 31 ++++++++++++++---------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/.github/actions/setup-sccache/action.yml b/.github/actions/setup-sccache/action.yml index d6dde19b..2addfcd4 100644 --- a/.github/actions/setup-sccache/action.yml +++ b/.github/actions/setup-sccache/action.yml @@ -25,36 +25,41 @@ inputs: runs: using: composite steps: - - name: Configure caching enviornment + - name: Configure Caching Enviornment shell: pwsh run: | + # Prefer preprocessor caching; this has no effect when local caching is + # not used. + "SCCACHE_DIRECT=true" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding UTF8 + + if ("$env:ACTIONS_STEP_DEBUG" -eq "true") { + "SCCACHE_LOG_LEVEL=debug" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding UTF8 + } + $AWSArn = '${{ inputs.aws-arn }}' if ($AWSArn) { - $requiredParams = @{ + $Parameters = @{ 's3-bucket' = '${{ inputs.s3-bucket }}' 's3-bucket-encryption' = '${{ inputs.s3-bucket-encryption }}' 'aws-region' = '${{ inputs.aws-region }}' } - foreach ($param in $requiredParams.GetEnumerator()) { - if ([string]::IsNullOrEmpty($param.Value)) { - Write-Error -Message "$($param.Key) input cannot be empty when aws-arn is provided" -ErrorAction Stop + foreach ($Parameter in $Prameters.GetEnumerator()) { + if ([string]::IsNullOrEmpty($Parameter.Value)) { + Write-Output "::error::$($Parameter.Key) input cannot be empty when aws-arn is provided" } } - Write-Host "Using S3 bucket ${{ inputs.s3-bucket }} for cache storage." - "SCCACHE_BUCKET=${{ inputs.s3-bucket }}" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append - "SCCACHE_REGION=${{ inputs.aws-region }}" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append - "SCCACHE_S3_SERVER_SIDE_ENCRYPTION=${{ inputs.s3-bucket-encryption }}" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append - } else { - Write-Host "Using local disk cache." - "SCCACHE_DIRECT=on" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append + Write-Output "::info::Using S3 bucket ${{ inputs.s3-bucket }} for cache storage" + "SCCACHE_BUCKET=${{ inputs.s3-bucket }}" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding UTF8 + "SCCACHE_REGION=${{ inputs.aws-region }}" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding UTF8 + "SCCACHE_S3_SERVER_SIDE_ENCRYPTION=${{ inputs.s3-bucket-encryption }}" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding UTF8 } - name: Authenticate to AWS id: aws-credentials - uses: aws-actions/configure-aws-credentials@v3 if: inputs.aws-arn != '' + uses: aws-actions/configure-aws-credentials@v3 with: role-to-assume: ${{ inputs.aws-arn }} role-session-name: ToolchainCISccacheAccess