dfhack/.github/workflows/test.yml

147 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
docs: true
html: false
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' }}
docs: true
html: false
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-04 00:53:45 -06:00
run-tests:
2023-08-06 23:39:05 -06:00
name: Test (${{ matrix.os }}, ${{ matrix.compiler }}, ${{ matrix.plugins }} plugins, ${{ matrix.config }} config)
2023-08-03 22:49:26 -06:00
needs:
- build-windows
- build-linux
runs-on: ${{ matrix.os }}-latest
strategy:
fail-fast: false
matrix:
include:
- os: windows
compiler: msvc
plugins: "default"
2023-08-06 23:39:05 -06:00
config: "default"
- os: windows
compiler: msvc
plugins: "default"
config: "empty"
2023-09-24 17:00:19 -06:00
- os: ubuntu
compiler: gcc-10
plugins: "default"
config: "default"
- os: ubuntu
compiler: gcc-12
plugins: "all"
config: "default"
2023-08-03 04:59:50 -06:00
steps:
- name: Set env
shell: bash
2023-08-03 22:49:26 -06:00
run: echo "DF_FOLDER=DF" >> $GITHUB_ENV
2023-09-24 18:16:13 -06:00
- name: Install dependencies
if: matrix.os == 'ubuntu'
run: |
sudo apt-get update
2023-09-24 23:00:03 -06:00
sudo apt-get install \
libsdl2-2.0-0 \
libsdl2-image-2.0-0
2023-08-03 04:59:50 -06:00
- name: Clone DFHack
uses: actions/checkout@v3
with:
2023-08-06 00:25:10 -06:00
repository: ${{ inputs.dfhack_ref && github.repository || 'DFHack/dfhack' }}
2023-08-03 04:59:50 -06:00
ref: ${{ inputs.dfhack_ref }}
- name: Detect DF version
shell: bash
2023-08-03 22:49:26 -06:00
run: echo DF_VERSION="$(sh ci/get-df-version.sh)" >> $GITHUB_ENV
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 }}
2023-08-03 22:49:26 -06:00
key: df-${{ matrix.os }}-${{ env.DF_VERSION }}-${{ hashFiles('ci/download-df.sh') }}
2023-08-03 04:59:50 -06:00
- name: Download DF
if: steps.restore-df.outputs.cache-hit != 'true'
2023-08-03 22:49:26 -06:00
run: sh ci/download-df.sh ${{ env.DF_FOLDER }} ${{ matrix.os }} ${{ env.DF_VERSION }}
2023-08-03 04:59:50 -06:00
- name: Save DF cache
if: steps.restore-df.outputs.cache-hit != 'true'
uses: actions/cache/save@v3
with:
path: ${{ env.DF_FOLDER }}
2023-08-03 22:49:26 -06:00
key: df-${{ matrix.os }}-${{ env.DF_VERSION }}-${{ hashFiles('ci/download-df.sh') }}
2023-08-06 23:39:05 -06:00
- name: Install blank DFHack init scripts
if: matrix.config == 'empty'
shell: bash
run: |
2023-08-07 00:07:08 -06:00
mkdir -p ${{ env.DF_FOLDER }}/dfhack-config/init
2023-08-06 23:39:05 -06:00
cd data/dfhack-config/init
2023-08-07 00:07:08 -06:00
for fname in *.init; do touch ../../../${{ env.DF_FOLDER }}/dfhack-config/init/$fname; done
- name: Download DFHack
2023-08-03 04:59:50 -06:00
uses: actions/download-artifact@v3
with:
2023-08-03 22:49:26 -06:00
name: test-${{ matrix.compiler }}
- name: Install DFHack
shell: bash
run: tar xjf test-${{ matrix.compiler }}.tar.bz2 -C ${{ env.DF_FOLDER }}
2023-09-24 23:00:03 -06:00
- name: Start X server
if: matrix.os == 'ubuntu'
2023-09-25 00:23:49 -06:00
run: Xvfb :0 -screen 0 1600x1200x24 &
2023-08-03 04:59:50 -06:00
- name: Run lua tests
2023-08-03 09:22:27 -06:00
timeout-minutes: 10
2023-09-24 23:00:03 -06:00
env:
DISPLAY: :0
2023-09-25 01:04:29 -06:00
TERM: xterm-256color
2023-08-03 04:59:50 -06:00
run: python ci/run-tests.py --keep-status "${{ env.DF_FOLDER }}"
2023-08-03 22:04:46 -06:00
- name: Check RPC interface
run: python ci/check-rpc.py "${{ env.DF_FOLDER }}/dfhack-rpc.txt"
2023-08-03 04:59:50 -06:00
- name: Upload test artifacts
uses: actions/upload-artifact@v3
if: always()
continue-on-error: true
with:
2023-08-07 00:07:08 -06:00
name: test-output-${{ matrix.compiler }}-${{ matrix.plugins }}_plugins-${{ matrix.config }}_config
2023-08-03 04:59:50 -06:00
path: |
2023-08-03 22:04:46 -06:00
${{ env.DF_FOLDER }}/dfhack-rpc.txt
2023-08-03 04:59:50 -06:00
${{ env.DF_FOLDER }}/test*.json
${{ env.DF_FOLDER }}/*.log