Build CI #33
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is a basic workflow to help you get started with Actions | |
name: Build CI | |
# Controls when the workflow will run | |
on: | |
push: | |
branches: | |
- develop | |
workflow_dispatch: | |
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
jobs: | |
buildWindows: | |
# The type of runner that the job will run on | |
runs-on: windows-latest | |
# The name of the job | |
name: Windows x64 Build | |
permissions: | |
contents: write | |
actions: write | |
# Steps represent a sequence of tasks that will be executed as part of the job | |
steps: | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- name: Pulling the new commit | |
uses: actions/checkout@main | |
with: | |
submodules: true # PLEASE LEAVE SUBMODULES ENABLED!!!!!!!!!! | |
- name: Setting up Haxe | |
uses: krdlab/setup-haxe@master | |
with: | |
haxe-version: 4.3.4 | |
# Took the caching functions from Codename Engine | |
- name: Restore existing build cache for faster compilation | |
id: cache-restore | |
uses: actions/cache/restore@v4 | |
with: | |
key: cache-build-windows | |
path: | | |
export/release/windows/haxe/ | |
export/release/windows/obj/ | |
# Runs a set of commands using the runners shell | |
- name: Install libraries through HMM | |
run: | | |
haxellib setup C:/haxelib | |
haxelib install hxcpp > /dev/null --quiet | |
haxelib install hmm --quiet | |
haxelib run hmm setup | |
haxelib run hmm install --quiet | |
haxelib run lime build windows | |
- name: Build the engine | |
run: | | |
haxellib setup C:/haxelib | |
haxelib install hxcpp > /dev/null --quiet | |
haxelib install hmm --quiet | |
haxelib run hmm setup | |
haxelib run hmm install --quiet | |
haxelib run lime build windows | |
shell: cmd | |
- name: Publish Artifact | |
uses: actions/[email protected] | |
with: | |
name: windowsBuild | |
path: export/release/windows/bin | |
- name: Clear 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-build-windows") { | |
console.log('Clearing ' + cache.key + '...') | |
await github.rest.actions.deleteActionsCacheById({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
cache_id: cache.id, | |
}) | |
console.log("Cache cleared.") | |
} | |
} | |
- name: Save new cache | |
uses: actions/cache/save@v4 | |
with: | |
path: | | |
export/release/windows/haxe/ | |
export/release/windows/obj/ | |
export/debug/windows/haxe/ | |
export/debug/windows/obj/ | |
key: cache-build-windows |