|
| 1 | +name: Windows other tests |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_call: |
| 5 | + inputs: |
| 6 | + test-name: |
| 7 | + required: true |
| 8 | + type: string |
| 9 | + |
| 10 | +jobs: |
| 11 | + test: |
| 12 | + runs-on: windows-latest |
| 13 | + |
| 14 | + steps: |
| 15 | + - uses: actions/checkout@v6 |
| 16 | + |
| 17 | + - name: Download test scripts |
| 18 | + uses: actions/download-artifact@v8 |
| 19 | + with: |
| 20 | + name: windows-test-scripts |
| 21 | + path: tests/ |
| 22 | + |
| 23 | + - name: Download libcobj.jar |
| 24 | + uses: actions/download-artifact@v8 |
| 25 | + with: |
| 26 | + name: libcobj.jar |
| 27 | + path: libcobj/app/build/libs/ |
| 28 | + |
| 29 | + - name: Download cobj.exe |
| 30 | + uses: actions/download-artifact@v8 |
| 31 | + with: |
| 32 | + name: cobj.exe |
| 33 | + path: win/x64/Release/ |
| 34 | + |
| 35 | + - name: Install Java |
| 36 | + uses: actions/setup-java@v5 |
| 37 | + with: |
| 38 | + distribution: 'temurin' |
| 39 | + java-version: '11' |
| 40 | + |
| 41 | + - name: Install opensource COBOL 4J |
| 42 | + run: | |
| 43 | + cd win |
| 44 | + ./make-install.ps1 |
| 45 | +
|
| 46 | + - name: Set up test environment |
| 47 | + shell: bash |
| 48 | + run: | |
| 49 | + cd tests |
| 50 | + cp atlocal-win.env atlocal |
| 51 | + WORKSPACE=$(cd .. && pwd) |
| 52 | + sed -i "s|abs_builddir=.*|abs_builddir='${WORKSPACE}/tests'|" atconfig |
| 53 | + sed -i "s|abs_srcdir=.*|abs_srcdir='${WORKSPACE}/tests'|" atconfig |
| 54 | + sed -i "s|abs_top_srcdir=.*|abs_top_srcdir='${WORKSPACE}'|" atconfig |
| 55 | + sed -i "s|abs_top_builddir=.*|abs_top_builddir='${WORKSPACE}'|" atconfig |
| 56 | + sed -i "s|SHELL=.*|SHELL='$(which bash)'|" atconfig |
| 57 | +
|
| 58 | + - name: Run tests ${{ inputs.test-name }} |
| 59 | + shell: bash |
| 60 | + run: | |
| 61 | + # Create a diff wrapper that strips trailing CR so CRLF output from |
| 62 | + # Windows binaries compares equal to LF expected outputs. |
| 63 | + mkdir -p /tmp/diff-wrapper |
| 64 | + printf '%s\n' '#!/bin/bash' 'exec /usr/bin/diff --strip-trailing-cr "$@"' > /tmp/diff-wrapper/diff |
| 65 | + chmod +x /tmp/diff-wrapper/diff |
| 66 | + export PATH="/tmp/diff-wrapper:$PATH" |
| 67 | + export CLASSPATH=".;C:/opensourcecobol4j/lib/libcobj.jar" |
| 68 | + cd tests |
| 69 | + ./${{ inputs.test-name }} |
| 70 | +
|
| 71 | + - name: Upload log files if tests fail |
| 72 | + if: failure() |
| 73 | + uses: actions/upload-artifact@v7 |
| 74 | + with: |
| 75 | + name: windows-${{ inputs.test-name }}-log |
| 76 | + path: tests/${{ inputs.test-name }}.dir/ |
0 commit comments