fake-bge-module Latest Build #9
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
--- | |
# yamllint disable rule:line-length | |
name: fake-bge-module Latest Build | |
on: # yamllint disable-line rule:truthy | |
workflow_dispatch: | |
schedule: | |
- cron: "0 6 * * *" | |
push: | |
branches: | |
- main | |
- 'perf/**' | |
- 'run-ci/**' | |
pull_request: | |
jobs: | |
set_versions: | |
name: Set build versions | |
runs-on: ubuntu-latest | |
if: | | |
github.repository == 'nutti/fake-bge-module' || | |
github.event_name != 'schedule' | |
outputs: | |
module_version: ${{ steps.set_module_version.outputs.module_version }} | |
file_version: ${{ steps.set_file_version.outputs.file_version }} | |
steps: | |
# Use ISO 8601 date (in UTC) + timestamp (in UTC) | |
- name: Create generic module version | |
run: echo "MODULE_VERSION=$(date -u +%Y%m%d).dev$(date -u +%H%M%S)" >> $GITHUB_ENV | |
# Use ISO 8601 date (in UTC) for a scheduled release | |
- name: Create generic module version | |
if: github.event_name == 'schedule' | |
run: echo "MODULE_VERSION=$(date -u +%Y%m%d)" >> $GITHUB_ENV | |
# Set module version output | |
- name: Set module version | |
id: set_module_version | |
run: echo ::set-output name=module_version::${MODULE_VERSION} | |
# Use ISO 8601 timestamps (in UTC) for output/file version | |
- name: Set file version | |
id: set_file_version | |
run: echo ::set-output name=file_version::$(date -u +%Y%m%dT%H%M%SZ) | |
build_modules: | |
name: Build modules | |
runs-on: ubuntu-22.04 | |
if: | | |
github.repository == 'nutti/fake-bge-module' || | |
github.event_name != 'schedule' | |
needs: [set_versions] | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.12" | |
cache: "pip" | |
cache-dependency-path: 'src/requirements.txt' | |
- name: Install python dependencies | |
run: | | |
pip install -r src/requirements.txt | |
- name: Test fake_bpy_module core module | |
run: bash tests/run_pre_tests.sh src | |
- name: Install UPBGE binary dependencies | |
run: | | |
sudo apt update | |
sudo apt install --no-install-recommends -y libglu1-mesa libegl1 libxxf86vm1 libxfixes3 libxi6 libxkbcommon0 libgl1 | |
- name: Install fake-bge-module tools | |
run: sudo apt install --no-install-recommends -y pandoc | |
- name: Get UPBGE artifact URL | |
id: get_upbge_artifact_url | |
run: echo ::set-output name=artifact_url::$(bash tools/utils/get_latest_artifacts_url.sh nutti upbge-daily-build "UPBGE daily build") | |
- name: Cache UPBGE binary | |
id: cache-upbge-bin | |
uses: actions/cache@v3 | |
with: | |
path: upbge-bin/upbge-latest-bin | |
key: ${{ runner.os }}-upbge-${{ steps.get_upbge_artifact_url.outputs.artifact_url }} | |
- name: Download latest UPBGE files from nutti/upbge-daily-build artifacts | |
if: steps.cache-upbge-bin.outputs.cache-hit != 'true' | |
run: bash tools/utils/download_latest_upbge.sh nutti upbge-daily-build "UPBGE daily build" ./upbge-bin ${{ secrets.TOKEN_FOR_ACTION_UPBGE_DAILY_BUILD }} | |
- name: Checkout UPBGE from Github | |
uses: actions/checkout@v4 | |
with: | |
repository: "upbge/upbge" | |
path: upbge | |
- name: Generate pip Packages | |
if: contains(github.ref, 'run-ci/') | |
env: | |
RELEASE_VERSION: ${{ needs.set_versions.outputs.module_version }} | |
GEN_MODULE_CODE_FORMAT: "ruff" | |
GEN_MODULE_OUTPUT_LOG_LEVEL: "debug" | |
ENABLE_PYTHON_PROFILER: false | |
run: bash tools/pip_package/build_pip_package.sh upbge latest ./upbge ./upbge-bin/upbge-latest-bin | |
- name: Generate pip Packages | |
if: contains(github.ref, 'perf/') | |
env: | |
RELEASE_VERSION: ${{ needs.set_versions.outputs.module_version }} | |
GEN_MODULE_CODE_FORMAT: "ruff" | |
GEN_MODULE_OUTPUT_LOG_LEVEL: "warn" | |
ENABLE_PYTHON_PROFILER: true | |
run: bash tools/pip_package/build_pip_package.sh upbge latest ./upbge ./upbge-bin/upbge-latest-bin | |
- name: Generate pip Packages | |
if: "!contains(github.ref, 'run-ci/') && !contains(github.ref, 'perf/')" | |
env: | |
RELEASE_VERSION: ${{ needs.set_versions.outputs.module_version }} | |
GEN_MODULE_CODE_FORMAT: "ruff" | |
GEN_MODULE_OUTPUT_LOG_LEVEL: "warn" | |
ENABLE_PYTHON_PROFILER: false | |
run: bash tools/pip_package/build_pip_package.sh upbge latest ./upbge ./upbge-bin/upbge-latest-bin | |
- name: Archive pip packages | |
uses: actions/upload-artifact@v3 | |
with: | |
name: fake_bge_modules_latest_pip_${{ needs.set_versions.outputs.file_version }} | |
path: release | |
- name: Archive raw modules | |
uses: actions/upload-artifact@v3 | |
with: | |
name: fake_bge_modules_latest_raw_${{ needs.set_versions.outputs.file_version }} | |
path: "raw_modules/fake_bge_module*" | |
- name: Run Ruff flake8-pyi checks | |
run: bash tools/pip_package/run_ruff_flake8_pyi.sh upbge latest | |
- name: Test Generated Modules | |
run: bash tests/run_tests.sh raw_modules | |
- name: Test generated pip module against Cycles addon | |
run: bash tests/pylint_cycles.sh upbge latest ./upbge/ ./release/latest/fake_bge_module_latest-*-py3-none-any.whl | |
- name: Collect profiler result | |
if: contains(github.ref, 'perf/') | |
run: cp profiler_result.prof /tmp/profiler_result.prof | |
- name: Store profiler result | |
if: contains(github.ref, 'perf/') | |
uses: actions/upload-artifact@v3 | |
with: | |
name: profiler_result | |
path: /tmp/profiler_result.prof | |
- name: Collect failure state | |
if: failure() | |
run: bash tools/collect_failure_state/collect_failure_state.sh /tmp/failure_state | |
- name: Store failure state | |
if: failure() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: failure_state | |
path: /tmp/failure_state | |
pypi_release_test: | |
name: PyPI Release test | |
needs: [build_modules] | |
if: | | |
github.repository == 'nutti/fake-bge-module' && | |
github.event_name != 'pull_request' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Fetch artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
path: dist | |
# Publish to TestPyPi on each merge to main | |
- name: Publish distribution 📦 to Test PyPI (Versioned Package) | |
uses: pypa/[email protected] | |
with: | |
password: ${{ secrets.test_pypi_token }} | |
repository_url: https://test.pypi.org/legacy/ | |
packages_dir: "dist/fake_bge_modules_latest_pip_*/latest/" | |
- name: Publish distribution 📦 to Test PyPI (Non-versioned Package) | |
uses: pypa/[email protected] | |
with: | |
password: ${{ secrets.test_pypi_token }} | |
repository_url: https://test.pypi.org/legacy/ | |
packages_dir: "dist/fake_bge_modules_latest_pip_*/non-version/" | |
pypi_release: | |
name: PyPI Release fake-bge-module | |
needs: [pypi_release_test] | |
if: | | |
github.repository == 'nutti/fake-bge-module' && | |
github.event_name == 'schedule' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Fetch Artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
path: dist | |
- name: Publish distribution 📦 to PyPI (Versioned Package) | |
uses: pypa/[email protected] | |
with: | |
password: ${{ secrets.pypi_token }} | |
packages_dir: "dist/fake_bge_modules_latest_pip_*/latest/" | |
- name: Publish distribution 📦 to PyPI (Non-versioned Package) | |
uses: pypa/[email protected] | |
with: | |
password: ${{ secrets.pypi_token }} | |
packages_dir: "dist/fake_bge_modules_latest_pip_*/non-version/" |