feat(scripts): add initool-overwrite.*
scripts
#200
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
name: CI | |
on: [push, pull_request] | |
jobs: | |
linux: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install dependencies | |
run: sudo apt-get update && sudo apt-get install -y libgmp-dev | |
- name: Run CI script | |
run: ./linux-ci.sh | |
- name: Add artifact name to env | |
run: | | |
printf \ | |
'ARTIFACT_NAME=initool-v%s-%s-linux-%s\n' \ | |
"$(cat VERSION)" \ | |
"$(git rev-parse --short=7 HEAD)" \ | |
"$(uname -m)" \ | |
>>"$GITHUB_ENV" \ | |
; | |
- name: Upload Linux binary | |
uses: actions/upload-artifact@v4 | |
with: | |
name: '${{ env.ARTIFACT_NAME }}' | |
path: initool | |
macos: | |
runs-on: '${{ matrix.os }}' | |
strategy: | |
matrix: | |
os: ["macos-12", "macos-14"] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install dependencies | |
run: brew install dylibbundler mlton | |
- name: Build and test | |
run: | | |
make | |
- name: Bundle dynamic libraries | |
run: | | |
dylibbundler --bundle-deps --create-dir --fix-file initool | |
- name: Add artifact name to env | |
run: | | |
printf \ | |
'ARTIFACT_NAME=initool-v%s-%s-macos-%s-%s\n' \ | |
"$(cat VERSION)" \ | |
"$(git rev-parse --short=7 HEAD)" \ | |
"$(sw_vers | awk '/ProductVersion/ { print substr($2, 1, index($2, ".") - 1) }')" \ | |
"$(uname -m)" \ | |
>>"$GITHUB_ENV" \ | |
; | |
- name: Upload macOS binary | |
uses: actions/upload-artifact@v4 | |
with: | |
name: '${{ env.ARTIFACT_NAME }}' | |
path: | | |
initool | |
libs/ | |
windows: | |
runs-on: windows-latest | |
steps: | |
- name: 'Disable `autocrlf` in Git' | |
run: git config --global core.autocrlf false | |
- uses: actions/checkout@v4 | |
- name: Install MoSML | |
run: | | |
New-Item -ItemType Directory -Path C:\mosml -Force | |
Invoke-WebRequest -Uri https://dbohdan.com/dist/mosml-2.10.1-win32.7z -OutFile C:\mosml\mosml.7z | |
if ( | |
(Get-FileHash -Algorithm SHA256 C:\mosml\mosml.7z).Hash -ne "9FC6EA9DC6CCF0919B9801778572AF94E8BCDFDBB66CD0E235ED5A782D84F8B4" | |
) { | |
throw "Wrong checksum: mosml.7z" | |
} | |
7z x -oC:\mosml C:\mosml\mosml.7z | |
- name: Download busybox-w32 | |
run: | | |
Invoke-WebRequest -Uri https://dbohdan.com/dist/busybox-w32-FRP-5301-gda71f7c57.7z -OutFile busybox.7z | |
7z x -obusybox busybox.7z | |
New-Item -Path busybox.exe -ItemType SymbolicLink -Value busybox\busybox.exe | |
if ( | |
(Get-FileHash -Algorithm SHA256 busybox.exe).Hash -ne "DD6B2FC4D4809FF39F0E738C0DCB85624187ABF3E3239043BDD4E64BB4BA8EC3" | |
) { | |
throw "Wrong checksum: busybox.exe" | |
} | |
- name: Build initool | |
run: .\build.cmd /batch /package | |
- name: Run tests | |
run: .\test.cmd /batch | |
- name: Add artifact name to env | |
run: | | |
$artifact = Get-ChildItem -Filter *.zip | Select-Object -First 1 | |
Write-Output "ARTIFACT_NAME=$($artifact.Basename)" ` | |
| Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
7z x -y $artifact | |
- name: Upload Win32 binary | |
uses: actions/upload-artifact@v4 | |
with: | |
name: '${{ env.ARTIFACT_NAME }}' | |
path: | | |
camlrt.dll | |
initool.exe |