Skip to content

Commit

Permalink
Add nightly building to unittests.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
GsLogiMaker committed Sep 26, 2024
1 parent 65323fb commit 4f0a56f
Show file tree
Hide file tree
Showing 3 changed files with 89 additions and 127 deletions.
188 changes: 84 additions & 104 deletions .github/workflows/unittests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -231,107 +231,87 @@ jobs:
echo "***"
ls addons/glecs/bin
# update_nightly:
# if: ${{ github.event_name == 'push' || github.event_name == 'closed' }}
# needs: ["compile_glecs", "run_test_suite"]
# runs-on: windows-latest
# steps:
# - name: 🐙 Setup git environment
# uses: actions/checkout@v4
# with:
# token: ${{ secrets.GITHUB_TOKEN }}
# persist-credentials: false

# - name: 🐧 Load compiled library, Linux x86_64
# uses: actions/cache/[email protected]
# with:
# # A list of files, directories, and wildcard patterns to cache and restore
# path: ./addons/glecs/bin/x86_64-unknown-linux-gnu/release/libglecs.so
# # An explicit key for restoring and saving the cache
# key: ${{ needs.compile_glecs.outputs.x86_64_linux_bin_key }}
# # An optional boolean when enabled, allows windows runners to save or restore caches that can be restored or saved respectively on other platforms
# enableCrossOsArchive: true

# - name: 🐧 Load compiled library, Linux i686
# uses: actions/cache/[email protected]
# with:
# # A list of files, directories, and wildcard patterns to cache and restore
# path: ./addons/glecs/bin/i686-unknown-linux-gnu/release/libglecs.so
# # An explicit key for restoring and saving the cache
# key: ${{ needs.compile_glecs.outputs.i686-linux_bin_key }}
# # An optional boolean when enabled, allows windows runners to save or restore caches that can be restored or saved respectively on other platforms
# enableCrossOsArchive: true

# - name: 🍎 Load compiled library, Mac aarch64
# uses: actions/cache/[email protected]
# with:
# # A list of files, directories, and wildcard patterns to cache and restore
# path: ./addons/glecs/bin/aarch64-apple-darwin/release/libglecs.dylib
# # An explicit key for restoring and saving the cache
# key: ${{ needs.compile_glecs.outputs.aarch64-mac_bin_key }}
# # An optional boolean when enabled, allows windows runners to save or restore caches that can be restored or saved respectively on other platforms
# enableCrossOsArchive: true

# - name: 🍎 Load compiled library, Mac x86_64
# uses: actions/cache/[email protected]
# with:
# # A list of files, directories, and wildcard patterns to cache and restore
# path: ./addons/glecs/bin/x86_64-apple-darwin/release/libglecs.dylib
# # An explicit key for restoring and saving the cache
# key: ${{ needs.compile_glecs.outputs.x86_64-mac_bin_key }}
# # An optional boolean when enabled, allows windows runners to save or restore caches that can be restored or saved respectively on other platforms
# enableCrossOsArchive: true

# - name: 🪟 Load compiled library, Windows x86_64
# uses: actions/cache/[email protected]
# with:
# # A list of files, directories, and wildcard patterns to cache and restore
# path: ./addons/glecs/bin/x86_64-pc-windows-gnu/release/glecs.dll
# # An explicit key for restoring and saving the cache
# key: ${{ needs.compile_glecs.outputs.x86_64-windows_bin_key }}
# # An optional boolean when enabled, allows windows runners to save or restore caches that can be restored or saved respectively on other platforms
# enableCrossOsArchive: true

# - name: 🐍 Setup Python
# uses: actions/[email protected]
# with:
# python-version: 3.11.2
# cache: pip

# - name: 🚣‍♂️ Convert dev plugin to nightly format
# run: |
# cd addons/glecs
# pip install regex
# python _build_for_nightly.py

# - name: 🌙 Clone nightly branch
# run: |
# git clone https://github.com/${{ github.repository }} ../nightly_tmp -b nightly
# mkdir ../nightly
# mkdir ../nightly/.git
# cp -r ../nightly_tmp/.git/* ../nightly/.git/

# - name: 🖨️ Copy dev branch plugin to nightly
# run: |
# cp -r -force ./addons/glecs/* ../nightly/

# - name: ➕ Add and commit to nightly
# id: add-and-commit
# continue-on-error: true
# run: |
# cd ../nightly
# git config --global user.name github-actions[bot]
# git config --global user.email [email protected]
# git add .
# git commit --all -m "(AUTO) ${{ github.event.head_commit.message }}"

# - name: 📤 Push to nightly
# uses: ad-m/github-push-action@master
# with:
# github_token: ${{ secrets.GITHUB_TOKEN }}
# repository: ${{ github.repository }}
# branch: nightly
# directory: ../nightly

# - name: 🏁 Finish
# run: exit 0
update_nightly:
if: ${{ github.event_name == 'push' || github.event_name == 'closed' }}
needs: ["compile_glecs", "run_test_suite"]
runs-on: windows-latest
steps:
- name: 🐙 Setup git environment
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
persist-credentials: false

- name: 🐧 Load compiled library, Linux x86_64
uses: actions/cache/[email protected]
with:
# A list of files, directories, and wildcard patterns to cache and restore
path: ./addons/glecs/bin/x86_64-unknown-linux-gnu/release/libglecs.so
# An explicit key for restoring and saving the cache
key: ${{ needs.compile_glecs.outputs.bin_key_linux_x86_64 }}
# An optional boolean when enabled, allows windows runners to save or restore caches that can be restored or saved respectively on other platforms
enableCrossOsArchive: true

- name: 🍎 Load compiled library, Mac x86_64
uses: actions/cache/[email protected]
with:
# A list of files, directories, and wildcard patterns to cache and restore
path: ./addons/glecs/bin/x86_64-apple-darwin/release/libglecs.dylib
# An explicit key for restoring and saving the cache
key: ${{ needs.compile_glecs.outputs.bin_key_macos_x86_64 }}
# An optional boolean when enabled, allows windows runners to save or restore caches that can be restored or saved respectively on other platforms
enableCrossOsArchive: true

- name: 🪟 Load compiled library, Windows x86_64
uses: actions/cache/[email protected]
with:
# A list of files, directories, and wildcard patterns to cache and restore
path: ./addons/glecs/bin/x86_64-pc-windows-gnu/release/glecs.dll
# An explicit key for restoring and saving the cache
key: ${{ needs.compile_glecs.outputs.bin_key_windows_x86_64 }}
# An optional boolean when enabled, allows windows runners to save or restore caches that can be restored or saved respectively on other platforms
enableCrossOsArchive: true

- name: 🐍 Setup Python
uses: actions/[email protected]
with:
python-version: 3.11.2
cache: pip

# - name: 🚣‍♂️ Convert dev plugin to nightly format
# run: |
# cd addons/glecs
# pip install regex
# python _build_for_nightly.py

- name: 🌙 Clone nightly branch
run: |
git clone https://github.com/${{ github.repository }} ../nightly_tmp -b nightly
mkdir ../nightly
mkdir ../nightly/.git
cp -r ../nightly_tmp/.git/* ../nightly/.git/
- name: 🖨️ Copy dev branch plugin to nightly
run: |
cp -r -force ./addons/glecs/* ../nightly/
- name: ➕ Add and commit to nightly
id: add-and-commit
continue-on-error: true
run: |
cd ../nightly
git config --global user.name github-actions[bot]
git config --global user.email [email protected]
git add .
git commit --all -m "(AUTO) ${{ github.event.head_commit.message }}"
- name: 📤 Push to nightly
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
repository: ${{ github.repository }}
branch: nightly
directory: ../nightly

- name: 🏁 Finish
run: exit 0
11 changes: 5 additions & 6 deletions addons/glecs/_build_for_nightly.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,22 @@
import os
import regex

os.remove("glecs.gdextension")
os.rename("glecs.gdextension.release", "glecs.gdextension")

# Regex patterns
name_ptrn = regex.compile(r"""name\s*=\s*\"(.*)\"""")
version_ptrn = regex.compile(r"""version\s*=\s*\"(.*)\"""")

# Edit plugin config
with open("plugin.cfg", "r+") as f:
txt = f.read()

start, end = name_ptrn.search(txt).span(1)
txt = txt[:start] + "GlecsNightly" + txt[end:]

start, end = version_ptrn.search(txt).span(1)
txt = txt[:end] + "-nightly" + txt[end:]

f.seek(0)
f.write(txt)
f.truncate()

exit(0)
exit(0)
17 changes: 0 additions & 17 deletions addons/glecs/glecs.gdextension.release

This file was deleted.

0 comments on commit 4f0a56f

Please sign in to comment.