1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2024-11-10 00:34:40 +00:00
Funkin/.github/actions/setup-haxe/action.yml
2024-04-24 22:23:29 +01:00

141 lines
4.6 KiB
YAML

name: setup-haxeshit
description: "sets up haxe shit, using HMM!"
inputs:
haxe:
description: 'Version of haxe to install'
required: true
default: '4.3.4'
hxcpp-cache:
description: 'Whether to use a shared hxcpp compile cache'
required: true
default: 'true'
hxcpp-cache-path:
description: 'Path to create hxcpp cache in'
required: true
default: ${{ runner.temp }}/hxcpp_cache
targets:
description: 'Targets we plan to compile to. Installs native dependencies needed.'
required: true
gh-token:
description: 'GitHub secret for private repos as dependencies'
runs:
using: "composite"
steps:
- name: Setup timers
shell: bash
run: |
echo "TIMER_HAXE=$(date +%s)" >> "$GITHUB_ENV"
- name: Install Haxe
uses: funkincrew/ci-haxe@v3.1.0
with:
haxe-version: ${{ inputs.haxe }}
- name: Install native dependencies
if: ${{ runner.os == 'Linux' }}
shell: bash
run: |
ls -lah /usr/lib/x86_64-linux-gnu/
apt-get update
apt-get install -y \
g++ \
libx11-dev libxi-dev libxext-dev libxinerama-dev libxrandr-dev \
libgl-dev libgl1-mesa-dev \
libasound2-dev
ln -s /usr/lib/x86_64-linux-gnu/libffi.so.8 /usr/lib/x86_64-linux-gnu/libffi.so.6 || true
- name: Install linux-specific dependencies
if: ${{ runner.os == 'Linux' && contains(inputs.targets, 'linux') }}
shell: bash
run: |
apt-get install -y libvlc-dev libvlccore-dev
- name: Config haxelib
shell: bash
run: |
echo "TIMER_HAXELIB=$(date +%s)" >> "$GITHUB_ENV"
haxelib --debug --never install haxelib 4.1.0 --global
haxelib --debug --never deleterepo || true
haxelib --debug --never newrepo
echo "HAXEPATH=$(haxelib config)" >> "$GITHUB_ENV"
haxelib --debug --never git haxelib https://github.com/HaxeFoundation/haxelib.git master
haxelib --debug --global install hmm
echo "TIMER_DEPS=$(date +%s)" >> "$GITHUB_ENV"
- name: Restore cached dependencies
id: cache-hmm
uses: actions/cache@v4
with:
path: .haxelib
key: haxe-hmm-${{ runner.os }}-${{ hashFiles('**/hmm.json') }}
- if: ${{ steps.cache-hmm.outputs.cache-hit != 'true' }}
name: Install dependencies
shell: bash
run: |
git config --global --unset 'url.https://x-access-token:${{ inputs.gh-token }}@github.com/.insteadOf' || true
git config --global 'url.https://x-access-token:${{ inputs.gh-token }}@github.com/.insteadOf' https://github.com/
haxelib --global run hmm install -q
git config --global --unset 'url.https://x-access-token:${{ inputs.gh-token }}@github.com/.insteadOf'
echo "TIMER_DONE=$(date +%s)" >> "$GITHUB_ENV"
# by default use a shared hxcpp cache
- if: ${{ inputs.hxcpp-cache == 'true' }}
name: Restore hxcpp cache
uses: actions/cache@v4
with:
path: ${{ inputs.hxcpp-cache-path }}
key: haxe-hxcpp-${{ runner.os }}-${{ github.ref_name }}-${{ github.sha }}
restore-keys: haxe-hxcpp-${{ runner.os }}-${{ github.ref_name }}
# export env for it to reuse in builds
- if: ${{ inputs.hxcpp-cache == 'true' }}
name: Persist env for hxcpp cache
shell: bash
run: |
echo "HXCPP_COMPILE_CACHE=${{ inputs.hxcpp-cache-path }}" >> "$GITHUB_ENV"
echo 'HXCPP_CACHE_MB="4096"' >> "$GITHUB_ENV"
# if it's explicitly disabled, still cache export/ since that then contains the builds
- if: ${{ inputs.hxcpp-cache != 'true' }}
name: Restore export cache
uses: actions/cache@v4
with:
path: ${{ inputs.hxcpp-cache-path }}
key: haxe-export-${{ runner.os }}-${{ github.ref_name }}-${{ github.sha }}
restore-keys: haxe-export-${{ runner.os }}-${{ github.ref_name }}
- name: Print debug info
shell: bash
run: |
cat << EOF
runner:
kernel: $(uname -a)
haxe:
version: $(haxe -version)
which: $(which haxe)
haxepath: $HAXEPATH
took: $((TIMER_HAXELIB - TIMER_HAXE))s
haxelib:
version: $(haxelib version)
which: $(which haxelib)
local:
config: $(haxelib config)
path: $(haxelib path haxelib || true)
global
config: $(haxelib config --global)
path: $(haxelib path haxelib --global || true)
system
version: $(haxelib --system version)
local:
config: $(haxelib --system config)
global:
config: $(haxelib --system config --global)
took: $((TIMER_DEPS - TIMER_HAXELIB))s
deps:
took: $((TIMER_DONE - TIMER_DEPS))s
hxcpp_cache: |
$(haxelib run hxcpp cache list || true)
EOF