Skip to content

perf(skymp5-server): avoid copying in DynamicFields.set (mp.set) #5875

perf(skymp5-server): avoid copying in DynamicFields.set (mp.set)

perf(skymp5-server): avoid copying in DynamicFields.set (mp.set) #5875

name: PR Ubuntu Docker
on:
pull_request:
# any
push:
branches:
- main
env:
BUILD_TYPE: RelWithDebInfo
jobs:
pr-ubuntu-docker:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Get image to build upon
run: |
cat ${{github.workspace}}/misc/github_env_linux >> "$GITHUB_ENV"
- name: Store SP types from commit
run: |
commit=$(< ${{github.workspace}}/skyrim-platform/src/platform_se/codegen/convert-files/skyrimPlatform.ts)
chmod 777 ${{github.workspace}}/skyrim-platform/src/platform_se/codegen/convert-files
echo "$commit" > ${{github.workspace}}/skyrim-platform/src/platform_se/codegen/convert-files/temp.txt
# Download Skyrim SE data files
- uses: suisei-cn/actions-download-file@v1
name: Download Skyrim.esm
with:
url: "https://gitlab.com/pospelov/se-data/-/raw/main/Skyrim.esm"
target: ${{github.workspace}}/skyrim_data_files/
- uses: suisei-cn/actions-download-file@v1
name: Download Update.esm
with:
url: "https://gitlab.com/pospelov/se-data/-/raw/main/Update.esm"
target: ${{github.workspace}}/skyrim_data_files/
- uses: suisei-cn/actions-download-file@v1
name: Download Dawnguard.esm
with:
url: "https://gitlab.com/pospelov/se-data/-/raw/main/Dawnguard.esm"
target: ${{github.workspace}}/skyrim_data_files/
- uses: suisei-cn/actions-download-file@v1
name: Download HearthFires.esm
with:
url: "https://gitlab.com/pospelov/se-data/-/raw/main/HearthFires.esm"
target: ${{github.workspace}}/skyrim_data_files/
- uses: suisei-cn/actions-download-file@v1
name: Download Dragonborn.esm
with:
url: "https://gitlab.com/pospelov/se-data/-/raw/main/Dragonborn.esm"
target: ${{github.workspace}}/skyrim_data_files/
- name: Prepare
uses: addnab/docker-run-action@v3
with:
image: ${{ env.SKYMP_VCPKG_DEPS_IMAGE }}
options: |
-v ${{github.workspace}}:/src
run: |
chown -R skymp:skymp /src
- name: CMake Configure
id: cmake_configure
uses: addnab/docker-run-action@v3
with:
image: ${{ env.SKYMP_VCPKG_DEPS_IMAGE }}
options: |
-v ${{github.workspace}}:/src
-u skymp
--name configure_container
run: |
cd /src \
&& ./build.sh --configure \
-DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} \
-DUNIT_DATA_DIR="/src/skyrim_data_files"
- name: Copy log file from container to workspace
if: failure()
run: |
sudo docker cp configure_container:/src/vcpkg/buildtrees/rsm-bsa/install-x64-linux-dbg-out.log ${{github.workspace}}/install-x64-linux-dbg-out.log
- name: Upload vcpkg failure logs
if: failure()
uses: actions/upload-artifact@v4
with:
name: install-x64-linux-dbg-out.log
path: ${{github.workspace}}/install-x64-linux-dbg-out.log
- name: Upload compile_commands.json
uses: actions/upload-artifact@v4
with:
name: compile_commands.json
path: ${{github.workspace}}/build/compile_commands.json
- name: Build
uses: addnab/docker-run-action@v3
with:
image: ${{ env.SKYMP_VCPKG_DEPS_IMAGE }}
options: |
-v ${{github.workspace}}:/src
-u skymp
run: |
cd /src \
&& ./build.sh --build
- name: Prepare dist.tar.gz
uses: addnab/docker-run-action@v3
with:
image: ${{ env.SKYMP_VCPKG_DEPS_IMAGE }}
options: |
-v ${{github.workspace}}:/src
-u skymp
run: |
cd /src/build \
&& tar czf dist.tar.gz dist
- name: Upload dist.tar.gz
uses: actions/upload-artifact@v4
with:
name: dist.tar.gz
path: ${{github.workspace}}/build/dist.tar.gz
- name: SP Types Check
id: sp_types_check
run: |
commit=$(< ${{github.workspace}}/skyrim-platform/src/platform_se/codegen/convert-files/temp.txt)
build=$(< ${{github.workspace}}/build/dist/client/Data/Platform/Modules/skyrimPlatform.ts)
difference=$(diff -u <(echo "$commit") <(echo "$build"))
size=$(echo -n $difference | wc -m)
echo "Size $size"
if [ $size != 0 ] ; then
echo "SP Types in codegen and build dist not equal"
echo "Difference:"
echo $difference
exit 1
fi
echo "SP Types in codegen and build dist equal"
- name: SP Const Enums Check
id: sp_const_enums_check
run: |
cd skyrim-platform/tools/const_enum_extractor
sudo yarn install
sudo node ./index.js
# Checking if ConstEnumApi.cpp has changed
cd ../../../
git diff --exit-code skyrim-platform/src/platform_se/skyrim_platform/ConstEnumApi.cpp
if [ $? -ne 0 ]; then
echo "ConstEnumApi.cpp has changed after running const_enum_extractor. Please re-run it locally and commit changes"
exit 1
fi
- name: SP Types Check failed - Here is what you can do
if: ${{ failure() && steps.sp_types_check.outcome == 'failure' }}
run: |
echo "skyrimPlatform.ts and Definitions.txt do not match."
echo "You can fix this manually or simply build the project locally and commit the changes."
- name: SP Const Enums Check failed - Here is what you can do
if: ${{ failure() && steps.sp_const_enums_check.outcome == 'failure' }}
run: |
echo "ConstEnumApi.cpp has changed after running const_enum_extractor. Please re-run it locally and commit changes."
echo "In folder skyrim-platform/tools/const_enum_extractor run 'yarn install' and then 'node ./index.js'"
- name: Test
uses: addnab/docker-run-action@v3
with:
image: ${{ env.SKYMP_VCPKG_DEPS_IMAGE }}
options: |
-v ${{github.workspace}}:/src
-u skymp
run: |
cd /src/build \
&& ctest -C ${{env.BUILD_TYPE}} --verbose --output-on-failure