Skip to content

process_unit_aux

process_unit_aux #299

name: Check type sizes
on:
pull_request:
branches:
- master
jobs:
run:
name: ${{ matrix.os }} (${{ matrix.arch }}-bit)
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-22.04
arch:
- 64
- 32
steps:
- name: Set up environment
run: |
echo "GHA_OS_TAG=$(echo '${{ runner.os }}' | tr '[[:upper:]]' '[[:lower:]]')${{ matrix.arch }}" >> $GITHUB_ENV
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install \
libxml-libxml-perl \
libxml-libxslt-perl \
ninja-build \
python3-jinja2
if [[ ${{ matrix.arch}} = 32 ]]; then
sudo apt-get install gcc-multilib g++-multilib
fi
- name: Clone DFHack
uses: actions/checkout@v3
with:
repository: dfhack/dfhack
submodules: true
- name: Clone df-structures (old)
uses: actions/checkout@v3
with:
path: xml-old
ref: master
- name: Clone df-structures (new)
uses: actions/checkout@v3
with:
path: xml-new
# ensure that DFHack configures properly on the new branch:
- name: Install new structures
run: rsync -av xml-new/ library/xml/ --exclude .git
- name: Configure DFHack
run: |
cmake \
-S . \
-B build-ci \
-G Ninja \
-D DFHACK_BUILD_ARCH=${{ matrix.arch }} \
-D BUILD_PLUGINS:BOOL=OFF \
-D BUILD_XMLDUMP:BOOL=ON \
-D CMAKE_INSTALL_PREFIX="$PWD/install-ci"
- name: Dump type sizes (old)
run: |
rsync -av xml-old/ library/xml/ --exclude .git
ninja -C build-ci clean
ninja -C build-ci xml-dump-type-sizes
./build-ci/library/xml/tools/xml-dump-type-sizes > sizes-old.txt
- name: Dump type sizes (new)
run: |
rsync -av xml-new/ library/xml/ --exclude .git
ninja -C build-ci clean
ninja -C build-ci xml-dump-type-sizes
./build-ci/library/xml/tools/xml-dump-type-sizes > sizes-new.txt
- name: Generate report
run: |
python3 library/xml/tools/compare-sizes.py --old sizes-old.txt --new sizes-new.txt --platform ${{ env.GHA_OS_TAG }} --output sizes-${{ env.GHA_OS_TAG }}.json
- name: Upload report
uses: actions/upload-artifact@v2
with:
name: sizes-${{ env.GHA_OS_TAG }}
path: sizes-${{ env.GHA_OS_TAG }}.json
report:
needs: [run]
runs-on: ubuntu-22.04
steps:
- name: Clone df-structures
uses: actions/checkout@v3
- name: Download reports
uses: actions/download-artifact@v2
with:
path: reports
- name: Generate comment
id: generate_comment
run: |
python tools/generate-type-size-comment.py \
--reports $(find reports -name '*.json') \
--template tools/type-size-comment.md.in \
--output tools/type-size-comment.md \
--github-actions
- name: Generate artifact
run: |
jq --null-input \
--rawfile comment tools/type-size-comment.md \
--arg comment_search "<!--type-size-comment-->" \
--arg pr_number "${{ github.event.pull_request.number }}" \
--arg rows "${{ steps.generate_comment.outputs.rows }}" \
'{$comment, $comment_search, $pr_number, update_only:($rows|tonumber <= 0)}' > comment-info.json
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: comment-info.json
path: comment-info.json