Funkin/.github/actions/setup-haxe/action.yml
Hazel 7644ce1019 feat: ci parallelization, linux builds, ci refactoring (#484)
* first linux build attempt

* linux deps!

* hxcodec dependencies

* build timeouts

* reup hxcpp cache every time

by default gh actions will not update caches on cache hit.
since the hxcpp cache grows with compiles, that's not what we want here.
since we *do* need the files newly compiled.

* ci speed test

* group runners by purpose

* REFACTOR CI. IT WAS NEEDED

* smol changies

* second attempt at libc

* fix any format issues

* it's 1:50am

* migrate away from gacts/run-and-post-run@v1

* apt does not have a stable cli interface. use with caution in scripts

* first attempt at libffi6

* second attempt at libffi6

* fuck that

* sigh

* html5 also needs new libc

* make sure rerunning ln -s doesn't fail the build

* desperate attempt

* arc attempt

* arc, ii

* ci

* apt-GET

* who needs safeguards anyway

* clean ci build

* debug time

* lots of connectivity debugging

* 🥺

* natesales/q

* i'm not very smart

* debug hard?

* whose traceroute?

* pls

* ...

* we go even newer

* merge moment

* haxelib maybe

* debug info

* 🥺

* lower mtu runner?

* libffi my beloved

* no multiline env?

* smol buggy

* non docker-aware vars

* i love bash

* builds hopefully go nyoom

* forgor native dep

* [skip ci] meow

* convenient typo

* sigh

* [skip ci] waow

* [skip ci] docker is hard

* i don't understand docker tbh

* debuggering

* docking

* small amount of dumb but still doesn't explain why curl doesn't curl

* just vsc things

* ca certs issue?

* please this has to be the one

* find -type d fail, laugh at this user

* too eepy

* im not that smart am i

* attempt to run containerized from docker base image

* [skip-ci] some more docking

* might as well try

* :pleaading_face:

* ?

* !

* idea

* sigh

* i give in

* aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

* 🥺

* hopefully fix hxcpp cache

* [skip ci] a little dx never hurt anyone

* try removing things until it breaks

* welp that was easy

* not-docker-friendly paths in non-docker env, etc. you get the point

* more sane default cache size

* finishing touches

* welp

* mounted volume

* no systemd, got it

* more failproof dockerfile

* does this not have ossh

* haxelib master

* hopefully final docker build

* bob the builder

* docking :3

* image cleanup

* github moment

* okay mayb

* gotta set it up first

* i have an idea

* hope we ready

* 🥺

* fuck

* sigh

* trigger build on new image

* no comment

* global hxcpp, first idea

* yikes

* hxcpp oopsy

* code dupe

* more code dupe

* lint

* increase hxcpp cache size on native builds as well

* buttons :3

* oops

* forgor to export env variable

* aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
2024-04-14 17:49:41 -04:00

135 lines
4.2 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
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: |
haxelib --debug --global run hmm install
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