Mirror for Friday Night Funkin
1name: setup-haxeshit
2description: "sets up haxe shit, using HMM!"
3
4inputs:
5 haxe:
6 description: 'Version of haxe to install'
7 required: true
8 default: '4.3.6'
9 hxcpp-cache:
10 description: 'Whether to use a shared hxcpp compile cache'
11 required: true
12 default: 'true'
13 hxcpp-cache-path:
14 description: 'Path to create hxcpp cache in'
15 required: true
16 default: ${{ runner.temp }}/hxcpp_cache
17 targets:
18 description: 'Targets we plan to compile to. Installs native dependencies needed.'
19 required: true
20 gh-token:
21 description: 'GitHub secret for private repos as dependencies'
22
23runs:
24 using: "composite"
25 steps:
26
27 - name: Setup timers
28 shell: bash
29 run: |
30 echo "TIMER_HAXE=$(date +%s)" >> "$GITHUB_ENV"
31
32 - name: Install Haxe
33 uses: funkincrew/ci-haxe@v3.2.7
34 with:
35 haxe-version: ${{ inputs.haxe }}
36
37 - name: Install native dependencies
38 if: ${{ runner.os == 'Linux' }}
39 shell: bash
40 run: |
41 ls -lah /usr/lib/x86_64-linux-gnu/
42 apt-get update
43 apt-get install -y \
44 g++ \
45 libx11-dev libxi-dev libxext-dev libxinerama-dev libxrandr-dev \
46 libgl-dev libgl1-mesa-dev \
47 libasound2-dev libpulse-dev
48 ln -s /usr/lib/x86_64-linux-gnu/libffi.so.8 /usr/lib/x86_64-linux-gnu/libffi.so.6 || true
49 - name: Install linux-specific dependencies
50 if: ${{ runner.os == 'Linux' && contains(inputs.targets, 'linux') }}
51 shell: bash
52 run: |
53 apt-get install -y libvlc-dev libvlccore-dev
54
55 - name: Config haxelib
56 shell: bash
57 run: |
58 echo "TIMER_HAXELIB=$(date +%s)" >> "$GITHUB_ENV"
59 haxelib fixrepo --global || true
60 haxelib --debug --never --global install haxelib 4.1.0
61 haxelib --debug --global set haxelib 4.1.0
62 haxelib --global remove haxelib git || true
63 haxelib --global remove hmm || true
64 rm -rf .haxelib
65 haxelib --debug --never --global git haxelib https://github.com/FunkinCrew/haxelib.git funkin-patches --skip-dependencies
66 haxelib --debug --never --global git hmm https://github.com/FunkinCrew/hmm funkin-patches
67 haxelib --debug --never newrepo
68 haxelib version
69 echo "HAXEPATH=$(haxelib config)" >> "$GITHUB_ENV"
70 echo "TIMER_DEPS=$(date +%s)" >> "$GITHUB_ENV"
71
72 - name: Restore cached dependencies
73 id: cache-hmm
74 uses: actions/cache@v4
75 with:
76 path: .haxelib
77 key: haxe-hmm-${{ runner.os }}-${{ hashFiles('**/hmm.json') }}
78
79 - if: ${{ steps.cache-hmm.outputs.cache-hit != 'true' }}
80 name: Prep git for dependency install
81 uses: gacts/run-and-post-run@v1
82 with:
83 run: |
84 git config --global --name-only --get-regexp 'url\.https\:\/\/x-access-token:.+@github\.com\/\.insteadOf' \
85 | xargs -I {} git config --global --unset {}
86
87 git config -l --show-scope --show-origin
88 git config --global 'url.https://x-access-token:${{ inputs.gh-token }}@github.com/.insteadOf' https://github.com/
89 post: git config --global --unset 'url.https://x-access-token:${{ inputs.gh-token }}@github.com/.insteadOf'
90
91 - if: ${{ steps.cache-hmm.outputs.cache-hit != 'true' }}
92 name: Install dependencies
93 shell: bash
94 run: |
95 haxelib --global run hmm install -q
96 echo "TIMER_DONE=$(date +%s)" >> "$GITHUB_ENV"
97
98 # by default use a shared hxcpp cache
99 - if: ${{ inputs.hxcpp-cache == 'true' }}
100 name: Restore hxcpp cache
101 uses: actions/cache@v4
102 with:
103 path: ${{ inputs.hxcpp-cache-path }}
104 key: haxe-hxcpp-${{ runner.os }}-${{ github.ref_name }}-${{ github.sha }}
105 restore-keys: haxe-hxcpp-${{ runner.os }}-${{ github.ref_name }}
106 # export env for it to reuse in builds
107 - if: ${{ inputs.hxcpp-cache == 'true' }}
108 name: Persist env for hxcpp cache
109 shell: bash
110 run: |
111 echo "HXCPP_COMPILE_CACHE=${{ inputs.hxcpp-cache-path }}" >> "$GITHUB_ENV"
112 echo 'HXCPP_CACHE_MB="4096"' >> "$GITHUB_ENV"
113
114 # if it's explicitly disabled, still cache export/ since that then contains the builds
115 - if: ${{ inputs.hxcpp-cache != 'true' }}
116 name: Restore export cache
117 uses: actions/cache@v4
118 with:
119 path: ${{ inputs.hxcpp-cache-path }}
120 key: haxe-export-${{ runner.os }}-${{ github.ref_name }}-${{ github.sha }}
121 restore-keys: haxe-export-${{ runner.os }}-${{ github.ref_name }}
122
123 - name: Print debug info
124 shell: bash
125 run: |
126 cat << EOF
127 runner:
128 kernel: $(uname -a)
129 haxe:
130 version: $(haxe -version)
131 which: $(which haxe)
132 haxepath: $HAXEPATH
133 took: $((TIMER_HAXELIB - TIMER_HAXE))s
134 haxelib:
135 version: $(haxelib version)
136 which: $(which haxelib)
137 local:
138 config: $(haxelib config)
139 path: $(haxelib path haxelib || true)
140 global
141 config: $(haxelib config --global)
142 path: $(haxelib path haxelib --global || true)
143 system
144 version: $(haxelib --system version)
145 local:
146 config: $(haxelib --system config)
147 global:
148 config: $(haxelib --system config --global)
149 took: $((TIMER_DEPS - TIMER_HAXELIB))s
150 deps:
151 took: $((TIMER_DONE - TIMER_DEPS))s
152 hxcpp_cache: |
153 $(haxelib run hxcpp cache list || true)
154 EOF