Skip to content

Improvements to testing tooling #25

Improvements to testing tooling

Improvements to testing tooling #25

Workflow file for this run

---
name: Run Tests
on:
pull_request:
branches:
- dev
workflow_dispatch: null
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
run_build_diff:
runs-on: ubuntu-latest
steps:
- name: Checkout HEAD
uses: actions/checkout@v4
- name: Fetch Dev branch
run: git fetch --depth=1
- name: Get Dev branch HEAD hash
id: get-dev-ref
run: echo "devref=$(git rev-parse origin/dev)" >> $GITHUB_OUTPUT
- name: Create cache folder
run: mkdir /tmp/cache/
- name: Check if build cache exists
uses: actions/cache@v4
with:
path: /tmp/cache/
key: ${{ steps.get-dev-ref.outputs.devref }}
- name: Download latest build list
id: download-build-list
uses: dawidd6/action-download-artifact@3ecf4024886f219d9290351234889bfb45d1b9da
with:
name: builds.txt
if_no_artifact_found: warn
workflow: updatebuildlist.yml
- name: Update static builds list
run: echo ${{join(steps.download-build-list.outputs.*, '\n')}}; cat builds.txt > spec/builds.txt
- name: Download latest build xmls
uses: dawidd6/action-download-artifact@3ecf4024886f219d9290351234889bfb45d1b9da
with:
name: build-xmls
if_no_artifact_found: warn
path: /tmp/cache/
- name: Make sure cache is readable by docker
run: chmod -R 777 /tmp/cache
- name: Run build diff
run: docker compose run -v '/tmp/cache/:/cache' -e 'CACHEDIR=/cache' busted-diff
| tee /tmp/dockerlog
- name: Generate artefact
run: |
sed -n '/Savefile Diff for/, $p' /tmp/dockerlog | tee /tmp/artefact
[ -s /tmp/artefact ] || rm /tmp/artefact
- name: Upload artefact
uses: actions/upload-artifact@v4
with:
name: build-diff-output
path: /tmp/artefact
- name: move xmls found in builds.txt to a new directory
run: |
mkdir new-build-xmls
while IFS= read -r line; do
FILENAME="/tmp/cache/$( echo $line | tr -cd '[[:alnum:]]').xml"
if [ -f "$FILENAME" ]; then
mv "$FILENAME" "./new-build-xmls/"
fi
done < "./spec/builds.txt"
- name: Upload new build xmls
uses: actions/upload-artifact@v4
with:
name: build-xmls
path: './new-build-xmls/*'
overwrite: true
retention-days: 3
- name: Upload cache
uses: actions/upload-artifact@v4
with:
name: build-cache
path: './tmp/cache/*'
overwrite: true
retention-days: 3