File tree 26 files changed +420
-47
lines changed
26 files changed +420
-47
lines changed Original file line number Diff line number Diff line change 85
85
"${{ inputs.composer-options }}" \
86
86
"${{ inputs.working-directory }}" \
87
87
"${{ steps.php.outputs.path }}" \
88
- "${{ steps.composer.outputs.command }}" \
88
+ "${{ steps.composer.outputs.composer_command }}" \
89
89
"${{ steps.composer.outputs.lock }}"
Original file line number Diff line number Diff line change @@ -57,7 +57,7 @@ cache_key="$(make_key "${key[@]}")"
57
57
echo " ::debug::Cache primary key is '${cache_key} '"
58
58
echo " ::debug::Cache restore keys are '$( join_by " , " " ${uniq_restore_key[@]} " ) '"
59
59
60
- echo " ::set-output name= key:: ${cache_key} "
60
+ echo " key= ${cache_key} " >> " ${GITHUB_OUTPUT }"
61
61
62
62
# Use an environment variable to capture the multiline restore key.
63
63
# See: https://docs.github.com/en/actions/learn-github-actions/workflow-commands-for-github-actions#multiline-strings
Original file line number Diff line number Diff line change @@ -53,7 +53,9 @@ echo "::debug::${composer_version}"
53
53
echo " ::debug::Composer cache directory found at '${cache_dir} '"
54
54
echo " ::debug::File composer.json found at '${composer_json} '"
55
55
echo " ::debug::File composer.lock path computed as '${composer_lock} '"
56
- echo " ::set-output name=command::${composer_path} "
57
- echo " ::set-output name=cache-dir::${cache_dir} "
58
- echo " ::set-output name=json::${composer_json} "
59
- echo " ::set-output name=lock::${composer_lock} "
56
+ {
57
+ echo " composer_command=${composer_path} "
58
+ echo " cache-dir=${cache_dir} "
59
+ echo " json=${composer_json} "
60
+ echo " lock=${composer_lock} "
61
+ } >> " ${GITHUB_OUTPUT} "
Original file line number Diff line number Diff line change @@ -16,5 +16,5 @@ php_version=$($php_path -r 'echo phpversion();')
16
16
17
17
echo " ::debug::PHP path is '${php_path} '"
18
18
echo " ::debug::PHP version is '${php_version} '"
19
- echo " ::set-output name= path:: ${php_path} "
20
- echo " ::set-output name= version:: ${php_version} "
19
+ echo " path= ${php_path} " >> " ${GITHUB_OUTPUT }"
20
+ echo " version= ${php_version} " >> " ${GITHUB_OUTPUT }"
Original file line number Diff line number Diff line change @@ -15,4 +15,4 @@ if [ $should_cache -eq 0 ]; then
15
15
fi
16
16
17
17
echo " ::debug::We ${will_cache} the dependencies because ignore-cache is set to '${ignore_cache} '"
18
- echo " ::set-output name= do-cache:: ${should_cache} "
18
+ echo " do-cache= ${should_cache} " >> " ${GITHUB_OUTPUT }"
Original file line number Diff line number Diff line change 1
1
#!/usr/bin/env -S expect -f
2
2
3
+ # For testing environment variables written to GITHUB_ENV
3
4
set gitHubEnvFile cache_key_01.txt
4
5
set ::env(GITHUB_ENV) $gitHubEnvFile
5
6
7
+ # For testing outputs variables written to GITHUB_OUTPUT
8
+ set gitHubOutputFile cache_key_output_01.txt
9
+ set ::env(GITHUB_OUTPUT) $gitHubOutputFile
10
+
6
11
set timeout 3
7
12
spawn ../../bin/cache_key.sh
8
13
match_max 100000
9
14
10
15
expect -exact "::debug::Cache primary key is 'php-composer-locked'"
11
16
expect -exact "::debug::Cache restore keys are 'php-composer-locked-'"
12
- expect -exact "::set-output name=key::php-composer-locked"
17
+
13
18
expect eof
14
19
20
+ # Confirm environment variables.
15
21
set fp [open $gitHubEnvFile r]
16
22
set fileData [read $fp]
17
23
close $fp
@@ -27,5 +33,19 @@ if { $expectedValue != $fileData } {
27
33
exit 1
28
34
}
29
35
36
+ # Verify output variables have been set correctly.
37
+ set fp [open $gitHubOutputFile r]
38
+ set fileData [read $fp]
39
+ close $fp
40
+
41
+ set expectedValue "key=php-composer-locked\n"
42
+
43
+ if { $expectedValue != $fileData } {
44
+ puts "\nExpected output variable does not match. Received:\n"
45
+ puts $fileData
46
+ exit 1
47
+ }
48
+
30
49
# Clean up
31
50
file delete $gitHubEnvFile
51
+ file delete $gitHubOutputFile
Original file line number Diff line number Diff line change 1
1
#!/usr/bin/env -S expect -f
2
2
3
+ # For testing environment variables written to GITHUB_ENV
3
4
set gitHubEnvFile cache_key_02.txt
4
5
set ::env(GITHUB_ENV) $gitHubEnvFile
5
6
7
+ # For testing outputs variables written to GITHUB_OUTPUT
8
+ set gitHubOutputFile cache_key_output_02.txt
9
+ set ::env(GITHUB_OUTPUT) $gitHubOutputFile
10
+
6
11
set timeout 3
7
12
spawn ../../bin/cache_key.sh "Linux" "8.1.1" "" "" "long-files-hash"
8
13
match_max 100000
9
14
10
15
expect -exact "::debug::Cache primary key is 'Linux-php-8.1.1-composer-locked-long-files-hash'"
11
16
expect -exact "::debug::Cache restore keys are 'Linux-php-8.1.1-composer-locked-'"
12
- expect -exact "::set-output name=key::Linux-php-8.1.1-composer-locked-long-files-hash"
13
17
expect eof
14
18
19
+ # Confirm environment variables.
15
20
set fp [open $gitHubEnvFile r]
16
21
set fileData [read $fp]
17
22
close $fp
@@ -27,5 +32,19 @@ if { $expectedValue != $fileData } {
27
32
exit 1
28
33
}
29
34
35
+ # Verify output variables have been set correctly.
36
+ set fp [open $gitHubOutputFile r]
37
+ set fileData [read $fp]
38
+ close $fp
39
+
40
+ set expectedValue "key=Linux-php-8.1.1-composer-locked-long-files-hash\n"
41
+
42
+ if { $expectedValue != $fileData } {
43
+ puts "\nExpected output variable does not match. Received:\n"
44
+ puts $fileData
45
+ exit 1
46
+ }
47
+
30
48
# Clean up
31
49
file delete $gitHubEnvFile
50
+ file delete $gitHubOutputFile
Original file line number Diff line number Diff line change 1
1
#!/usr/bin/env -S expect -f
2
2
3
+ # For testing environment variables written to GITHUB_ENV
3
4
set gitHubEnvFile cache_key_03.txt
4
5
set ::env(GITHUB_ENV) $gitHubEnvFile
5
6
7
+ # For testing outputs variables written to GITHUB_OUTPUT
8
+ set gitHubOutputFile cache_key_output_03.txt
9
+ set ::env(GITHUB_OUTPUT) $gitHubOutputFile
10
+
6
11
set timeout 3
7
12
spawn ../../bin/cache_key.sh "Linux" "8.1.1" "locked" "" "long-files-hash"
8
13
match_max 100000
9
14
10
15
expect -exact "::debug::Cache primary key is 'Linux-php-8.1.1-composer-locked-long-files-hash'"
11
16
expect -exact "::debug::Cache restore keys are 'Linux-php-8.1.1-composer-locked-'"
12
- expect -exact "::set-output name=key::Linux-php-8.1.1-composer-locked-long-files-hash"
13
17
expect eof
14
18
19
+ # Confirm environment variables.
15
20
set fp [open $gitHubEnvFile r]
16
21
set fileData [read $fp]
17
22
close $fp
@@ -27,5 +32,19 @@ if { $expectedValue != $fileData } {
27
32
exit 1
28
33
}
29
34
35
+ # Verify output variables have been set correctly.
36
+ set fp [open $gitHubOutputFile r]
37
+ set fileData [read $fp]
38
+ close $fp
39
+
40
+ set expectedValue "key=Linux-php-8.1.1-composer-locked-long-files-hash\n"
41
+
42
+ if { $expectedValue != $fileData } {
43
+ puts "\nExpected output variable does not match. Received:\n"
44
+ puts $fileData
45
+ exit 1
46
+ }
47
+
30
48
# Clean up
31
49
file delete $gitHubEnvFile
50
+ file delete $gitHubOutputFile
Original file line number Diff line number Diff line change 1
1
#!/usr/bin/env -S expect -f
2
2
3
+ # For testing environment variables written to GITHUB_ENV
3
4
set gitHubEnvFile cache_key_04.txt
4
5
set ::env(GITHUB_ENV) $gitHubEnvFile
5
6
7
+ # For testing outputs variables written to GITHUB_OUTPUT
8
+ set gitHubOutputFile cache_key_output_04.txt
9
+ set ::env(GITHUB_OUTPUT) $gitHubOutputFile
10
+
6
11
set timeout 3
7
12
spawn ../../bin/cache_key.sh "Linux" "8.1.1" "lowest" "--ignore-platform-reqs --optimize-autoloader" "long-files-hash"
8
13
match_max 100000
9
14
10
15
expect -exact "::debug::Cache primary key is 'Linux-php-8.1.1-composer---ignore-platform-reqs---optimize-autoloader-lowest-long-files-hash'"
11
16
expect -exact "::debug::Cache restore keys are 'Linux-php-8.1.1-composer---ignore-platform-reqs---optimize-autoloader-lowest-'"
12
- expect -exact "::set-output name=key::Linux-php-8.1.1-composer---ignore-platform-reqs---optimize-autoloader-lowest-long-files-hash"
13
17
expect eof
14
18
19
+ # Confirm environment variables.
15
20
set fp [open $gitHubEnvFile r]
16
21
set fileData [read $fp]
17
22
close $fp
@@ -27,5 +32,19 @@ if { $expectedValue != $fileData } {
27
32
exit 1
28
33
}
29
34
35
+ # Verify output variables have been set correctly.
36
+ set fp [open $gitHubOutputFile r]
37
+ set fileData [read $fp]
38
+ close $fp
39
+
40
+ set expectedValue "key=Linux-php-8.1.1-composer---ignore-platform-reqs---optimize-autoloader-lowest-long-files-hash\n"
41
+
42
+ if { $expectedValue != $fileData } {
43
+ puts "\nExpected output variable does not match. Received:\n"
44
+ puts $fileData
45
+ exit 1
46
+ }
47
+
30
48
# Clean up
31
49
file delete $gitHubEnvFile
50
+ file delete $gitHubOutputFile
Original file line number Diff line number Diff line change 1
1
#!/usr/bin/env -S expect -f
2
2
3
+ # For testing environment variables written to GITHUB_ENV
3
4
set gitHubEnvFile cache_key_05.txt
4
5
set ::env(GITHUB_ENV) $gitHubEnvFile
5
6
7
+ # For testing outputs variables written to GITHUB_OUTPUT
8
+ set gitHubOutputFile cache_key_output_05.txt
9
+ set ::env(GITHUB_OUTPUT) $gitHubOutputFile
10
+
6
11
set timeout 3
7
12
spawn ../../bin/cache_key.sh "Linux" "8.1.1" "locked" "" "long-files-hash" "my-custom-key"
8
13
match_max 100000
9
14
10
15
expect -exact "::debug::Cache primary key is 'my-custom-key'"
11
16
expect -exact "::debug::Cache restore keys are ''"
12
- expect -exact "::set-output name=key::my-custom-key"
13
17
expect eof
14
18
19
+ # Confirm environment variables.
15
20
set fp [open $gitHubEnvFile r]
16
21
set fileData [read $fp]
17
22
close $fp
@@ -27,5 +32,19 @@ if { $expectedValue != $fileData } {
27
32
exit 1
28
33
}
29
34
35
+ # Verify output variables have been set correctly.
36
+ set fp [open $gitHubOutputFile r]
37
+ set fileData [read $fp]
38
+ close $fp
39
+
40
+ set expectedValue "key=my-custom-key\n"
41
+
42
+ if { $expectedValue != $fileData } {
43
+ puts "\nExpected output variable does not match. Received:\n"
44
+ puts $fileData
45
+ exit 1
46
+ }
47
+
30
48
# Clean up
31
49
file delete $gitHubEnvFile
50
+ file delete $gitHubOutputFile
Original file line number Diff line number Diff line change 1
1
#!/usr/bin/env -S expect -f
2
2
3
+ # For testing environment variables written to GITHUB_ENV
3
4
set gitHubEnvFile cache_key_06.txt
4
5
set ::env(GITHUB_ENV) $gitHubEnvFile
5
6
7
+ # For testing outputs variables written to GITHUB_OUTPUT
8
+ set gitHubOutputFile cache_key_output_06.txt
9
+ set ::env(GITHUB_OUTPUT) $gitHubOutputFile
10
+
6
11
set timeout 3
7
12
spawn ../../bin/cache_key.sh "Linux" "8.1.1" "" "" "long-files-hash" "" "path/to/working/dir"
8
13
match_max 100000
9
14
10
15
expect -exact "::debug::Cache primary key is 'Linux-php-8.1.1-composer-locked-path/to/working/dir-long-files-hash'"
11
16
expect -exact "::debug::Cache restore keys are 'Linux-php-8.1.1-composer-locked-path/to/working/dir-'"
12
- expect -exact "::set-output name=key::Linux-php-8.1.1-composer-locked-path/to/working/dir-long-files-hash"
13
17
expect eof
14
18
19
+ # Confirm environment variables.
15
20
set fp [open $gitHubEnvFile r]
16
21
set fileData [read $fp]
17
22
close $fp
@@ -27,5 +32,19 @@ if { $expectedValue != $fileData } {
27
32
exit 1
28
33
}
29
34
35
+ # Verify output variables have been set correctly.
36
+ set fp [open $gitHubOutputFile r]
37
+ set fileData [read $fp]
38
+ close $fp
39
+
40
+ set expectedValue "key=Linux-php-8.1.1-composer-locked-path/to/working/dir-long-files-hash\n"
41
+
42
+ if { $expectedValue != $fileData } {
43
+ puts "\nExpected output variable does not match. Received:\n"
44
+ puts $fileData
45
+ exit 1
46
+ }
47
+
30
48
# Clean up
31
49
file delete $gitHubEnvFile
50
+ file delete $gitHubOutputFile
Original file line number Diff line number Diff line change 1
1
#!/usr/bin/env -S expect -f
2
2
3
+ # For testing environment variables written to GITHUB_ENV
3
4
set gitHubEnvFile cache_key_07.txt
4
5
set ::env(GITHUB_ENV) $gitHubEnvFile
5
6
7
+ # For testing outputs variables written to GITHUB_OUTPUT
8
+ set gitHubOutputFile cache_key_output_07.txt
9
+ set ::env(GITHUB_OUTPUT) $gitHubOutputFile
10
+
6
11
set timeout 3
7
12
spawn ../../bin/cache_key.sh "Windows" "8.0.2" "foobar" "" "some-other-hash"
8
13
match_max 100000
9
14
10
15
expect -exact "::debug::Cache primary key is 'Windows-php-8.0.2-composer-locked-some-other-hash'"
11
16
expect -exact "::debug::Cache restore keys are 'Windows-php-8.0.2-composer-locked-'"
12
- expect -exact "::set-output name=key::Windows-php-8.0.2-composer-locked-some-other-hash"
13
17
expect eof
14
18
19
+ # Confirm environment variables.
15
20
set fp [open $gitHubEnvFile r]
16
21
set fileData [read $fp]
17
22
close $fp
@@ -27,5 +32,19 @@ if { $expectedValue != $fileData } {
27
32
exit 1
28
33
}
29
34
35
+ # Verify output variables have been set correctly.
36
+ set fp [open $gitHubOutputFile r]
37
+ set fileData [read $fp]
38
+ close $fp
39
+
40
+ set expectedValue "key=Windows-php-8.0.2-composer-locked-some-other-hash\n"
41
+
42
+ if { $expectedValue != $fileData } {
43
+ puts "\nExpected output variable does not match. Received:\n"
44
+ puts $fileData
45
+ exit 1
46
+ }
47
+
30
48
# Clean up
31
49
file delete $gitHubEnvFile
50
+ file delete $gitHubOutputFile
Original file line number Diff line number Diff line change 1
1
#!/usr/bin/env -S expect -f
2
2
3
+ set gitHubOutputFile composer_paths_01.txt
4
+ set ::env(GITHUB_OUTPUT) $gitHubOutputFile
5
+
3
6
set timeout 3
4
7
spawn ../../bin/composer_paths.sh
5
8
match_max 100000
@@ -9,9 +12,19 @@ expect "::debug::Composer path is '*'\r
9
12
::debug::Composer cache directory found at '*'\r
10
13
::debug::File composer.json found at './composer.json'\r
11
14
::debug::File composer.lock path computed as './composer.lock'\r
12
- ::set-output name=command::*\r
13
- ::set-output name=cache-dir::*\r
14
- ::set-output name=json::./composer.json\r
15
- ::set-output name=lock::./composer.lock\r
16
15
"
17
16
expect eof
17
+
18
+ # Verify output variables have been set correctly.
19
+ set fp [open $gitHubOutputFile r]
20
+ set fileData [read $fp]
21
+ close $fp
22
+
23
+ if {[regexp {^composer_command=\S*\s*cache-dir=\S*\s*json=\./composer\.json\s*lock=./composer.lock\s*$} $fileData] == 0} {
24
+ puts "\nExpected output variable does not match. Received:\n"
25
+ puts $fileData
26
+ exit 1
27
+ }
28
+
29
+ # Clean up
30
+ file delete $gitHubOutputFile
You can’t perform that action at this time.
0 commit comments