Skip to content

setup-sccache: enable additional debug logging #939

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 22 additions & 17 deletions .github/actions/setup-sccache/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 = @{
's3-bucket' = '${{ inputs.s3-bucket }}'
's3-bucket-encryption' = '${{ inputs.s3-bucket-encryption }}'
'aws-region' = '${{ inputs.aws-region }}'
$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
Expand Down