-
-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ Add new
custom-cache-suffix
option
As discussed in 234. Includes tests. Fixes 234
- Loading branch information
Showing
6 changed files
with
97 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
#!/usr/bin/env -S expect -f | ||
|
||
# For testing environment variables written to GITHUB_ENV | ||
set gitHubEnvFile cache_key_08.txt | ||
set ::env(GITHUB_ENV) $gitHubEnvFile | ||
|
||
# For testing outputs variables written to GITHUB_OUTPUT | ||
set gitHubOutputFile cache_key_output_08.txt | ||
set ::env(GITHUB_OUTPUT) $gitHubOutputFile | ||
|
||
set timeout 3 | ||
spawn ../../bin/cache_key.sh "Linux" "8.1.12" "lowest" "--ignore-platform-req=php+" "long-files-hash" "" "suffix" | ||
match_max 100000 | ||
|
||
expect -exact "::debug::Cache primary key is 'Linux-php-8.1.12-composer---ignore-platform-req=php+-lowest-suffix-long-files-hash'" | ||
expect -exact "::debug::Cache restore keys are 'Linux-php-8.1.12-composer---ignore-platform-req=php+-lowest-suffix-'" | ||
expect eof | ||
|
||
# Confirm environment variables. | ||
set fp [open $gitHubEnvFile r] | ||
set fileData [read $fp] | ||
close $fp | ||
|
||
set expectedValue "CACHE_RESTORE_KEY<<EOF | ||
Linux-php-8.1.12-composer---ignore-platform-req=php+-lowest-suffix- | ||
EOF | ||
" | ||
|
||
if { $expectedValue != $fileData } { | ||
puts "\nExpected environment variable does not match. Received:\n" | ||
puts $fileData | ||
exit 1 | ||
} | ||
|
||
# Verify output variables have been set correctly. | ||
set fp [open $gitHubOutputFile r] | ||
set fileData [read $fp] | ||
close $fp | ||
|
||
set expectedValue "key=Linux-php-8.1.12-composer---ignore-platform-req=php+-lowest-suffix-long-files-hash\n" | ||
|
||
if { $expectedValue != $fileData } { | ||
puts "\nExpected output variable does not match. Received:\n" | ||
puts $fileData | ||
exit 1 | ||
} | ||
|
||
# Clean up | ||
file delete $gitHubEnvFile | ||
file delete $gitHubOutputFile |