[Build] Update artifacts only when needed (#150)

This commit is contained in:
SpaiR authored and GitHub committed 2022-12-15 12:36:35 +02:00
1 parent 8356d76a62
commit a2bacb292e
2 files changed
+29 -8

No files matched your search

+21 -8
View File
@@ -69,16 +69,16 @@ jobs:
- name: Ant Version
run: ant -version
- if: matrix.os == 'ubuntu-latest'
name: Install MinGW-w64/GCC/G++ (Linux & Windows)
- name: Install MinGW-w64/GCC/G++ (Linux & Windows)
if: matrix.os == 'ubuntu-latest'
run: sudo apt install mingw-w64
- if: matrix.os == 'ubuntu-latest' && matrix.type == 'linux' && matrix.freetype == true
name: FreeType - Install (Linux)
- name: FreeType - Install (Linux)
if: matrix.os == 'ubuntu-latest' && matrix.type == 'linux' && matrix.freetype == true
run: sudo apt install libfreetype6-dev
- if: matrix.os == 'ubuntu-latest' && matrix.type == 'windows' && matrix.freetype == true
name: FreeType - Install (Windows)
- name: FreeType - Install (Windows)
if: matrix.os == 'ubuntu-latest' && matrix.type == 'windows' && matrix.freetype == true
run: |
sudo mkdir /freetype
sudo tar -xzf ./vendor/freetype-2.12.1.tar.gz -C /freetype --strip-components=1
@@ -98,8 +98,8 @@ jobs:
path: ${{ matrix.expected }}
update-bin:
if: github.ref == 'refs/heads/main' # runs only on the main branch
name: Update Binaries
if: github.ref == 'refs/heads/main' # runs only on the main branch
runs-on: ubuntu-latest
needs: build-natives
steps:
@@ -111,20 +111,33 @@ jobs:
with:
path: /tmp/artifacts
- name: Equal Artifacts
id: equal-artifacts
continue-on-error: true
run: |
python3 buildSrc/scripts/equal_file_size.py /tmp/artifacts/native-libraries/imgui-java64.dll bin/imgui-java64.dll
python3 buildSrc/scripts/equal_file_size.py /tmp/artifacts/native-libraries/libimgui-java64.dylib bin/libimgui-java64.dylib
python3 buildSrc/scripts/equal_file_size.py /tmp/artifacts/native-libraries/libimgui-java64.so bin/libimgui-java64.so
python3 buildSrc/scripts/equal_file_size.py /tmp/artifacts/native-libraries-with-freetype/imgui-java64.dll bin/freetype/imgui-java64.dll
python3 buildSrc/scripts/equal_file_size.py /tmp/artifacts/native-libraries-with-freetype/libimgui-java64.dylib bin/freetype/libimgui-java64.dylib
python3 buildSrc/scripts/equal_file_size.py /tmp/artifacts/native-libraries-with-freetype/libimgui-java64.so bin/freetype/libimgui-java64.so
- name: Update
if: steps.equal-artifacts.outcome != 'success'
run: |
mv /tmp/artifacts/native-libraries/* bin/
mv /tmp/artifacts/native-libraries-with-freetype/* bin/freetype/
- name: Commit
if: steps.equal-artifacts.outcome != 'success'
uses: EndBug/add-and-commit@v9
with:
default_author: github_actions
message: '[ci skip] update native binaries'
release:
if: startsWith(github.ref, 'refs/tags/v') # if tag starts with "v"
name: Release
if: startsWith(github.ref, 'refs/tags/v') # if tag starts with "v"
runs-on: ubuntu-latest
needs: [ build-java, build-natives ]
steps:
+8
View File
@@ -0,0 +1,8 @@
import sys
import os
# A python script to compare file size of two files.
# Used to compare sizes of binaries to see, if there is a difference between them.
# Shell scripts are not used, since Python is a more portable solution.
os.path.getsize(sys.argv[1]) == os.path.getsize(sys.argv[2]) if sys.exit(0) else sys.exit(1)