diff --git a/.github/workflows/build-nightly.yaml b/.github/workflows/build-nightly.yaml new file mode 100644 index 0000000..b7475e8 --- /dev/null +++ b/.github/workflows/build-nightly.yaml @@ -0,0 +1,135 @@ +# Hewwo! -Raltyro + +name: Build Nightly +on: + workflow_dispatch: + push: + +jobs: + build: + strategy: + fail-fast: false + matrix: + compile: [linux, mac, windows] + build: [release, 32bit, debug] + exclude: + - compile: linux + build: 32bit + + - compile: mac + build: 32bit + + include: + - compile: linux + os: ubuntu-latest + folder: linux + + - compile: mac + os: macOS-latest + folder: macos + + - compile: windows + os: windows-latest + folder: windows + + name: ${{ matrix.compile }}-${{ matrix.build }} + runs-on: ${{ matrix.os }} + + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Setup Haxe + uses: krdlab/setup-haxe@master + with: + haxe-version: 4.2.5 + + - name: Restore action cache + uses: actions/cache@v3 + with: + key: cache-${{ matrix.compile }}-${{ matrix.build }} + path: | + export/${{ matrix.build }}/${{ matrix.folder }}/haxe/ + export/${{ matrix.build }}/${{ matrix.folder }}/obj/ + .haxelib/ + + - name: Setup Haxelib + run: | + haxelib setup .haxelib/ + haxelib --global update haxelib --quiet + haxelib install hxcpp --quiet + haxelib install format --quiet + haxelib install hxp --quiet + + - name: Install hxcpp-debug-server + if: ${{ matrix.build == 'debug' }} + run: haxelib install hxcpp-debug-server --quiet + + - name: Install platform-specific distributes (linux) + if: ${{ matrix.compile == 'linux' }} + run: | + sudo apt-get install libvlc-dev + sudo apt-get install libvlccore-dev + sudo apt-get install glibc-source + sudo apt-get install libidn12 + sudo apt-get install libidn-dev + + - name: Install haxelibs + run: haxe -cp dev -D analyzer-optimize -main Update --interp + + - name: Compile (32-bit) + if: ${{ matrix.build == '32bit' }} + run: haxelib run openfl build ${{ matrix.compile }} -${{ matrix.build }} -D HXCPP_M32 -32 + + - name: Compile (64-bit) + if: ${{ matrix.build != '32bit' }} + run: haxelib run openfl build ${{ matrix.compile }} -${{ matrix.build }} -64 + + - name: Uploading artifact + uses: actions/upload-artifact@v3 + with: + name: ${{ matrix.compile }}-${{ matrix.build }} + path: export/${{ matrix.build }}/${{ matrix.folder }}/bin + if-no-files-found: error + + - name: Uploading artifact (executable windows) + if: ${{ matrix.compile == 'windows' }} + uses: actions/upload-artifact@v3 + with: + name: executableOnly-${{ matrix.compile }}-${{ matrix.build }} + path: export/${{ matrix.build }}/${{ matrix.folder }}/bin/CrowEngine.exe + + - name: Uploading artifact (executable unix) + if: ${{ matrix.compile == 'linux' }} + uses: actions/upload-artifact@v3 + with: + name: executableOnly-${{ matrix.compile }}-${{ matrix.build }} + path: export/${{ matrix.build }}/${{ matrix.folder }}/bin/CrowEngine + + - name: Clearing already existing cache + uses: actions/github-script@v6 + with: + script: | + const caches = await github.rest.actions.getActionsCacheList({ + owner: context.repo.owner, + repo: context.repo.repo, + }) + for (const cache of caches.data.actions_caches) { + if (cache.key == "cache-${{ matrix.compile }}-${{ matrix.build }}") { + await github.rest.actions.deleteActionsCacheById({ + owner: context.repo.owner, + repo: context.repo.repo, + cache_id: cache.id, + }) + } + } + + - name: Uploading new cache + uses: actions/cache@v3 + with: + key: cache-${{ matrix.compile }}-${{ matrix.build }} + path: | + export/${{ matrix.build }}/${{ matrix.folder }}/haxe/ + export/${{ matrix.build }}/${{ matrix.folder }}/obj/ + .haxelib/ + \ No newline at end of file diff --git a/.github/workflows/publish-nightly.yaml b/.github/workflows/publish-nightly.yaml new file mode 100644 index 0000000..51e152a --- /dev/null +++ b/.github/workflows/publish-nightly.yaml @@ -0,0 +1,42 @@ +name: Publish Nightly Builds +on: + workflow_run: + workflows: + - Build Nightly + types: + - completed + +jobs: + publish: + runs-on: ubuntu-latest + if: ${{ github.event.workflow_run.conclusion == 'success' }} + steps: + - name: Download artifacts + uses: dawidd6/action-download-artifact@v2.26.0 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + run_id: ${{ github.event.workflow_run.id }} + skip_unpack: true + path: ./artifacts + + - name: Delete tag and release + uses: dev-drprasad/delete-tag-and-release@v0.2.0 + with: + delete_release: true + tag_name: nightly + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Release + uses: softprops/action-gh-release@v1 + with: + tag_name: nightly + name: Nightly Builds + prerelease: false + files: ./artifacts/* + body: | + This is an automatic nightly release of Crow Engine + if you encounter any bugs in this release, please report it to the Discord Server #bug-reports AND/OR Make an issue in the github repo + thank you for using Crow Engine! + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/Project.xml b/Project.xml index d0962a6..5fdf9ca 100644 --- a/Project.xml +++ b/Project.xml @@ -2,79 +2,89 @@ - + + + + + + + - + + - - + - + + + - - - + - - + - + + - - - - - - - - - +
+ + +
+
+ + +
+ + - + - + - - - - - + + + + +
- - - - - - - - + + + + + + + +
- - - - - - - - + + + + + + + +
- - + + @@ -92,80 +102,55 @@ - - - - - - - + + + - - + - - - - + + - + - - - - - - - - - - - - - - - - - - - + + + + - - - - + - + - + - + - + - - - - - - + + + + + +
diff --git a/dev/Update.hx b/dev/Update.hx new file mode 100644 index 0000000..bc9e292 --- /dev/null +++ b/dev/Update.hx @@ -0,0 +1,90 @@ +import haxe.Json; + +import sys.io.File; +import sys.io.Process; +import sys.FileSystem; + +using StringTools; + +typedef Library = { + var name:String; + var type:String; + var version:String; + var dir:String; + var ref:String; + var url:String; +} + +class Update { + public static function main() { + var isHMM = getProcessOutput('haxelib', ['run', 'hmm']).contains('help'), prevCwd = Sys.getCwd(), mainCwd; + var json:Array = Json.parse(File.getContent('./hmm.json')).dependencies; + if (isHMM) { + if (!FileSystem.exists('.haxelib')) FileSystem.createDirectory('.haxelib'); + Sys.setCwd(mainCwd = '$prevCwd/.haxelib'); + } + else + Sys.setCwd(mainCwd = getProcessOutput('haxelib', ['config']).rtrim()); + + try { + Sys.println("Preparing installation..."); + + for (lib in json) { + switch(lib.type) { + case "haxelib": + if (!isHMM && FileSystem.exists('${lib.dir}/dev')) { + Sys.println('Skipping "${lib.name}"'); + continue; + } + + Sys.println('Installing "${lib.name}"...'); + var vers = lib.version != null ? lib.version : ""; + + if (isHMM) + Sys.command('haxelib run hmm haxelib ${lib.name} ${vers}'); + else { + Sys.command('haxelib install ${lib.name} ${vers} --quiet'); + if (lib.version != null) File.saveContent('${lib.name}/.current', vers); + } + + case "git": + if (!FileSystem.exists(lib.dir)) FileSystem.createDirectory(lib.dir); + else if (!isHMM && FileSystem.exists('${lib.dir}/dev')) { + Sys.println('Skipping "${lib.name}"'); + continue; + } + + Sys.println('Installing "${lib.name}" from git url "${lib.url}"'); + + if (FileSystem.exists('${lib.dir}/git')) { + Sys.setCwd('${mainCwd}/${lib.dir}/git'); + Sys.command('git pull'); + } + else { + Sys.setCwd('${mainCwd}/${lib.dir}'); + Sys.command('git clone --recurse-submodules ${lib.url} git'); + if (!isHMM) File.saveContent('.current', 'git'); + } + Sys.setCwd(mainCwd); + + default: + Sys.println('Cannot resolve library of type "${lib.type}"'); + } + } + } + catch(e) + trace(e); + + Sys.setCwd(prevCwd); + } + + public static function getProcessOutput(cmd:String, args:Array):String { + try { + var process = new Process(cmd, args), output = process.stdout.readAll().toString(); + process.close(); + + return output; + } + catch(_) return ""; + } +} \ No newline at end of file diff --git a/hmm.json b/hmm.json new file mode 100644 index 0000000..4d6bc64 --- /dev/null +++ b/hmm.json @@ -0,0 +1,17 @@ +{ + "dependencies": [ + {"name": "lime", "type": "haxelib"}, + {"name": "openfl", "type": "haxelib"}, + {"name": "flixel", "type": "haxelib", "version": "5.2.2"}, + {"name": "flixel-tools", "type": "haxelib"}, + {"name": "flixel-ui", "type": "haxelib"}, + {"name": "flixel-addons", "type": "haxelib"}, + {"name": "flxanimate", "type": "haxelib"}, + {"name": "discord_rpc", "type": "git", "dir": "discord_rpc", + "ref": "master", + "url": "https://github.com/Aidan63/linc_discord-rpc" + }, + {"name": "hxCodec", "type": "haxelib"}, + {"name": "hscript", "type": "haxelib"} + ] +} \ No newline at end of file diff --git a/update.bat b/update.bat new file mode 100644 index 0000000..e0137c5 --- /dev/null +++ b/update.bat @@ -0,0 +1 @@ +@haxe -cp dev -D analyzer-optimize -main Update --interp \ No newline at end of file diff --git a/update.sh b/update.sh new file mode 100644 index 0000000..00216bc --- /dev/null +++ b/update.sh @@ -0,0 +1,2 @@ +#!/bin/sh +haxe -cp dev -D analyzer-optimize -main Update --interp \ No newline at end of file