first attempt to run tests on windows

develop
Myk Taylor 2023-08-03 03:59:50 -07:00
parent 1411c5e8aa
commit 55f1b0d48e
No known key found for this signature in database
2 changed files with 95 additions and 41 deletions

@ -11,6 +11,15 @@ on:
type: string type: string
jobs: jobs:
build-windows:
name: Windows MSVC
uses: ./.github/workflows/build-windows.yml
with:
dfhack_ref: ${{ inputs.dfhack_ref }}
structures_ref: ${{ inputs.structures_ref }}
artifact-name: test-msvc
cache-id: test
build-linux: build-linux:
name: Linux gcc-${{ matrix.gcc }} name: Linux gcc-${{ matrix.gcc }}
uses: ./.github/workflows/build-linux.yml uses: ./.github/workflows/build-linux.yml
@ -33,6 +42,55 @@ jobs:
- gcc: 12 - gcc: 12
plugins: "all" plugins: "all"
test-windows:
name: Test (Windows, MSVC, default plugins)
needs: build-windows
runs-on: windows-latest
steps:
- name: Set env
run: echo "DF_FOLDER=DF" >> $GITHUB_ENV
- name: Clone DFHack
uses: actions/checkout@v3
with:
repository: 'DFHack/dfhack'
ref: ${{ inputs.dfhack_ref }}
sparse-checkout: CMakeLists.txt
- name: Detect DF version
id: get-df-version
run: echo ver="$(sh ci/get-df-version.sh)" >> $GITHUB_OUTPUT
- name: Fetch DF cache
id: restore-df
uses: actions/cache/restore@v3
with:
path: ${{ env.DF_FOLDER }}
key: df-windows-${{ steps.get-df-version.outputs.ver }}-${{ hashFiles('ci/download-df.sh') }}
- name: Download DF
if: steps.restore-df.outputs.cache-hit != 'true'
run: sh ci/download-df.sh ${{ env.DF_FOLDER }} windows ${{ steps.get-df-version.outputs.ver }}
- name: Save DF cache
if: steps.restore-df.outputs.cache-hit != 'true'
uses: actions/cache/save@v3
with:
path: ${{ env.DF_FOLDER }}
key: df-windows-${{ steps.get-df-version.outputs.ver }}-${{ hashFiles('ci/download-df.sh') }}
- name: Download DFHack
uses: actions/download-artifact@v3
with:
name: test-msvc
path: ${{ env.DF_FOLDER }}
- name: Run lua tests
id: run-tests
run: python ci/run-tests.py --keep-status "${{ env.DF_FOLDER }}"
- name: Upload test artifacts
uses: actions/upload-artifact@v3
if: always()
continue-on-error: true
with:
name: test-artifacts-msvc
path: |
${{ env.DF_FOLDER }}/test*.json
${{ env.DF_FOLDER }}/*.log
test-linux: test-linux:
name: Test (Linux, GCC ${{ matrix.gcc }}, ${{ matrix.plugins }} plugins) name: Test (Linux, GCC ${{ matrix.gcc }}, ${{ matrix.plugins }} plugins)
needs: build-linux needs: build-linux

@ -1,52 +1,48 @@
#!/bin/sh #!/bin/sh
DF_FOLDER=$1
OS_TARGET=$2
DF_VERSION=$3
set -e set -e
df_tardest="df.tar.bz2" minor=$(echo "$DF_VERSION" | cut -d. -f1)
save_tardest="test_save.tgz" patch=$(echo "$DF_VERSION" | cut -d. -f2)
df_url="https://www.bay12games.com/dwarves/df_${minor}_${patch}"
cd "$(dirname "$0")" if test "$OS_TARGET" = "windows"; then
echo "DF_VERSION: $DF_VERSION" df_url="${df_url}_win_s.zip"
echo "DF_FOLDER: $DF_FOLDER" df_archive_name="df.zip"
mkdir -p "$DF_FOLDER" df_extract_cmd="unzip -d ${DF_FOLDER}"
# back out of df_linux elif test "$OS_TARGET" = "linux"; then
cd "$DF_FOLDER/.." df_url="${df_url}_linux.tar.bz2"
df_archive_name="df.tar.bz2"
if ! test -f "$df_tardest"; then df_extract_cmd="tar -x -j --strip-components=1 -f"
minor=$(echo "$DF_VERSION" | cut -d. -f2) else
patch=$(echo "$DF_VERSION" | cut -d. -f3) echo "Unhandled OS target: ${OS_TARGET}"
echo "Downloading DF $DF_VERSION" exit 1
while read url; do fi
echo "Attempting download: ${url}"
if wget -v "$url" -O "$df_tardest"; then if ! wget -v "$df_url" -O "$df_archive_name"; then
break echo "Failed to download DF from $df_url"
fi exit 1
done <<URLS
https://www.bay12games.com/dwarves/df_${minor}_${patch}_linux.tar.bz2
https://files.dfhack.org/DF/${minor}.${patch}/df_${minor}_${patch}_linux.tar.bz2
URLS
echo $df_tardest
if ! test -f "$df_tardest"; then
echo "DF failed to download: $df_tardest not found"
exit 1
fi
echo "Downloading test save"
#test_save_url="https://files.dfhack.org/DF/0.${minor}.${patch}/test_save.tgz"
test_save_url="https://drive.google.com/uc?export=download&id=1XvYngl-DFONiZ9SD9OC4B2Ooecu8rPFz"
if ! wget -v "$test_save_url" -O "$save_tardest"; then
echo "failed to download test save"
exit 1
fi
echo $save_tardest
fi fi
rm -rf df_linux save_url="https://dffd.bay12games.com/download.php?id=15434&f=dreamfort.7z"
mkdir -p df_linux/save save_archive_name="test_save.7z"
save_extract_cmd="7z x -oDF/save"
if ! wget -v "$save_url" -O "$save_archive_name"; then
echo "Failed to download test save from $save_url"
exit 1
fi
echo Extracting echo Extracting
tar xf "$df_tardest" --strip-components=1 -C df_linux $df_extract_cmd "$df_archive_name"
tar xf "$save_tardest" -C df_linux/save $save_extract_cmd "$save_archive_name"
mv DF/save/* DF/save/region1
echo Done echo Done
ls -l ls -l
md5sum "$df_archive_name" "$save_archive_name"