mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-01-18 13:04:45 +00:00
## About The Pull Request
Ensures we don't get a repeat of #76345 (unit test that wasn't ticked in
the `_unit_tests.dm` file, fixed in
596ca8b6d4). Basically, we leverage the
code that was already being used in the DME Validator but then expand it
a bunch via using JSON Schemas that correspond to the type of scan we
want to run. Even though sorting unit tests alphabetically is a bit
different than sorting the tgstation DME, it's good to leverage the
already existing framework rather than create a copy-pasta "lesser" code
runner. This went through strenous testing on my end, so let me know if
anything seems off.
While in the area, I added some other niceties that I've found work
really well in GitHub Runners environments, as well as local testing in
case you really like doing that before you make a PR for some reason.
## Why It's Good For The Game

This is what it looks like pre-596ca8b6d4cc49cd69fc104b53b7f4973497a2e5
(this is now merged, so it will pass CI)
De-hardcodes some stuff and allows for some neater flexibility, less
cringe unit tests being coded and not being ticked in the file, etc.
etc.
## Changelog
Nothing for players to care about.
Let me know if you have a better idea than the schemas, I couldn't think
of one that could be really extensible and flexible in the same way this
is.
235 lines
9.0 KiB
YAML
235 lines
9.0 KiB
YAML
name: CI Suite
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
- 'project/**'
|
|
- 'gh-readonly-queue/master/**'
|
|
- 'gh-readonly-queue/project/**'
|
|
pull_request:
|
|
branches:
|
|
- master
|
|
- 'project/**'
|
|
merge_group:
|
|
branches:
|
|
- master
|
|
jobs:
|
|
run_linters:
|
|
if: "!contains(github.event.head_commit.message, '[ci skip]')"
|
|
name: Run Linters
|
|
runs-on: ubuntu-22.04
|
|
concurrency:
|
|
group: run_linters-${{ github.head_ref || github.run_id }}
|
|
cancel-in-progress: true
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- name: Restore SpacemanDMM cache
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: ~/SpacemanDMM
|
|
key: ${{ runner.os }}-spacemandmm
|
|
- name: Restore Yarn cache
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: tgui/.yarn/cache
|
|
key: ${{ runner.os }}-yarn-${{ hashFiles('tgui/yarn.lock') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-build-
|
|
${{ runner.os }}-
|
|
- name: Restore Rust cache
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: ~/.cargo
|
|
key: ${{ runner.os }}-rust
|
|
restore-keys: |
|
|
${{ runner.os }}-build-
|
|
${{ runner.os }}-
|
|
- name: Install Tools
|
|
run: |
|
|
pip3 install setuptools
|
|
bash tools/ci/install_node.sh
|
|
bash tools/ci/install_spaceman_dmm.sh dreamchecker
|
|
cargo install ripgrep --features pcre2
|
|
tools/bootstrap/python -c ''
|
|
- name: Run Linters
|
|
run: |
|
|
bash tools/ci/check_filedirs.sh tgstation.dme
|
|
bash tools/ci/check_changelogs.sh
|
|
bash tools/ci/check_grep.sh
|
|
bash tools/ci/check_misc.sh
|
|
tools/bootstrap/python tools/ticked_file_enforcement/ticked_file_enforcement.py < tools/ticked_file_enforcement/schemas/tgstation_dme.json
|
|
tools/bootstrap/python tools/ticked_file_enforcement/ticked_file_enforcement.py < tools/ticked_file_enforcement/schemas/unit_tests.json
|
|
tools/bootstrap/python -m tools.maplint.source --github
|
|
tools/build/build --ci lint tgui-test
|
|
tools/bootstrap/python -m define_sanity.check
|
|
tools/bootstrap/python -m dmi.test
|
|
tools/bootstrap/python -m mapmerge2.dmm_test
|
|
~/dreamchecker > ${GITHUB_WORKSPACE}/output-annotations.txt 2>&1
|
|
- name: Annotate Lints
|
|
uses: yogstation13/DreamAnnotate@v2
|
|
if: success() || failure()
|
|
with:
|
|
outputFile: output-annotations.txt
|
|
|
|
compile_all_maps:
|
|
if: "!contains(github.event.head_commit.message, '[ci skip]')"
|
|
name: Compile Maps
|
|
needs: [collect_data]
|
|
runs-on: ubuntu-20.04
|
|
concurrency:
|
|
group: compile_all_maps-${{ github.head_ref || github.run_id }}
|
|
cancel-in-progress: true
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- name: Restore BYOND cache
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: ~/BYOND
|
|
key: ${{ runner.os }}-byond
|
|
- name: Compile All Maps
|
|
run: |
|
|
bash tools/ci/install_byond.sh
|
|
source $HOME/BYOND/byond/bin/byondsetup
|
|
tools/build/build --ci dm -DCIBUILDING -DCITESTING -DALL_MAPS
|
|
- name: Check client Compatibility
|
|
uses: tgstation/byond-client-compatibility-check@v3
|
|
with:
|
|
dmb-location: tgstation.dmb
|
|
max-required-client-version: ${{needs.collect_data.outputs.max_required_byond_client}}
|
|
|
|
collect_data:
|
|
if: "!contains(github.event.head_commit.message, '[ci skip]')"
|
|
name: Collect data for other tasks
|
|
runs-on: ubuntu-20.04
|
|
outputs:
|
|
maps: ${{ steps.map_finder.outputs.maps }}
|
|
alternate_tests: ${{ steps.alternate_test_finder.outputs.alternate_tests }}
|
|
max_required_byond_client: ${{ steps.max_required_byond_client.outputs.max_required_byond_client }}
|
|
concurrency:
|
|
group: find_all_maps-${{ github.head_ref || github.run_id }}
|
|
cancel-in-progress: true
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- name: Find Maps
|
|
id: map_finder
|
|
run: |
|
|
echo "$(ls -mw0 _maps/*.json)" > maps_output.txt
|
|
sed -i -e s+_maps/+\"+g -e s+.json+\"+g maps_output.txt
|
|
echo "Maps: $(cat maps_output.txt)"
|
|
echo "maps={\"paths\":[$(cat maps_output.txt)]}" >> $GITHUB_OUTPUT
|
|
- name: Find Alternate Tests
|
|
id: alternate_test_finder
|
|
run: |
|
|
ALTERNATE_TESTS_JSON=$(jq -nRc '[inputs | capture("^(?<major>[0-9]+)\\.(?<minor>[0-9]+): (?<map>.+)$")]' .github/alternate_byond_versions.txt)
|
|
echo "alternate_tests=$ALTERNATE_TESTS_JSON" >> $GITHUB_OUTPUT
|
|
- name: Collect byond client version configuration
|
|
id: max_required_byond_client
|
|
#the regex here does not filter out non-numbers because error messages about no input are less helpful then error messages about bad input (which includes the bad input)
|
|
run: |
|
|
echo "max_required_byond_client=$(grep -Ev '^[[:blank:]]{0,}#{1,}|^[[:blank:]]{0,}$' .github/max_required_byond_client.txt | tail -n1)" >> $GITHUB_OUTPUT
|
|
|
|
run_all_tests:
|
|
if: "!contains(github.event.head_commit.message, '[ci skip]')"
|
|
name: Integration Tests
|
|
needs: [collect_data]
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
map: ${{ fromJSON(needs.collect_data.outputs.maps).paths }}
|
|
concurrency:
|
|
group: run_all_tests-${{ github.head_ref || github.run_id }}-${{ matrix.map }}
|
|
cancel-in-progress: true
|
|
uses: ./.github/workflows/run_integration_tests.yml
|
|
with:
|
|
map: ${{ matrix.map }}
|
|
max_required_byond_client: ${{needs.collect_data.outputs.max_required_byond_client}}
|
|
|
|
run_alternate_tests:
|
|
if: "!contains(github.event.head_commit.message, '[ci skip]') && needs.find_all_maps.outputs.alternate_tests != '[]'"
|
|
name: Alternate Tests
|
|
needs: [collect_data]
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
setup: ${{ fromJSON(needs.collect_data.outputs.alternate_tests) }}
|
|
concurrency:
|
|
group: run_all_tests-${{ github.head_ref || github.run_id }}-${{ matrix.setup.major }}.${{ matrix.setup.minor }}-${{ matrix.setup.map }}
|
|
cancel-in-progress: true
|
|
uses: ./.github/workflows/run_integration_tests.yml
|
|
with:
|
|
map: ${{ matrix.setup.map }}
|
|
major: ${{ matrix.setup.major }}
|
|
minor: ${{ matrix.setup.minor }}
|
|
max_required_byond_client: ${{needs.collect_data.outputs.max_required_byond_client}}
|
|
|
|
check_alternate_tests:
|
|
if: "!contains(github.event.head_commit.message, '[ci skip]') && needs.find_all_maps.outputs.alternate_tests != '[]'"
|
|
name: Check Alternate Tests
|
|
needs: [run_alternate_tests]
|
|
runs-on: ubuntu-20.04
|
|
steps:
|
|
- run: echo Alternate tests passed.
|
|
|
|
compare_screenshots:
|
|
if: "!contains(github.event.head_commit.message, '[ci skip]') && (success() || failure())"
|
|
needs: [run_all_tests, run_alternate_tests]
|
|
name: Compare Screenshot Tests
|
|
runs-on: ubuntu-20.04
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
# If we ever add more artifacts, this is going to break, but it'll be obvious.
|
|
- name: Download screenshot tests
|
|
uses: actions/download-artifact@v3
|
|
with:
|
|
path: artifacts
|
|
- name: ls -R
|
|
run: ls -R artifacts
|
|
- name: Setup screenshot comparison
|
|
run: npm i
|
|
working-directory: tools/screenshot-test-comparison
|
|
- name: Run screenshot comparison
|
|
run: node tools/screenshot-test-comparison/index.js artifacts code/modules/unit_tests/screenshots artifacts/screenshot_comparisons
|
|
# workflow_run does not give you the PR it ran on,
|
|
# even through the thing literally named "matching pull requests".
|
|
# However, in GraphQL, you can check if the check suite was ran
|
|
# by a specific PR, so trusting the (user controlled) action here is okay,
|
|
# as long as we check it later in show_screenshot_test_results
|
|
- name: Save PR ID
|
|
if: failure() && github.event.pull_request
|
|
run: |
|
|
echo ${{ github.event.pull_request.number }} > artifacts/screenshot_comparisons/pull_request_number.txt
|
|
- name: Upload bad screenshots
|
|
if: failure()
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: bad-screenshots
|
|
path: artifacts/screenshot_comparisons
|
|
|
|
test_windows:
|
|
if: "!contains(github.event.head_commit.message, '[ci skip]')"
|
|
name: Windows Build
|
|
needs: [collect_data]
|
|
runs-on: windows-latest
|
|
concurrency:
|
|
group: test_windows-${{ github.head_ref || github.run_id }}
|
|
cancel-in-progress: true
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- name: Restore Yarn cache
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: tgui/.yarn/cache
|
|
key: ${{ runner.os }}-yarn-${{ hashFiles('tgui/yarn.lock') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-build-
|
|
${{ runner.os }}-
|
|
- name: Compile
|
|
run: pwsh tools/ci/build.ps1
|
|
env:
|
|
DM_EXE: "C:\\byond\\bin\\dm.exe"
|
|
- name: Check client Compatibility
|
|
uses: tgstation/byond-client-compatibility-check@v3
|
|
with:
|
|
dmb-location: tgstation.dmb
|
|
max-required-client-version: ${{needs.collect_data.outputs.max_required_byond_client}}
|