Browse Source

Master build script, this should do Linux and MacOS all in one swoop.

Matt Coburn 5 years ago
parent
commit
7ed3fbe4d6

+ 168 - 0
.github/workflows/Build-Master.yaml

@@ -0,0 +1,168 @@
+name: Master Build
+
+on:
+  push:
+    branches: [ master ]
+  pull_request:
+    branches: [ master ]
+
+jobs:
+    build_linux64:
+        name: Build for Linux 64bit (Ubuntu)
+        runs-on: ubuntu-latest
+        outputs:
+          build_number: ${{ steps.buildnumber.outputs.build_number }}
+          create_release_url: ${{ steps.create_release.outputs.upload_url }}
+        steps:
+        
+        - name: Generate build number
+          id: buildnumber
+          uses: einaregilsson/build-number@v2 
+          with:
+            token: ${{secrets.github_token}}
+
+        - name: Checkout code
+          uses: actions/checkout@v2
+
+        - name: Create temporary directories.
+        - run: |
+            mkdir -p ${{ runner.workspace }}/ReleaseTemp/Release
+            mkdir -p ${{ runner.workspace }}/ReleaseTemp/Debug
+
+        - name: Run CMake to configure and create a Release build
+          uses: ashutoshvarma/action-cmake-build@master
+          with:
+            build-dir: ${{ runner.workspace }}/build-release
+            cc: gcc
+            cxx: g++
+            build-type: Release
+            configure-options: -DENET_DEBUG=0
+
+        - name: Stash compiled library
+          run: |
+            cp ${{ runner.workspace }}/build-release/libenet.so ${{ runner.workspace }}/ReleaseTemp/Release/libenet.so
+            zip -j -9 ${{ runner.workspace }}/ReleaseTemp/Release.zip ${{ runner.workspace }}/ReleaseTemp/Release/libenet.so
+
+        - name: Upload release build artifact
+          uses: actions/upload-artifact@v2
+          with:
+            name: Linux64-Release-Binary
+            path: ${{ runner.workspace }}/build-release/libenet.so
+
+        - name: Run CMake to configure and create a Debug build.
+          uses: ashutoshvarma/action-cmake-build@master
+          with:
+            build-dir: ${{ runner.workspace }}/build-debug
+            cc: gcc
+            cxx: g++
+            build-type: Debug
+            configure-options: -DENET_DEBUG=1
+
+        - name: Stash compiled library
+          run: |
+            cp ${{ runner.workspace }}/build-debug/libenet.so ${{ runner.workspace }}/ReleaseTemp/Debug/libenet.so
+            zip -j -9 ${{ runner.workspace }}/ReleaseTemp/Debug.zip ${{ runner.workspace }}/ReleaseTemp/Debug/libenet.so
+
+        - name: Upload debug build artifact
+          uses: actions/upload-artifact@v2
+          with:
+            name: Linux64-Debug-Binary
+            path: ${{ runner.workspace }}/build/libenet.so
+
+        - name: Create a release
+          id: create_release
+          uses: actions/create-release@v1
+          env:
+            GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+          with:
+            tag_name: autobuild-${{ steps.buildnumber.outputs.build_number }}
+            release_name: ENET Native Libraries (Autobuild ${{ steps.buildnumber.outputs.build_number }})
+            body: This is an automatic build of ENET for various operating systems. Please do not mix and match ENET native binaries as code differences between forks may cause crashes. The release archive contains one for use in shipping, while the debug archive has logging facilities.
+            draft: false
+            prerelease: false
+
+        - name: Upload Release Asset
+          id: upload-release-asset 
+          uses: actions/upload-release-asset@v1
+          env:
+            GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+          with:
+            upload_url: ${{ steps.create_release.outputs.upload_url }} 
+            # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps 
+            asset_path: ${{ runner.workspace }}/ReleaseTemp/Release.zip
+            asset_name: libenet-release-linux64.zip
+            asset_content_type: application/zip
+             
+        - name: Upload Debug Asset
+          id: upload-debug-asset 
+          uses: actions/upload-release-asset@v1
+          env:
+            GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+          with:
+            upload_url: ${{ steps.create_release.outputs.upload_url }} 
+            # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps 
+            asset_path: ${{ runner.workspace }}/ReleaseTemp/Debug.zip
+            asset_name: libenet-debug-linux64.zip
+            asset_content_type: application/zip
+            
+    build_apple_mobile:
+      needs: build_linux64
+      runs-on: macos-latest
+      steps:
+      
+        - name: Setup XCode (with latest Apple SDK)
+          uses: maxim-lobanov/[email protected]
+          with:
+            xcode-version: latest
+
+        - name: Checkout Code
+          uses: actions/checkout@v2
+
+        - name: Make temp directories.
+          run: |
+            mkdir -p ${{ runner.workspace }}/temp/Release
+            mkdir -p ${{ runner.workspace }}/temp/Debug
+
+        - name: Run repository build script in Release mode
+          run: |            
+            cd $GITHUB_WORKSPACE/Build-iOS ; chmod +x ./Build-iOS.command ; ./Build-iOS.command
+            zip -j -9 ${{ runner.workspace }}/temp/Release/libenet.zip $GITHUB_WORKSPACE/enet/Build-iOS/build/Release-iphoneos/libenet.a
+
+        - name: Run repository build script in Debug mode
+          run: |
+            cd $GITHUB_WORKSPACE/Build-iOS; sed -i '' 's/BUILD_TYPE="Release"/BUILD_TYPE="Debug"/g' Build-iOS.command ; chmod +x ./Build-iOS.command ; ./Build-iOS.command
+            zip -j -9 ${{ runner.workspace }}/temp/Debug/libenet.zip $GITHUB_WORKSPACE/enet/Build-iOS/build/Debug-iphoneos/libenet.a 
+
+        - name: Stash release build artifact
+          uses: actions/upload-artifact@v2
+          with:
+            name: iOS-enet-Release
+            path: ${{ runner.workspace }}/temp/Release/libenet.zip
+
+        - name: Stash debug build artifact
+          uses: actions/upload-artifact@v2
+          with:
+            name: iOS-enet-Debug
+            path: ${{ runner.workspace }}/temp/Debug/libenet.zip
+
+        - name: Upload Release Asset
+          id: upload-release-asset 
+          uses: actions/upload-release-asset@v1
+          env:
+            GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+          with:
+            upload_url: ${{ needs.build_linux64.outputs.create_release_url }} 
+            asset_path: ${{ runner.workspace }}/temp/Release/libenet.zip
+            asset_name: libenet-release-iOS.zip
+            asset_content_type: application/zip
+
+        - name: Upload Debug Asset
+          id: upload-debug-asset 
+          uses: actions/upload-release-asset@v1
+          env:
+            GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+          with:
+            upload_url: ${{ needs.build_linux64.outputs.create_release_url }}
+            asset_path: ${{ runner.workspace }}/temp/Debug/libenet.zip
+            asset_name: libenet-debug-iOS.zip
+            asset_content_type: application/zip

+ 0 - 52
.github/workflows/Build-for-Linux64-UbuntuLatest.yaml

@@ -1,52 +0,0 @@
-name: Build for Linux 64bit
-
-on:
-  push:
-    branches: [ master ]
-  pull_request:
-    branches: [ master ]
-
-jobs:
-    build_release_linux64:
-        name: Linux 64Bit (Release)
-        runs-on: ubuntu-latest
-        steps:
-        
-        - uses: actions/checkout@v2
-        
-        - name: Run CMake to configure and create a Release build
-          uses: ashutoshvarma/action-cmake-build@master
-          with:
-            build-dir: ${{ runner.workspace }}/build
-            cc: gcc
-            cxx: g++
-            build-type: Release
-            configure-options: -DENET_DEBUG=OFF
-
-        - name: Upload release build artifact
-          uses: actions/upload-artifact@v2
-          with:
-            name: Linux64-Release-Binary
-            path: ${{ runner.workspace }}/build/libenet.so
-            
-    build_debug_linux64:
-        name: Linux 64Bit (Debug)
-        runs-on: ubuntu-latest
-        steps:
-        
-        - uses: actions/checkout@v2
-        
-        - name: Run CMake to configure and create a Debug build.
-          uses: ashutoshvarma/action-cmake-build@master
-          with:
-            build-dir: ${{ runner.workspace }}/build
-            cc: gcc
-            cxx: g++
-            build-type: Debug
-            configure-options: -DENET_DEBUG=ON
-
-        - name: Upload debug build artifact
-          uses: actions/upload-artifact@v2
-          with:
-            name: Linux64-Debug-Binary
-            path: ${{ runner.workspace }}/build/libenet.so

+ 0 - 0
.github/workflows/Build-for-iOS-latestSDK.yaml → .github/workflows/Build-for-iOS-latestSDK.ya__