Skip to content

Commit

Permalink
Merge branch 'master' into develop
Browse files Browse the repository at this point in the history
Added new build system with GitHub Action Workflows
  • Loading branch information
Rolf Geuenich committed Oct 19, 2023
2 parents 2986a33 + 7c8cca7 commit 1b50670
Show file tree
Hide file tree
Showing 4 changed files with 293 additions and 4 deletions.
147 changes: 147 additions & 0 deletions .github/workflows/build-docs.yml
Original file line number Diff line number Diff line change
@@ -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 }}."
140 changes: 140 additions & 0 deletions .github/workflows/build-includes.yml
Original file line number Diff line number Diff line change
@@ -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 }}."
8 changes: 4 additions & 4 deletions Moose Development/Moose/Modules.lua
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,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' )
Expand Down Expand Up @@ -170,7 +170,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' )
Expand Down
2 changes: 2 additions & 0 deletions Moose Setup/Moose_Create.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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/(.+)'" )
Expand Down

0 comments on commit 1b50670

Please sign in to comment.