From 7c8cca7f5676b4c6f2c065a8cdbdc82e01b9baf3 Mon Sep 17 00:00:00 2001 From: Rolf Geuenich Date: Thu, 19 Oct 2023 13:59:33 +0200 Subject: [PATCH 1/9] Added new build system with GitHub Action Workflows --- .github/workflows/build-docs.yml | 147 +++++++++++++++++++++++++++ .github/workflows/build-includes.yml | 140 +++++++++++++++++++++++++ Moose Development/Moose/Modules.lua | 8 +- Moose Setup/Moose_Create.lua | 2 + 4 files changed, 293 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/build-docs.yml create mode 100644 .github/workflows/build-includes.yml diff --git a/.github/workflows/build-docs.yml b/.github/workflows/build-docs.yml new file mode 100644 index 000000000..b0a111c82 --- /dev/null +++ b/.github/workflows/build-docs.yml @@ -0,0 +1,147 @@ +name: Moose-Docs + +on: + push: + branches: + - master + - develop + +jobs: + Build: + runs-on: ubuntu-latest + + steps: + - name: Extract branch name + shell: bash + run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT + id: extract_branch + + - name: Build informations + run: | + echo "Triggered by: ${{ github.event_name }}" + echo "Running on: ${{ runner.os }}" + echo "Ref: ${{ github.ref }}" + echo "Branch name: ${{ steps.extract_branch.outputs.branch }}" + echo "Repository: ${{ github.repository }}" + echo "Commit-Id: ${{ github.sha }}" + echo "Owner: ${{ github.repository_owner }}" + echo "FORCE_PUSH: ${{ env.FORCE_PUSH }}" + + ######################################################################### + # Prepare build environment + ######################################################################### + - name: Check out repository code + uses: actions/checkout@v4 + + - name: Prepare build output folders + run: | + mkdir -p build/tools + mkdir -p build/doc + + - name: Checkout FlightControls modified luadocumentor + uses: actions/checkout@v4 + with: + repository: Applevangelist/luadocumentor + path: './build/tools/luadocumentor' + ref: 'patch-1' + token: ${{ secrets.BOT_TOKEN }} + + - name: Update apt-get (needed for act docker image) + run: | + sudo apt-get -qq update + + - name: Install tree + run: | + sudo apt-get -qq install tree + + ######################################################################### + # Install all prerequisites for LuaDocumentor + ######################################################################### + - name: Install Lua + run: | + sudo apt-get -qq install lua5.1 + + - name: Install LuaRocks + run: | + sudo apt-get -qq install luarocks -y + + - name: Install markdown (prereq for LuaDocumentor) + run: | + sudo luarocks install markdown 0.32-2 + + - name: Install penlight (prereq for LuaDocumentor) + run: | + sudo luarocks install penlight 1.11.0-1 + + - name: Install metalua-compiler (prereq for LuaDocumentor) + run: | + sudo luarocks install metalua-compiler 0.7.3-1 + + - name: Install metalua-parser (prereq for LuaDocumentor) + run: | + sudo luarocks install metalua-parser 0.7.3-2 + + - name: Install checks (prereq for LuaDocumentor) + run: | + sudo luarocks install checks + + ######################################################################### + # Run LuaDocumentor + ######################################################################### + - name: Run LuaDocumentor + run: | + lua luadocumentor.lua -d ${{ github.workspace }}/build/doc "${{ github.workspace }}/Moose Development/Moose" + working-directory: ${{ github.workspace }}/build/tools/luadocumentor + + ######################################################################### + # Push to MOOSE_DOCS + ######################################################################### + - name: Set docs repo for branch + shell: bash + id: set_doc_repo + run: | + if [[ $GITHUB_REF == 'refs/heads/master' ]]; then + echo "docrepo=MOOSE_DOCS" >> "$GITHUB_OUTPUT" + else + echo "docrepo=MOOSE_DOCS_DEVELOP" >> "$GITHUB_OUTPUT" + fi + + - name: Checkout ${{ steps.set_doc_repo.outputs.docrepo }} to folder MOOSE_DOCS + uses: actions/checkout@v4 + with: + repository: ${{ github.repository_owner }}/${{ steps.set_doc_repo.outputs.docrepo }} + path: './build/MOOSE_DOCS' + fetch-depth: 0 + ref: 'master' + token: ${{ secrets.BOT_TOKEN }} + + - name: Delete folder to remove deleted files + run: | + rm -rf ./build/MOOSE_DOCS/Documentation/ + + - name: Create target folder + run: mkdir -p build/MOOSE_DOCS/Documentation + + - name: Copy build result to MOOSE_DOCS + run: | + cp ./build/doc/*.html ./build/MOOSE_DOCS/Documentation/ + + - name: Push result to docs repository (skipped by act) + if: ${{ env.FORCE_PUSH == 'true' }} + run: | + git config user.name "kaltokri" + git config user.email "rolf.geuenich@gmail.com" + git add . + git commit --allow-empty -m "Auto commit by GitHub Actions Workflow" + git push --set-upstream origin master + + working-directory: ${{ github.workspace }}/build/MOOSE_DOCS + + ######################################################################### + # Show the results + ######################################################################### + - name: List files in the repository + run: | + tree ${{ github.workspace }}/build + + - run: echo "This job's status is ${{ job.status }}." diff --git a/.github/workflows/build-includes.yml b/.github/workflows/build-includes.yml new file mode 100644 index 000000000..d8536f66a --- /dev/null +++ b/.github/workflows/build-includes.yml @@ -0,0 +1,140 @@ +name: Moose-Includes + +on: + push: + branches: + - master + - develop + +jobs: + Build: + runs-on: ubuntu-latest + + steps: + - name: Extract branch name + shell: bash + run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT + id: extract_branch + + - name: Build informations + run: | + echo "Triggered by: ${{ github.event_name }}" + echo "Running on: ${{ runner.os }}" + echo "Ref: ${{ github.ref }}" + echo "Branch name: ${{ steps.extract_branch.outputs.branch }}" + echo "Repository: ${{ github.repository }}" + echo "Commit-Id: ${{ github.sha }}" + echo "FORCE_PUSH: ${{ env.FORCE_PUSH }}" + + ######################################################################### + # Prepare build environment + ######################################################################### + - name: Check out repository code + uses: actions/checkout@v4 + + - name: Prepare build output folders + run: | + mkdir -p build/result/Moose_Include_Dynamic + mkdir -p build/result/Moose_Include_Static + + - name: Update apt-get (needed for act docker image) + run: | + sudo apt-get -qq update + + - name: Install tree + run: | + sudo apt-get -qq install tree + + ######################################################################### + # Install all prerequisites + ######################################################################### + - name: Install Lua 5.3 + run: | + sudo apt-get -qq install lua5.3 -y + - name: Check Lua version + run: | + lua -v + + - name: Install LuaRocks + run: | + sudo apt-get -qq install luarocks -y + - name: Check LuaRocks version + run: | + luarocks --version + + - name: Install Lua 5.3 Dev for prerequisites for LuaSrcDiet + run: | + sudo apt-get -qq install liblua5.3-dev -y + + - name: Install LuaSrcDiet + run: | + sudo luarocks install luasrcdiet + + - name: Install LuaCheck + run: | + sudo luarocks install luacheck + + ######################################################################### + # Build Include files + ######################################################################### + - name: Build Include Static + run: | + export COMMIT_TIME=$(git show -s --format=%cd ${{ github.sha }} --date=iso-strict) + lua5.3 "./Moose Setup/Moose_Create.lua" S "$COMMIT_TIME-${{ github.sha }}" "./Moose Development/Moose" "./Moose Setup" "./build/result/Moose_Include_Static" + + - name: Build Includes Dynamic + run: | + export COMMIT_TIME=$(git show -s --format=%cd ${{ github.sha }} --date=iso-strict) + lua5.3 "./Moose Setup/Moose_Create.lua" D "$COMMIT_TIME-${{ github.sha }}" "./Moose Development/Moose" "./Moose Setup" "./build/result/Moose_Include_Dynamic" + + - name: Run LuaSrcDiet + run: | + luasrcdiet --basic --opt-emptylines ./build/result/Moose_Include_Static/Moose.lua -o ./build/result/Moose_Include_Static/Moose_.lua + + ######################################################################### + # Run LuaCheck + ######################################################################### + - name: Run LuaCheck + if: ${{ env.SKIP_LUACHECK != 'true' }} + continue-on-error: true + run: | + luacheck --std=lua51c --config=.luacheckrc -gurasqq "Moose Development/Moose" + + ######################################################################### + # Push to MOOSE_INCLUDE + ######################################################################### + - name: Checkout MOOSE_INCLUDE + uses: actions/checkout@v4 + with: + repository: kaltokri/MOOSE_INCLUDE + path: './build/MOOSE_INCLUDE' + fetch-depth: 0 + ref: ${{ steps.extract_branch.outputs.branch }} + token: ${{ secrets.BOT_TOKEN }} + + - name: Create target folder (needed if checkout is deactivated) + run: mkdir -p build/MOOSE_INCLUDE + + - name: Copy build reseult to MOOSE_INCLUDE + run: | + cp -r ./build/result/* ./build/MOOSE_INCLUDE/ + + - name: Push result to MOOSE_INCLUDE repository (skipped by act) + if: ${{ env.FORCE_PUSH == 'true' }} + run: | + git config user.name "MooseBotter" + git config user.email "moosebotter@tniedermeier.com" + git add . + git commit --allow-empty -m "Auto commit by GitHub Actions Workflow" + git push --set-upstream origin ${{ steps.extract_branch.outputs.branch }} + + working-directory: ${{ github.workspace }}/build/MOOSE_INCLUDE + + ######################################################################### + # Show the results + ######################################################################### + - name: List files in the repository + run: | + tree ${{ github.workspace }}/build + + - run: echo "This job's status is ${{ job.status }}." diff --git a/Moose Development/Moose/Modules.lua b/Moose Development/Moose/Modules.lua index 55a7860cd..bdc145ff2 100644 --- a/Moose Development/Moose/Modules.lua +++ b/Moose Development/Moose/Modules.lua @@ -98,9 +98,9 @@ __Moose.Include( 'Scripts/Moose/AI/AI_A2G_CAS.lua' ) __Moose.Include( 'Scripts/Moose/AI/AI_A2G_SEAD.lua' ) __Moose.Include( 'Scripts/Moose/AI/AI_A2G_Dispatcher.lua' ) __Moose.Include( 'Scripts/Moose/AI/AI_Patrol.lua' ) -__Moose.Include( 'Scripts/Moose/AI/AI_Cap.lua' ) -__Moose.Include( 'Scripts/Moose/AI/AI_Cas.lua' ) -__Moose.Include( 'Scripts/Moose/AI/AI_Bai.lua' ) +__Moose.Include( 'Scripts/Moose/AI/AI_CAP.lua' ) +__Moose.Include( 'Scripts/Moose/AI/AI_CAS.lua' ) +__Moose.Include( 'Scripts/Moose/AI/AI_BAI.lua' ) __Moose.Include( 'Scripts/Moose/AI/AI_Formation.lua' ) __Moose.Include( 'Scripts/Moose/AI/AI_Escort.lua' ) __Moose.Include( 'Scripts/Moose/AI/AI_Escort_Request.lua' ) @@ -139,7 +139,7 @@ __Moose.Include( 'Scripts/Moose/Tasking/Task_A2G_Dispatcher.lua' ) __Moose.Include( 'Scripts/Moose/Tasking/Task_A2G.lua' ) __Moose.Include( 'Scripts/Moose/Tasking/Task_A2A_Dispatcher.lua' ) __Moose.Include( 'Scripts/Moose/Tasking/Task_A2A.lua' ) -__Moose.Include( 'Scripts/Moose/Tasking/Task_Cargo.lua' ) +__Moose.Include( 'Scripts/Moose/Tasking/Task_CARGO.lua' ) __Moose.Include( 'Scripts/Moose/Tasking/Task_Cargo_Transport.lua' ) __Moose.Include( 'Scripts/Moose/Tasking/Task_Cargo_CSAR.lua' ) __Moose.Include( 'Scripts/Moose/Tasking/Task_Cargo_Dispatcher.lua' ) diff --git a/Moose Setup/Moose_Create.lua b/Moose Setup/Moose_Create.lua index 4b3e635ec..0bfde46ac 100644 --- a/Moose Setup/Moose_Create.lua +++ b/Moose Setup/Moose_Create.lua @@ -55,6 +55,8 @@ local MooseSourcesFile = assert(io.open( PathConvert(MooseModulesFilePath), "r" local MooseSource = MooseSourcesFile:read("*l") while( MooseSource ) do + -- Remove Windows line endings. Can occur when using act + MooseSource = string.gsub(MooseSource, "\r", "") if MooseSource ~= "" then MooseSource = string.match( MooseSource, "Scripts/Moose/(.+)'" ) From 49fd78abe7a3e7ba5ade72663811ecfc97f91fb5 Mon Sep 17 00:00:00 2001 From: Applevangelist Date: Thu, 19 Oct 2023 15:22:10 +0200 Subject: [PATCH 2/9] #SRS * Typo --- Moose Development/Moose/Sound/SRS.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Moose Development/Moose/Sound/SRS.lua b/Moose Development/Moose/Sound/SRS.lua index 13550da54..70dd2adb6 100644 --- a/Moose Development/Moose/Sound/SRS.lua +++ b/Moose Development/Moose/Sound/SRS.lua @@ -94,7 +94,7 @@ -- ## Set Google -- -- Use Google's text-to-speech engine with the @{#MSRS.SetGoogle} function, e.g. ':SetGoogle()'. --- By enabling this it also allows you to utilize SSML in your text for added flexibilty. +-- By enabling this it also allows you to utilize SSML in your text for added flexibility. -- For more information on setting up a cloud account, visit: https://cloud.google.com/text-to-speech -- Google's supported SSML reference: https://cloud.google.com/text-to-speech/docs/ssml -- From 2dd2e593e8351ce13d10cf2e8a7b78f28b65a801 Mon Sep 17 00:00:00 2001 From: Thomas <72444570+Applevangelist@users.noreply.github.com> Date: Thu, 19 Oct 2023 15:48:50 +0200 Subject: [PATCH 3/9] Update README.md (#2017) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index aec3cbd3a..7205da476 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![Build status](https://ci.appveyor.com/api/projects/status/1y8nfmx7lwsn33tt?svg=true)](https://ci.appveyor.com/project/Applevangelist/MOOSE) +[![Moose-Includes](https://github.com/FlightControl-Master/MOOSE/actions/workflows/build-includes.yml/badge.svg?branch=master)](https://github.com/FlightControl-Master/MOOSE/actions/workflows/build-includes.yml) # MOOSE framework From f0a37172b97ecfd11d6027a703acb49d711d3a73 Mon Sep 17 00:00:00 2001 From: Thomas <72444570+Applevangelist@users.noreply.github.com> Date: Thu, 19 Oct 2023 16:14:59 +0200 Subject: [PATCH 4/9] Update build-includes.yml (#2018) --- .github/workflows/build-includes.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-includes.yml b/.github/workflows/build-includes.yml index d8536f66a..1ba61a9a6 100644 --- a/.github/workflows/build-includes.yml +++ b/.github/workflows/build-includes.yml @@ -24,7 +24,7 @@ jobs: echo "Branch name: ${{ steps.extract_branch.outputs.branch }}" echo "Repository: ${{ github.repository }}" echo "Commit-Id: ${{ github.sha }}" - echo "FORCE_PUSH: ${{ env.FORCE_PUSH }}" + echo "FORCE_PUSH: ${{ vars.FORCE_PUSH }}" ######################################################################### # Prepare build environment From 015af9774c73f491a021666b35b4d5664e080bb6 Mon Sep 17 00:00:00 2001 From: Thomas <72444570+Applevangelist@users.noreply.github.com> Date: Thu, 19 Oct 2023 16:17:48 +0200 Subject: [PATCH 5/9] Update build-includes.yml --- .github/workflows/build-includes.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-includes.yml b/.github/workflows/build-includes.yml index 1ba61a9a6..06c64e7b7 100644 --- a/.github/workflows/build-includes.yml +++ b/.github/workflows/build-includes.yml @@ -120,7 +120,7 @@ jobs: cp -r ./build/result/* ./build/MOOSE_INCLUDE/ - name: Push result to MOOSE_INCLUDE repository (skipped by act) - if: ${{ env.FORCE_PUSH == 'true' }} + if: ${{ vars.FORCE_PUSH == 'true' }} run: | git config user.name "MooseBotter" git config user.email "moosebotter@tniedermeier.com" From d4a46606fd705eb5aa53bbece788626aa3eb3470 Mon Sep 17 00:00:00 2001 From: kaltokri Date: Thu, 19 Oct 2023 18:16:45 +0200 Subject: [PATCH 6/9] Switched from env.FORCE_PUSH to vars.FORCE_PUSH --- .github/workflows/build-docs.yml | 6 +++--- .github/workflows/build-includes.yml | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build-docs.yml b/.github/workflows/build-docs.yml index b0a111c82..e8cd1d248 100644 --- a/.github/workflows/build-docs.yml +++ b/.github/workflows/build-docs.yml @@ -25,7 +25,7 @@ jobs: echo "Repository: ${{ github.repository }}" echo "Commit-Id: ${{ github.sha }}" echo "Owner: ${{ github.repository_owner }}" - echo "FORCE_PUSH: ${{ env.FORCE_PUSH }}" + echo "FORCE_PUSH: ${{ vars.FORCE_PUSH }}" ######################################################################### # Prepare build environment @@ -126,8 +126,8 @@ jobs: run: | cp ./build/doc/*.html ./build/MOOSE_DOCS/Documentation/ - - name: Push result to docs repository (skipped by act) - if: ${{ env.FORCE_PUSH == 'true' }} + - name: Push result to docs repository + if: ${{ vars.FORCE_PUSH == 'true' }} run: | git config user.name "kaltokri" git config user.email "rolf.geuenich@gmail.com" diff --git a/.github/workflows/build-includes.yml b/.github/workflows/build-includes.yml index 06c64e7b7..ef9e7f6ce 100644 --- a/.github/workflows/build-includes.yml +++ b/.github/workflows/build-includes.yml @@ -95,7 +95,7 @@ jobs: # Run LuaCheck ######################################################################### - name: Run LuaCheck - if: ${{ env.SKIP_LUACHECK != 'true' }} + if: ${{ vars.SKIP_LUACHECK != true }} continue-on-error: true run: | luacheck --std=lua51c --config=.luacheckrc -gurasqq "Moose Development/Moose" @@ -119,7 +119,7 @@ jobs: run: | cp -r ./build/result/* ./build/MOOSE_INCLUDE/ - - name: Push result to MOOSE_INCLUDE repository (skipped by act) + - name: Push result to MOOSE_INCLUDE repository if: ${{ vars.FORCE_PUSH == 'true' }} run: | git config user.name "MooseBotter" From dc54cc82af60874b3dd30fae3967ab728836826e Mon Sep 17 00:00:00 2001 From: kaltokri Date: Thu, 19 Oct 2023 18:24:46 +0200 Subject: [PATCH 7/9] Fixed wrong repository owner --- .github/workflows/build-includes.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-includes.yml b/.github/workflows/build-includes.yml index ef9e7f6ce..ec11f6e0b 100644 --- a/.github/workflows/build-includes.yml +++ b/.github/workflows/build-includes.yml @@ -24,6 +24,7 @@ jobs: echo "Branch name: ${{ steps.extract_branch.outputs.branch }}" echo "Repository: ${{ github.repository }}" echo "Commit-Id: ${{ github.sha }}" + echo "Owner: ${{ github.repository_owner }}" echo "FORCE_PUSH: ${{ vars.FORCE_PUSH }}" ######################################################################### @@ -106,7 +107,7 @@ jobs: - name: Checkout MOOSE_INCLUDE uses: actions/checkout@v4 with: - repository: kaltokri/MOOSE_INCLUDE + repository: ${{ github.repository_owner }}/MOOSE_INCLUDE path: './build/MOOSE_INCLUDE' fetch-depth: 0 ref: ${{ steps.extract_branch.outputs.branch }} From 722c33df6246fe32a73f28a6b0054d934f3193bb Mon Sep 17 00:00:00 2001 From: kaltokri Date: Thu, 19 Oct 2023 18:53:52 +0200 Subject: [PATCH 8/9] Fixed wrong git config entries in build-docs.yml --- .github/workflows/build-docs.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-docs.yml b/.github/workflows/build-docs.yml index e8cd1d248..0fdd08f6e 100644 --- a/.github/workflows/build-docs.yml +++ b/.github/workflows/build-docs.yml @@ -129,8 +129,8 @@ jobs: - name: Push result to docs repository if: ${{ vars.FORCE_PUSH == 'true' }} run: | - git config user.name "kaltokri" - git config user.email "rolf.geuenich@gmail.com" + git config user.name "MooseBotter" + git config user.email "moosebotter@tniedermeier.com" git add . git commit --allow-empty -m "Auto commit by GitHub Actions Workflow" git push --set-upstream origin master From 10dffb068951e3cabb44850d7df4710b9de86401 Mon Sep 17 00:00:00 2001 From: kaltokri Date: Fri, 20 Oct 2023 09:58:35 +0200 Subject: [PATCH 9/9] Changed mail from MooseBotter --- .github/workflows/build-docs.yml | 2 +- .github/workflows/build-includes.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-docs.yml b/.github/workflows/build-docs.yml index 0fdd08f6e..7d4f074b9 100644 --- a/.github/workflows/build-docs.yml +++ b/.github/workflows/build-docs.yml @@ -130,7 +130,7 @@ jobs: if: ${{ vars.FORCE_PUSH == 'true' }} run: | git config user.name "MooseBotter" - git config user.email "moosebotter@tniedermeier.com" + git config user.email "MooseBotter@users.noreply.github.com" git add . git commit --allow-empty -m "Auto commit by GitHub Actions Workflow" git push --set-upstream origin master diff --git a/.github/workflows/build-includes.yml b/.github/workflows/build-includes.yml index ec11f6e0b..04def15d3 100644 --- a/.github/workflows/build-includes.yml +++ b/.github/workflows/build-includes.yml @@ -124,7 +124,7 @@ jobs: if: ${{ vars.FORCE_PUSH == 'true' }} run: | git config user.name "MooseBotter" - git config user.email "moosebotter@tniedermeier.com" + git config user.email "MooseBotter@users.noreply.github.com" git add . git commit --allow-empty -m "Auto commit by GitHub Actions Workflow" git push --set-upstream origin ${{ steps.extract_branch.outputs.branch }}