dfhack/.github/workflows/test.yml

148 lines
4.4 KiB
YAML

2023-08-03 02:23:36 -06:00
name: Test
on:
workflow_call:
inputs:
dfhack_ref:
type: string
scripts_ref:
type: string
structures_ref:
type: string
jobs:
2023-08-03 04:59:50 -06:00
build-windows:
name: Windows MSVC
uses: ./.github/workflows/build-windows.yml
with:
dfhack_ref: ${{ inputs.dfhack_ref }}
2023-08-03 05:13:06 -06:00
scripts_ref: ${{ inputs.scripts_ref }}
2023-08-03 04:59:50 -06:00
structures_ref: ${{ inputs.structures_ref }}
artifact-name: test-msvc
cache-id: test
tests: true
2023-08-03 04:59:50 -06:00
2023-08-03 02:23:36 -06:00
build-linux:
name: Linux gcc-${{ matrix.gcc }}
uses: ./.github/workflows/build-linux.yml
with:
dfhack_ref: ${{ inputs.dfhack_ref }}
scripts_ref: ${{ inputs.scripts_ref }}
structures_ref: ${{ inputs.structures_ref }}
artifact-name: test-gcc-${{ matrix.gcc }}
cache-id: test
stonesense: ${{ matrix.plugins == 'all' }}
extras: ${{ matrix.plugins == 'all' }}
tests: true
2023-08-03 02:23:36 -06:00
gcc-ver: ${{ matrix.gcc }}
secrets: inherit
strategy:
fail-fast: false
matrix:
include:
- gcc: 10
plugins: "default"
- gcc: 12
plugins: "all"
2023-08-03 04:59:50 -06:00
test-windows:
name: Test (Windows, MSVC, default plugins)
needs: build-windows
runs-on: windows-latest
steps:
- name: Set env
2023-08-03 05:24:23 -06:00
run: echo "DF_FOLDER=DF" >> $env:GITHUB_ENV
2023-08-03 04:59:50 -06:00
- name: Clone DFHack
uses: actions/checkout@v3
with:
repository: 'DFHack/dfhack'
ref: ${{ inputs.dfhack_ref }}
2023-08-03 05:13:06 -06:00
sparse-checkout: |
CMakeLists.txt
ci/
2023-08-03 04:59:50 -06:00
- name: Detect DF version
id: get-df-version
2023-08-03 05:37:13 -06:00
run: echo ver="$(sh ci/get-df-version.sh)" >> $env:GITHUB_OUTPUT
2023-08-03 04:59:50 -06:00
- 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
2023-08-03 09:22:27 -06:00
timeout-minutes: 10
2023-08-03 04:59:50 -06:00
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
2023-08-03 02:23:36 -06:00
test-linux:
name: Test (Linux, GCC ${{ matrix.gcc }}, ${{ matrix.plugins }} plugins)
needs: build-linux
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- gcc: 10
plugins: "default"
- gcc: 12
plugins: "all"
steps:
- name: Download artifact
uses: actions/download-artifact@v3
with:
name: test-gcc-${{ matrix.gcc }}
# - name: Fetch DF cache
# uses: actions/cache@v3
# with:
# path: ~/DF
# key: df-${{ hashFiles('ci/download-df.sh') }}
# - name: Download DF
# run: |
# sh ci/download-df.sh
# - name: Run lua tests
# id: run_tests_lua
# run: |
# export TERM=dumb
# status=0
# script -qe -c "python ci/run-tests.py --headless --keep-status \"$DF_FOLDER\"" || status=$((status + 1))
# python ci/check-rpc.py "$DF_FOLDER/dfhack-rpc.txt" || status=$((status + 2))
# mkdir -p artifacts
# cp "$DF_FOLDER"/test*.json "$DF_FOLDER"/*.log artifacts || status=$((status + 4))
# exit $status
# - name: Upload test artifacts
# uses: actions/upload-artifact@v3
# if: (success() || failure()) && steps.run_tests.outcome != 'skipped'
# continue-on-error: true
# with:
# name: test-artifacts-${{ matrix.gcc }}
# path: artifacts
# - name: Clean up DF folder
# # prevent DFHack-generated files from ending up in the cache
# # (download-df.sh also removes them, this is just to save cache space)
# if: success() || failure()
# run: |
# rm -rf "$DF_FOLDER"