Skip to content

Commit 7e753b6

Browse files
ZZy979LukeSavefrogs
authored andcommitted
Add Windows and PowerShell-specific shell commands
1 parent 936e86e commit 7e753b6

2 files changed

Lines changed: 28 additions & 24 deletions

File tree

.github/workflows/test-action.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,8 @@ jobs:
6969
echo "GITHUB_PATH"
7070
cat $GITHUB_PATH
7171
72-
cat ~/.local/bin/jython
72+
[ -f ~/.local/bin/jython ] && cat ~/.local/bin/jython
73+
[ -f ~/.local/bin/jython.bat ] && cat ~/.local/bin/jython.bat
7374
7475
- name: Run Jython (Bash)
7576
shell: bash
@@ -84,4 +85,9 @@ jobs:
8485
shell: pwsh
8586
if: ${{ runner.os == 'Windows' }}
8687
run: |
87-
jython -c 'import sys, os; print(os.name, sys.version); print "\n\nJython Works!\n\n"'
88+
Describe JythonTest {
89+
It 'verifies Jython works' {
90+
$output = jython -c "import sys, os; print(os.name, sys.version); print '\n\nJython Works!\n\n'"
91+
$output | Select-String -Quiet -Pattern "Jython Works!" | Should -Be true
92+
}
93+
}

action.yml

Lines changed: 20 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ runs:
144144
mkdir -p ~/.local/bin;
145145
case "${{ steps.find_installer.outputs.file_type }}" in
146146
class)
147-
jython_cmd="java -verbose -Dpython.home='${installation_path}' -cp '${installation_path}/jython.jar' org.python.util.jython \"\$@\""
147+
jython_cmd="java -verbose -Dpython.home=${installation_path} -cp ${installation_path}/jython.jar org.python.util.jython \"\$@\""
148148
;;
149149
150150
jar)
@@ -153,33 +153,31 @@ runs:
153153
esac
154154
155155
echo "$jython_cmd" >> ~/.local/bin/jython;
156-
157156
chmod +x ~/.local/bin/jython;
158-
echo ~/.local/bin >> $GITHUB_PATH
159-
# echo ${{ github.workspace }}/.local/bin >> $GITHUB_PATH
157+
158+
- name: Setup Jython alias (pwsh)
159+
if: runner.os == 'Windows'
160+
shell: pwsh
161+
run: |
162+
$installation_path = Convert-Path "${{ inputs.installation-path }}"
163+
if ("${{ steps.find_installer.outputs.file_type }}" -eq "class") {
164+
$jython_cmd = "java -Dpython.home=$installation_path -cp $installation_path\jython.jar org.python.util.jython %*"
165+
} else {
166+
$jython_cmd = "java -jar $installation_path\jython.jar %*"
167+
}
168+
169+
mkdir -Force ~\.local\bin
170+
$jython_cmd | Out-File -FilePath ~\.local\bin\jython.bat
160171
161172
- name: Add to PATH (Linux and macOS)
162173
if: runner.os != 'Windows'
163174
shell: bash
164-
run: echo ${HOME}/.local/bin >> $GITHUB_PATH
175+
run: |
176+
echo ~/.local/bin >> $GITHUB_PATH
177+
echo "${{ steps.find_installer.outputs.file_type }}/bin" >> $GITHUB_PATH
165178
- name: Add to PATH (Windows)
166179
if: runner.os == 'Windows'
167180
shell: pwsh
168181
run: |
169-
"$env:USERPROFILE\.local\bin" | Out-File -FilePath $env:GITHUB_PATH -Append
170-
- name: DEBUG - Powershell
171-
shell: pwsh
172-
run: |
173-
Write-Output "Printing '\$GITHUB_PATH' content:"
174-
Get-Content $env:GITHUB_PATH;
175-
176-
Write-Output "Printing '~/.local/bin' content:"
177-
Get-ChildItem ~/.local/bin;
178-
- name: DEBUG - Bash
179-
shell: bash
180-
run: |
181-
echo "Printing '\$GITHUB_PATH' content:"
182-
cat $GITHUB_PATH;
183-
184-
echo "Printing '~/.local/bin' content:"
185-
ls -l ~/.local/bin;
182+
"$HOME\.local\bin" | Out-File -FilePath $env:GITHUB_PATH -Append
183+
Convert-Path "${{ inputs.installation-path }}\bin" | Out-File -FilePath $env:GITHUB_PATH -Append

0 commit comments

Comments
 (0)