dfhack/.github/workflows/test.yml

133 lines
4.1 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-08-03 22:49:26 -06:00
# TODO: uncomment once we have a linux build we can download from bay12
# - os: ubuntu
# compiler: gcc-10
# plugins: "default"
2023-08-06 23:39:05 -06:00
# config: "default"
2023-08-03 22:49:26 -06:00
# - os: ubuntu
2023-08-06 23:39:05 -06:00
# compiler: gcc-12
2023-08-03 22:49:26 -06:00
# plugins: "all"
2023-08-06 23:39:05 -06:00
# 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-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
2023-08-07 12:01:42 -06:00
- name: Install 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 }}
2023-08-03 04:59:50 -06:00
path: ${{ env.DF_FOLDER }}
- name: Run lua 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 }}"
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