From bdb158ff2707beda8bdb57766a773e4ba974c5fe Mon Sep 17 00:00:00 2001 From: Serhii Snitsaruk Date: Tue, 12 Sep 2023 10:15:59 +0200 Subject: [PATCH 1/5] GH: Perform unit tests in the test build --- .github/workflows/test.yml | 32 +++++++++++++++++++++++++------- 1 file changed, 25 insertions(+), 7 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 4908d6a..d36b5b4 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -26,32 +26,41 @@ on: env: SCONS_CACHE_MSVC_CONFIG: true SCONS_CACHE_LIMIT: 4096 - SCONSFLAGS: production=yes tests=no verbose=yes warnings=extra werror=yes + SCONSFLAGS: verbose=yes warnings=extra werror=yes DOTNET_NOLOGO: true DOTNET_CLI_TELEMETRY_OPTOUT: true jobs: - linux-test-build: + linux-test-builds: runs-on: "ubuntu-20.04" name: ${{ matrix.name }} strategy: fail-fast: false matrix: include: + - name: 🐧 Editor (x86_64, debug) + Tests + target: editor + arch: x86_64 + tests: true + sconsflags: devbuild=yes debug_symbols=yes + - name: 🐧 Editor (x86_64, release) target: editor arch: x86_64 - build-mono: false + tests: false + sconsflags: production=yes - name: 🐧 Template (x86_64, release) target: template_release arch: x86_64 - build-mono: false + tests: false + sconsflags: production=yes - name: 🐧 Template (x86_64, debug) target: template_debug arch: x86_64 - build-mono: false + tests: false + sconsflags: production=yes env: BIN: godot.linuxbsd.${{matrix.target}}.${{matrix.arch}}${{ matrix.build-mono == true && '.mono' || '' }} @@ -109,7 +118,7 @@ jobs: SCONS_CACHE: ${{github.workspace}}/.scons_cache/ run: | PATH=${GITHUB_WORKSPACE}/buildroot/bin:$PATH - scons platform=linuxbsd target=${{matrix.target}} arch=${{matrix.arch}} module_mono_enabled=${{matrix.build-mono}} ${{env.SCONSFLAGS}} + scons platform=linuxbsd target=${{matrix.target}} arch=${{matrix.arch}} tests=${{matrix.tests}} ${{matrix.sconsflags}} ${{env.SCONSFLAGS}} - name: Prepare artifact env: @@ -129,6 +138,13 @@ jobs: name: ${{ startsWith(matrix.target, 'template') && env.NAME_TEMPLATES || env.NAME_EDITOR }} path: out/* + - name: Unit Tests + if: ${{ matrix.tests }} + run: | + ./out/${{ env.BIN }} --version + ./out/${{ env.BIN }} --help + ./out/${{ env.BIN }} --headless --test --test-case="*[LimboAI]*" + windows-dot-net: runs-on: "windows-latest" name: ${{ matrix.name }} @@ -140,11 +156,13 @@ jobs: target: editor arch: x86_64 build-mono: true + sconsflags: production=yes - name: 🪟 Template .NET (x86_64, release) target: template_release arch: x86_64 build-mono: true + sconsflags: production=yes env: BIN: godot.windows.${{matrix.target}}.${{matrix.arch}}${{ matrix.build-mono == true && '.mono' || '' }} @@ -195,7 +213,7 @@ jobs: env: SCONS_CACHE: ${{github.workspace}}/.scons_cache/ run: | - scons -j2 platform=windows target=${{matrix.target}} arch=${{matrix.arch}} module_mono_enabled=${{matrix.build-mono}} ${{env.SCONSFLAGS}} + scons -j2 platform=windows target=${{matrix.target}} arch=${{matrix.arch}} module_mono_enabled=${{matrix.build-mono}} ${{matrix.sconsflags}} ${{env.SCONSFLAGS}} - name: Generate C# glue if: matrix.build-mono && matrix.target == 'editor' From 14128948eefcdf992919502888ec889c953c6599 Mon Sep 17 00:00:00 2001 From: Serhii Snitsaruk Date: Wed, 13 Sep 2023 10:25:18 +0200 Subject: [PATCH 2/5] GH: Fix test workflow errors and enable CI --- .github/workflows/test.yml | 63 ++++++++++++++++++-------------------- 1 file changed, 29 insertions(+), 34 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d36b5b4..0f8b634 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,29 +1,26 @@ name: 🔧 Test builds on: - workflow_call: - inputs: - godot-treeish: - description: A tag, branch or commit hash in the Godot repository. - type: string - default: master - limboai-treeish: - description: A tag, branch or commit hash in the LimboAI repository. - type: string - default: master - workflow_dispatch: - inputs: - godot-treeish: - description: A tag, branch or commit hash in the Godot repository. - type: string - default: master - limboai-treeish: - description: A tag, branch or commit hash in the LimboAI repository. - type: string - default: master + + push: + branches: [ master, github-workflows ] + paths-ignore: + - "README.md" + - "LICENSE" + - "**/*.png" + - "demo/*" + + pull_request: + branches: [ master ] + paths-ignore: + - "README.md" + - "LICENSE" + - "**/*.png" + - "demo/*" # Global Settings env: + GODOT_TREEISH: 4.1.1-stable SCONS_CACHE_MSVC_CONFIG: true SCONS_CACHE_LIMIT: 4096 SCONSFLAGS: verbose=yes warnings=extra werror=yes @@ -63,20 +60,19 @@ jobs: sconsflags: production=yes env: - BIN: godot.linuxbsd.${{matrix.target}}.${{matrix.arch}}${{ matrix.build-mono == true && '.mono' || '' }} + BIN: godot.linuxbsd.${{matrix.target}}.${{matrix.arch}} steps: - name: Clone Godot uses: actions/checkout@v3 with: repository: godotengine/godot - ref: ${{ inputs.godot-treeish }} + ref: ${{ env.GODOT_TREEISH }} - name: Clone LimboAI module uses: actions/checkout@v3 with: path: modules/limboai - ref: ${{ inputs.limboai-treeish }} # Inits GODOT_VERSION, LIMBOAI_VERSION and NAME_PREFIX environment variables. - uses: ./modules/limboai/.github/actions/init-version @@ -107,11 +103,11 @@ jobs: uses: actions/cache@v3 with: path: ${{github.workspace}}/.scons_cache/ - key: ${{matrix.cache-name}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}} + key: ${{env.BIN}}-${{env.GODOT_TREEISH}}-${{github.ref}}-${{github.sha}} restore-keys: | - ${{env.BIN}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}} - ${{env.BIN}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}} - ${{env.BIN}}-${{env.GODOT_BASE_BRANCH}} + ${{env.BIN}}-${{env.GODOT_TREEISH}}-${{github.ref}}-${{github.sha}} + ${{env.BIN}}-${{env.GODOT_TREEISH}}-${{github.ref}} + ${{env.BIN}}-${{env.GODOT_TREEISH}} - name: Compilation env: @@ -143,7 +139,7 @@ jobs: run: | ./out/${{ env.BIN }} --version ./out/${{ env.BIN }} --help - ./out/${{ env.BIN }} --headless --test --test-case="*[LimboAI]*" + ./out/${{ env.BIN }} --headless --test windows-dot-net: runs-on: "windows-latest" @@ -172,13 +168,12 @@ jobs: uses: actions/checkout@v3 with: repository: godotengine/godot - ref: ${{ inputs.godot-treeish }} + ref: ${{ env.GODOT_TREEISH }} - name: Clone LimboAI module uses: actions/checkout@v3 with: path: modules/limboai - ref: ${{ inputs.limboai-treeish }} # Inits GODOT_VERSION, LIMBOAI_VERSION and NAME_PREFIX environment variables. - uses: ./modules/limboai/.github/actions/init-version @@ -203,11 +198,11 @@ jobs: uses: actions/cache@v3 with: path: ${{github.workspace}}/.scons_cache/ - key: ${{matrix.cache-name}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}} + key: ${{env.BIN}}-${{env.GODOT_TREEISH}}-${{github.ref}}-${{github.sha}} restore-keys: | - ${{env.BIN}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}} - ${{env.BIN}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}} - ${{env.BIN}}-${{env.GODOT_BASE_BRANCH}} + ${{env.BIN}}-${{env.GODOT_TREEISH}}-${{github.ref}}-${{github.sha}} + ${{env.BIN}}-${{env.GODOT_TREEISH}}-${{github.ref}} + ${{env.BIN}}-${{env.GODOT_TREEISH}} - name: Compilation env: From a0a2c4e519b8509999f1c7a469f50cfda425b8c0 Mon Sep 17 00:00:00 2001 From: Serhii Snitsaruk Date: Wed, 13 Sep 2023 10:49:48 +0200 Subject: [PATCH 3/5] Rename runner.yml -> all_builds.yml --- .github/workflows/{runner.yml => all_builds.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{runner.yml => all_builds.yml} (100%) diff --git a/.github/workflows/runner.yml b/.github/workflows/all_builds.yml similarity index 100% rename from .github/workflows/runner.yml rename to .github/workflows/all_builds.yml From dc3312cc2e090258c5fca38627d4d2459a40211c Mon Sep 17 00:00:00 2001 From: Serhii Snitsaruk Date: Wed, 13 Sep 2023 10:50:53 +0200 Subject: [PATCH 4/5] GH: Fix cache handling --- .github/workflows/android.yml | 8 ++++---- .github/workflows/ios.yml | 8 ++++---- .github/workflows/linux.yml | 8 ++++---- .github/workflows/macos.yml | 8 ++++---- .github/workflows/web.yml | 8 ++++---- .github/workflows/windows.yml | 8 ++++---- 6 files changed, 24 insertions(+), 24 deletions(-) diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index 8c57104..7308aa2 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -105,11 +105,11 @@ jobs: uses: actions/cache@v3 with: path: ${{github.workspace}}/.scons_cache/ - key: ${{matrix.cache-name}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}} + key: ${{env.BIN}}-${{inputs.godot-treeish}}-${{inputs.limboai-treeish}}-${{env.LIMBOAI_VERSION}} restore-keys: | - ${{env.BIN}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}} - ${{env.BIN}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}} - ${{env.BIN}}-${{env.GODOT_BASE_BRANCH}} + ${{env.BIN}}-${{inputs.godot-treeish}}-${{inputs.limboai-treeish}}-${{env.LIMBOAI_VERSION}} + ${{env.BIN}}-${{inputs.godot-treeish}}-${{inputs.limboai-treeish}} + ${{env.BIN}}-${{inputs.godot-treeish}} - name: Compilation env: diff --git a/.github/workflows/ios.yml b/.github/workflows/ios.yml index 4db9047..1adcc06 100644 --- a/.github/workflows/ios.yml +++ b/.github/workflows/ios.yml @@ -117,11 +117,11 @@ jobs: uses: actions/cache@v3 with: path: ${{github.workspace}}/.scons_cache/ - key: ${{matrix.cache-name}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}} + key: ${{env.BIN}}-${{inputs.godot-treeish}}-${{inputs.limboai-treeish}}-${{env.LIMBOAI_VERSION}} restore-keys: | - ${{env.BIN}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}} - ${{env.BIN}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}} - ${{env.BIN}}-${{env.GODOT_BASE_BRANCH}} + ${{env.BIN}}-${{inputs.godot-treeish}}-${{inputs.limboai-treeish}}-${{env.LIMBOAI_VERSION}} + ${{env.BIN}}-${{inputs.godot-treeish}}-${{inputs.limboai-treeish}} + ${{env.BIN}}-${{inputs.godot-treeish}} - name: Compilation env: diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 9a604f7..bbb4e43 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -142,11 +142,11 @@ jobs: uses: actions/cache@v3 with: path: ${{github.workspace}}/.scons_cache/ - key: ${{matrix.cache-name}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}} + key: ${{env.BIN}}-${{inputs.godot-treeish}}-${{inputs.limboai-treeish}}-${{env.LIMBOAI_VERSION}} restore-keys: | - ${{env.BIN}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}} - ${{env.BIN}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}} - ${{env.BIN}}-${{env.GODOT_BASE_BRANCH}} + ${{env.BIN}}-${{inputs.godot-treeish}}-${{inputs.limboai-treeish}}-${{env.LIMBOAI_VERSION}} + ${{env.BIN}}-${{inputs.godot-treeish}}-${{inputs.limboai-treeish}} + ${{env.BIN}}-${{inputs.godot-treeish}} - name: Compilation env: diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index 2651bd7..aacdd92 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -160,11 +160,11 @@ jobs: uses: actions/cache@v3 with: path: ${{github.workspace}}/.scons_cache/ - key: ${{matrix.cache-name}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}} + key: ${{env.BIN}}-${{inputs.godot-treeish}}-${{inputs.limboai-treeish}}-${{env.LIMBOAI_VERSION}} restore-keys: | - ${{env.BIN}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}} - ${{env.BIN}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}} - ${{env.BIN}}-${{env.GODOT_BASE_BRANCH}} + ${{env.BIN}}-${{inputs.godot-treeish}}-${{inputs.limboai-treeish}}-${{env.LIMBOAI_VERSION}} + ${{env.BIN}}-${{inputs.godot-treeish}}-${{inputs.limboai-treeish}} + ${{env.BIN}}-${{inputs.godot-treeish}} - name: Compilation env: diff --git a/.github/workflows/web.yml b/.github/workflows/web.yml index 38cae0c..829ef6f 100644 --- a/.github/workflows/web.yml +++ b/.github/workflows/web.yml @@ -94,11 +94,11 @@ jobs: uses: actions/cache@v3 with: path: ${{github.workspace}}/.scons_cache/ - key: ${{matrix.cache-name}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}} + key: ${{env.CACHE_NAME}}-${{inputs.godot-treeish}}-${{inputs.limboai-treeish}}-${{env.LIMBOAI_VERSION}} restore-keys: | - ${{env.CACHE_NAME}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}} - ${{env.CACHE_NAME}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}} - ${{env.CACHE_NAME}}-${{env.GODOT_BASE_BRANCH}} + ${{env.CACHE_NAME}}-${{inputs.godot-treeish}}-${{inputs.limboai-treeish}}-${{env.LIMBOAI_VERSION}} + ${{env.CACHE_NAME}}-${{inputs.godot-treeish}}-${{inputs.limboai-treeish}} + ${{env.CACHE_NAME}}-${{inputs.godot-treeish}} - name: Compilation env: diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index db4f9d3..d3aeb07 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -137,11 +137,11 @@ jobs: uses: actions/cache@v3 with: path: ${{github.workspace}}/.scons_cache/ - key: ${{matrix.cache-name}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}} + key: ${{env.BIN}}-${{inputs.godot-treeish}}-${{inputs.limboai-treeish}}-${{env.LIMBOAI_VERSION}} restore-keys: | - ${{env.BIN}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}} - ${{env.BIN}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}} - ${{env.BIN}}-${{env.GODOT_BASE_BRANCH}} + ${{env.BIN}}-${{inputs.godot-treeish}}-${{inputs.limboai-treeish}}-${{env.LIMBOAI_VERSION}} + ${{env.BIN}}-${{inputs.godot-treeish}}-${{inputs.limboai-treeish}} + ${{env.BIN}}-${{inputs.godot-treeish}} - name: Compilation env: From c7d7c0fcffac47c41a6ee1cfa19c346ffe253b68 Mon Sep 17 00:00:00 2001 From: Serhii Snitsaruk Date: Wed, 13 Sep 2023 11:10:58 +0200 Subject: [PATCH 5/5] GH: Trigger tests only on push/pr to master branch --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0f8b634..4c4f84e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -3,7 +3,7 @@ on: workflow_dispatch: push: - branches: [ master, github-workflows ] + branches: [ master ] paths-ignore: - "README.md" - "LICENSE"