Move post-push.sh #19
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build | |
run-name: ${{ github.event.client_payload.commit_message }} | |
on: | |
repository_dispatch: | |
types: trigger_from_cli | |
jobs: | |
build: | |
strategy: | |
matrix: | |
include: | |
- os: windows-2022 | |
arch: x64 | |
gen_short_name: "vs17_2022" | |
gen_cmake_name: "Visual Studio 17 2022" | |
- os: windows-2022 | |
arch: Win32 | |
gen_short_name: "vs17_2022" | |
gen_cmake_name: "Visual Studio 17 2022" | |
- os: ubuntu-22.04 | |
arch: x64 | |
cc: gcc | |
cxx: g++ | |
pkgs: gcc xorg-dev | |
- os: ubuntu-22.04 | |
arch: x32 | |
cc: gcc | |
cxx: g++ | |
pkgs: gcc-multilib g++-multilib libx11-dev:i386 libxrandr-dev:i386 libxinerama-dev:i386 libxkbcommon-x11-dev:i386 libxkbfile-dev:i386 libxcursor-dev:i386 libxi-dev:i386 libgl-dev:i386 | |
flags: "-m32" | |
- os: macos-12 | |
arch: x86_64 | |
gen: Xcode | |
- os: macos-12 | |
arch: arm64 | |
gen: Xcode | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: actions/checkout@v4 | |
run: | | |
git clone https://codeberg.org/csprite/csprite | |
cd csprite/ | |
git checkout ${{ github.event.client_payload.commit_branch }} | |
git reset --hard ${{ github.event.client_payload.commit_hash }} | |
git submodule update --init | |
- name: Install Deps (Linux) | |
if: ${{ matrix.os == 'ubuntu-22.04' }} | |
run: | | |
sudo dpkg --add-architecture i386 | |
sudo apt-get update -y | |
sudo apt-get install ${{ matrix.pkgs }} ninja-build python3 python3-pip -y | |
sudo snap install cmake --classic | |
- name: Install Python Deps | |
run: | | |
python3 -m pip install --upgrade Pillow | |
python3 -m pip install --upgrade numpy | |
- name: Lint Info.plist & Generate .icns (MacOS) | |
if: ${{ matrix.os == 'macos-12' }} | |
run: | | |
cd csprite/ | |
plutil data/Info.plist | |
mkdir csprite.iconset | |
sips -z 16 16 data/icon-32x32.png --out csprite.iconset/icon_16x16.png | |
sips -z 32 32 data/icon-32x32.png --out csprite.iconset/[email protected] | |
sips -z 32 32 data/icon-32x32.png --out csprite.iconset/icon_32x32.png | |
sips -z 64 64 data/icon-32x32.png --out csprite.iconset/[email protected] | |
sips -z 128 128 data/icon-32x32.png --out csprite.iconset/icon_128x128.png | |
sips -z 256 256 data/icon-32x32.png --out csprite.iconset/[email protected] | |
sips -z 256 256 data/icon-32x32.png --out csprite.iconset/icon_256x256.png | |
sips -z 512 512 data/icon-32x32.png --out csprite.iconset/[email protected] | |
sips -z 512 512 data/icon-32x32.png --out csprite.iconset/icon_512x512.png | |
sips -z 1024 1024 data/icon-32x32.png --out csprite.iconset/[email protected] | |
iconutil -c icns -o csprite.icns csprite.iconset | |
rm -R csprite.iconset | |
- name: Generate Build Files & Build (Linux) | |
if: ${{ matrix.os == 'ubuntu-22.04' }} | |
run: | | |
cd csprite/ | |
export CC=${{ matrix.cc }} | |
export CXX=${{ matrix.cxx }} | |
export CXXFLAGS=${{ matrix.flags }} | |
export CFLAGS=${{ matrix.flags }} | |
export LDFLAGS=${{ matrix.flags }} | |
make gen-assets | |
make all GENERATOR=Ninja BUILD_TYPE=Release NUM_JOBS=4 | |
cp -r ./build/csprite ./csprite | |
- name: Generate Build Files & Build (Windows) | |
if: ${{ matrix.os == 'windows-2022' }} | |
run: | | |
cd csprite/ | |
make gen-assets CXX=clang++ | |
make all GENERATOR="${{ matrix.gen_cmake_name }}" BUILD_TYPE=Release NUM_JOBS=4 CMAKE_GEN_FLAGS='-A "${{ matrix.arch }}" -T "ClangCL"' | |
Copy-Item -Path ".\build\Release\csprite.exe" -Destination ".\csprite.exe" | |
- name: Generate Build Files, Build & Zip (MacOS) | |
if: ${{ matrix.os == 'macos-12' }} | |
run: | | |
cd csprite/ | |
make gen-assets | |
make all GENERATOR="${{ matrix.gen }}" BUILD_TYPE=Release NUM_JOBS=4 CMAKE_GEN_FLAGS='-DBUILD_APPLE_BUNDLE=ON -DCMAKE_OSX_ARCHITECTURES=${{ matrix.arch }}' | |
mv ./build/Release/csprite.app ./csprite.app | |
zip -r ./csprite.zip ./csprite.app | |
- name: Upload Artifacts (Linux) | |
if: ${{ matrix.os == 'ubuntu-22.04' }} | |
uses: actions/upload-artifact@v3 | |
with: | |
name: linux-${{ matrix.arch }} | |
if-no-files-found: error | |
path: ./csprite/csprite | |
- name: Upload artifacts (Windows) | |
uses: actions/upload-artifact@v3 | |
if: ${{ matrix.os == 'windows-2022' }} | |
with: | |
name: win-${{ matrix.arch }} | |
if-no-files-found: error | |
path: ./csprite/csprite.exe | |
- name: Upload Artifacts (MacOS) | |
uses: actions/upload-artifact@v3 | |
if: ${{ matrix.os == 'macos-12' }} | |
with: | |
name: osx-${{ matrix.arch }} | |
if-no-files-found: error | |
path: ./csprite/csprite.zip | |
update-ci-release: | |
needs: [build] | |
permissions: | |
contents: write | |
runs-on: ubuntu-latest | |
steps: | |
- uses: dev-drprasad/[email protected] | |
with: | |
tag_name: latest-git | |
delete_release: true | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- uses: actions/download-artifact@v3 | |
with: | |
name: win-x64 | |
path: ./win-x64/ | |
- uses: actions/download-artifact@v3 | |
with: | |
name: win-Win32 | |
path: ./win-Win32/ | |
- uses: actions/download-artifact@v3 | |
with: | |
name: linux-x64 | |
path: ./linux-x64/ | |
- uses: actions/download-artifact@v3 | |
with: | |
name: linux-x32 | |
path: ./linux-x32/ | |
- uses: actions/download-artifact@v3 | |
with: | |
name: osx-arm64 | |
path: ./osx-arm64/ | |
- uses: actions/download-artifact@v3 | |
with: | |
name: osx-x86_64 | |
path: ./osx-x86_64/ | |
- name: Rename | |
run: | | |
mv ./win-x64/csprite.exe ./csprite-win-x64.exe | |
mv ./win-Win32/csprite.exe ./csprite-win-x86.exe | |
mv ./linux-x64/csprite ./csprite-linux-x64 | |
mv ./linux-x32/csprite ./csprite-linux-x32 | |
mv ./osx-arm64/csprite.zip ./csprite-osx-arm64.zip | |
mv ./osx-x86_64/csprite.zip ./csprite-osx-x64.zip | |
- uses: dev-drprasad/[email protected] | |
with: | |
keep_latest: 10 | |
delete_tags: true | |
delete_prerelease_only: true | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- uses: ncipollo/release-action@v1 | |
with: | |
name: "Build ${{ github.event.client_payload.commit_hash_short }}" | |
body: "This is the build of commit [${{ github.event.client_payload.commit_hash_short }}](https://codeberg.org/csprite/csprite/commit/${{ github.event.client_payload.commit_hash }})." | |
tag: "${{ github.event.client_payload.commit_hash_short }}" | |
commit: "master" | |
prerelease: true | |
allowUpdates: true | |
generateReleaseNotes: false | |
artifactErrorsFailBuild: true | |
artifacts: | | |
./csprite-win-x64.exe | |
./csprite-win-x86.exe | |
./csprite-linux-x64 | |
./csprite-linux-x32 | |
./csprite-osx-arm64.zip | |
./csprite-osx-x64.zip |