Rebuild the GitHub workflow #76
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
# DO NOT EDIT. Generated from /extra/github-actions | |
# TODO: support skip ci (https://github.community/t/github-actions-does-not-respect-skip-ci/17325/8) | |
name: CI | |
on: [push, pull_request] | |
jobs: | |
windows64-build: | |
runs-on: windows-latest | |
env: | |
ACTIONS_ALLOW_UNSECURE_COMMANDS: true | |
PLATFORM: windows64 | |
ARCH: 64 | |
MINGW_ARCH: x86_64 | |
CYG_ROOT: D:\cygwin | |
steps: | |
- uses: actions/checkout@main | |
with: | |
submodules: recursive | |
- name: Use GNU Tar from msys | |
run: | | |
echo "C:\msys64\usr\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append | |
rm C:\msys64\usr\bin\bash.exe | |
- name: choco install nsis | |
uses: nick-invision/retry@v3 | |
with: | |
timeout_minutes: 10 | |
max_attempts: 10 | |
command: choco install --no-progress nsis.portable --version 3.09 -y | |
- name: choco install things | |
shell: pwsh | |
run: choco install --no-progress curl wget 7zip.portable -y | |
- name: Prepend Chocolatey path | |
shell: pwsh | |
run: Write-Host "::add-path::C:\ProgramData\chocolatey\bin" | |
- name: Install Neko from S3 | |
shell: pwsh | |
run: | | |
Invoke-WebRequest https://build.haxe.org/builds/neko/$env:PLATFORM/neko_latest.zip -OutFile $env:RUNNER_TEMP/neko_latest.zip | |
Expand-Archive $env:RUNNER_TEMP/neko_latest.zip -DestinationPath $env:RUNNER_TEMP | |
$NEKOPATH = Get-ChildItem $env:RUNNER_TEMP/neko-*-* | |
echo "$NEKOPATH" >> $env:GITHUB_PATH | |
echo "NEKOPATH=$NEKOPATH" >> $env:GITHUB_ENV | |
- name: Print Neko version | |
run: neko -version 2>&1 | |
- name: Setup ocaml | |
uses: ocaml/setup-ocaml@v2 | |
with: | |
ocaml-compiler: 4.08.1 | |
opam-repositories: | | |
opam-repository-mingw: https://github.com/ocaml-opam/opam-repository-mingw.git#sunset | |
default: https://github.com/ocaml/opam-repository.git | |
opam-local-packages: | | |
haxe.opam | |
- name: Install dependencies | |
shell: pwsh | |
run: | | |
Set-PSDebug -Trace 1 | |
curl.exe -fsSL -o "libmbedtls.tar.xz" --retry 3 https://github.com/Simn/mingw64-mbedtls/releases/download/2.16.3/mingw64-$($env:MINGW_ARCH)-mbedtls-2.16.3-1.tar.xz | |
& "$($env:CYG_ROOT)/bin/bash.exe" @('-lc', 'curl -L https://cpanmin.us | perl - App::cpanminus') | |
& "$($env:CYG_ROOT)/bin/bash.exe" @('-lc', 'cpanm IPC::System::Simple module') | |
& "$($env:CYG_ROOT)/bin/bash.exe" @('-lc', 'cpanm String::ShellQuote') | |
& "$($env:CYG_ROOT)/bin/bash.exe" @('-lc', 'echo "$OLDPWD"') | |
& "$($env:CYG_ROOT)/bin/bash.exe" @('-lc', 'cd "$OLDPWD" && tar -C / -xvf libmbedtls.tar.xz') | |
- name: Install OCaml libraries | |
shell: pwsh | |
run: | | |
Set-PSDebug -Trace 1 | |
opam install haxe --deps-only | |
opam list | |
- name: Expose mingw dll files | |
shell: pwsh | |
run: Write-Host "::add-path::${env:CYG_ROOT}/usr/$($env:MINGW_ARCH)-w64-mingw32/sys-root/mingw/bin" | |
# required to be able to retrieve the revision | |
- name: Mark directory as safe | |
shell: pwsh | |
run: | | |
Set-PSDebug -Trace 1 | |
& "$($env:CYG_ROOT)/bin/bash.exe" @('-lc', 'git config --global --add safe.directory "$OLDPWD"') | |
- name: Set ADD_REVISION=1 for non-release | |
if: ${{ !startsWith(github.ref, 'refs/tags/') }} | |
shell: pwsh | |
run: echo "ADD_REVISION=1" >> $Env:GITHUB_ENV | |
- name: Build Haxe | |
shell: pwsh | |
run: | | |
Set-PSDebug -Trace 1 | |
git config --global --add safe.directory /cygdrive/d/a/haxe/haxe | |
& "$($env:CYG_ROOT)/bin/bash.exe" @('-lc', 'cd "$OLDPWD" && opam config exec -- make -s -f Makefile.win -j`nproc` haxe 2>&1') | |
& "$($env:CYG_ROOT)/bin/bash.exe" @('-lc', 'cd "$OLDPWD" && cygcheck ./haxe.exe') | |
- name: Get KhaTools_windows_x64 | |
run: git clone https://github.com/Kode/KhaTools_windows_x64.git | |
- name: Copy binary | |
run: copy haxe.exe KhaTools_windows_x64\haxe.exe | |
- name: Copy new std | |
continue-on-error: true | |
run: robocopy std KhaTools_windows_x64\std /mir | |
- name: Set name | |
run: git config --global user.name "Robbot" | |
- name: Set email | |
run: git config --global user.email "robbot2019@robdangero.us" | |
- name: Add everything | |
run: git -C KhaTools_windows_x64 add . | |
- name: Commit binary | |
id: commit | |
continue-on-error: true | |
run: git -C KhaTools_windows_x64 commit -a -m "Update Haxe binary to ${env:GITHUB_SHA}." | |
- name: Tag binary | |
id: tag | |
continue-on-error: true | |
if: steps.commit.outcome == 'success' | |
run: git -C KhaTools_windows_x64 tag haxe_${env:GITHUB_SHA} | |
- name: Push binary | |
id: push1 | |
if: steps.commit.outcome == 'success' && steps.tag.outcome == 'success' | |
continue-on-error: true | |
run: git -C KhaTools_windows_x64 push https://Kode-Robbot:${env:ROBBOT_PASS}@github.com/Kode/KhaTools_windows_x64.git main --tags | |
env: | |
ROBBOT_PASS: ${{ secrets.ROBBOT_PASS }} | |
- name: Pull | |
if: steps.commit.outcome == 'success' && steps.tag.outcome == 'success' && steps.push1.outcome != 'success' | |
run: git -C KhaTools_windows_x64 pull --no-rebase | |
- name: Push binary again | |
if: steps.commit.outcome == 'success' && steps.tag.outcome == 'success' && steps.push1.outcome != 'success' | |
continue-on-error: true | |
run: git -C KhaTools_windows_x64 push https://Kode-Robbot:${env:ROBBOT_PASS}@github.com/Kode/KhaTools_windows_x64.git main --tags | |
env: | |
ROBBOT_PASS: ${{ secrets.ROBBOT_PASS }} | |
linux-build: | |
runs-on: ubuntu-20.04 | |
env: | |
PLATFORM: linux64 | |
OPAMYES: 1 | |
strategy: | |
fail-fast: false | |
matrix: | |
ocaml: ["4.08.1"] | |
steps: | |
- uses: actions/checkout@main | |
with: | |
submodules: recursive | |
- name: Cache opam | |
id: cache-opam | |
uses: actions/cache@v4 | |
with: | |
path: ~/.opam/ | |
key: ${{ runner.os }}-${{ matrix.ocaml }}-${{ hashFiles('./haxe.opam', './libs/') }} | |
- name: Install Neko from S3 | |
run: | | |
set -ex | |
curl -sSL https://build.haxe.org/builds/neko/$PLATFORM/neko_latest.tar.gz -o $RUNNER_TEMP/neko_latest.tar.gz | |
tar -xf $RUNNER_TEMP/neko_latest.tar.gz -C $RUNNER_TEMP | |
NEKOPATH=`echo $RUNNER_TEMP/neko-*-*` | |
sudo mkdir -p /usr/local/bin | |
sudo mkdir -p /usr/local/include | |
sudo mkdir -p /usr/local/lib/neko | |
sudo ln -s $NEKOPATH/{neko,nekoc,nekoml,nekotools} /usr/local/bin/ | |
sudo ln -s $NEKOPATH/libneko.* /usr/local/lib/ | |
sudo ln -s $NEKOPATH/include/* /usr/local/include/ | |
sudo ln -s $NEKOPATH/*.ndll /usr/local/lib/neko/ | |
echo "NEKOPATH=$NEKOPATH" >> $GITHUB_ENV | |
- name: Print Neko version | |
run: neko -version 2>&1 | |
- name: Install dependencies | |
run: | | |
set -ex | |
sudo add-apt-repository ppa:avsm/ppa -y # provides OPAM 2 | |
sudo add-apt-repository ppa:haxe/ocaml -y # provides newer version of mbedtls | |
sudo apt-get update -qqy | |
sudo apt-get install -qqy ocaml-nox camlp5 opam libpcre2-dev zlib1g-dev libgtk2.0-dev libmbedtls-dev ninja-build libstring-shellquote-perl libipc-system-simple-perl | |
- name: Install OCaml libraries | |
if: steps.cache-opam.outputs.cache-hit != 'true' | |
run: | | |
set -ex | |
opam init # --disable-sandboxing | |
opam update | |
opam switch create ${{ matrix.ocaml }} | |
opam pin add haxe . --no-action | |
opam install haxe --deps-only --assume-depexts | |
opam list | |
ocamlopt -v | |
- name: Set ADD_REVISION=1 for non-release | |
if: ${{ !startsWith(github.ref, 'refs/tags/') }} | |
run: echo "ADD_REVISION=1" >> $GITHUB_ENV | |
- name: Build Haxe | |
run: | | |
set -ex | |
eval $(opam env) | |
opam config exec -- make -s -j`nproc` STATICLINK=1 haxe | |
make -s package_unix | |
ls -l out | |
ldd -v ./haxe | |
- name: Get KhaTools_linux_x64 | |
run: git clone https://github.com/Kode/KhaTools_linux_x64.git | |
- name: Copy binary | |
run: cp ./haxe KhaTools_linux_x64/haxe | |
- name: Remove old std | |
run: rm -r KhaTools_linux_x64/std | |
- name: Copy new std | |
run: cp -R std KhaTools_linux_x64/std | |
- name: Set name | |
run: git config --global user.name "Robbot" | |
- name: Set email | |
run: git config --global user.email "robbot2019@robdangero.us" | |
- name: Add everything | |
run: git -C KhaTools_linux_x64 add . | |
- name: Commit binary | |
id: commit | |
continue-on-error: true | |
run: git -C KhaTools_linux_x64 commit -a -m "Update Haxe binary to $GITHUB_SHA." | |
- name: Tag binary | |
if: steps.commit.outcome == 'success' | |
run: git -C KhaTools_linux_x64 tag haxe_$GITHUB_SHA | |
- name: Push binary | |
id: push1 | |
if: steps.commit.outcome == 'success' | |
continue-on-error: true | |
run: git -C KhaTools_linux_x64 push https://Kode-Robbot:$ROBBOT_PASS@github.com/Kode/KhaTools_linux_x64.git main --tags | |
env: | |
ROBBOT_PASS: ${{ secrets.ROBBOT_PASS }} | |
- name: Pull | |
if: steps.commit.outcome == 'success' && steps.push1.outcome != 'success' | |
run: git -C KhaTools_linux_x64 pull --no-rebase | |
- name: Push binary again | |
if: steps.commit.outcome == 'success' && steps.push1.outcome != 'success' | |
continue-on-error: true | |
run: git -C KhaTools_linux_x64 push https://Kode-Robbot:$ROBBOT_PASS@github.com/Kode/KhaTools_linux_x64.git main --tags | |
env: | |
ROBBOT_PASS: ${{ secrets.ROBBOT_PASS }} | |
linux-arm64: | |
runs-on: ubuntu-20.04 | |
permissions: | |
packages: write | |
env: | |
FORCE_COLOR: 1 | |
steps: | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Install Earthly | |
run: sudo /bin/sh -c 'wget https://github.com/earthly/earthly/releases/download/v0.6.13/earthly-linux-amd64 -O /usr/local/bin/earthly && chmod +x /usr/local/bin/earthly && /usr/local/bin/earthly bootstrap --with-autocomplete' | |
- name: Set up QEMU | |
id: qemu | |
uses: docker/setup-qemu-action@v3 | |
with: | |
image: tonistiigi/binfmt:latest | |
platforms: all | |
- uses: actions/checkout@main | |
with: | |
submodules: recursive | |
- name: Set CONTAINER_ vars | |
run: | | |
echo "CONTAINER_REG=$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV; | |
echo "CONTAINER_TAG=$(echo ${{ github.ref_name }} | sed -e 's/[^A-Za-z0-9\.]/-/g')" >> $GITHUB_ENV; | |
- name: Build devcontainer | |
run: earthly --platform=linux/arm64 +devcontainer --IMAGE_NAME="ghcr.io/${CONTAINER_REG}_devcontainer" --IMAGE_TAG="${CONTAINER_TAG}-arm64" --IMAGE_CACHE="ghcr.io/haxefoundation/haxe_devcontainer:development-arm64" | |
env: | |
EARTHLY_PUSH: "${{ github.event_name == 'push' }}" | |
EARTHLY_USE_INLINE_CACHE: true | |
EARTHLY_SAVE_INLINE_CACHE: true | |
- name: Set ADD_REVISION=1 for non-release | |
if: ${{ !startsWith(github.ref, 'refs/tags/') }} | |
run: echo "ADD_REVISION=1" >> $GITHUB_ENV | |
- name: Build | |
run: earthly --platform=linux/arm64 +build --ADD_REVISION="$ADD_REVISION" --SET_SAFE_DIRECTORY="true" | |
env: | |
EARTHLY_PUSH: "${{ github.event_name == 'push' }}" | |
EARTHLY_REMOTE_CACHE: "ghcr.io/${{env.CONTAINER_REG}}_cache:build-${{env.CONTAINER_TAG}}-arm64" | |
- name: Get KhaTools_linux_arm64 | |
run: git clone https://github.com/Kode/KhaTools_linux_arm64.git | |
- name: Copy binary | |
run: cp ./out/linux/arm64/haxe KhaTools_linux_arm64/haxe | |
- name: Remove old std | |
run: rm -r KhaTools_linux_arm64/std | |
- name: Copy new std | |
run: cp -R std KhaTools_linux_arm64/std | |
- name: Set name | |
run: git config --global user.name "Robbot" | |
- name: Set email | |
run: git config --global user.email "robbot2019@robdangero.us" | |
- name: Add everything | |
run: git -C KhaTools_linux_arm64 add . | |
- name: Commit binary | |
id: commit | |
continue-on-error: true | |
run: git -C KhaTools_linux_arm64 commit -a -m "Update Haxe binary to $GITHUB_SHA." | |
- name: Tag binary | |
if: steps.commit.outcome == 'success' | |
run: git -C KhaTools_linux_arm64 tag haxe_$GITHUB_SHA | |
- name: Push binary | |
id: push1 | |
if: steps.commit.outcome == 'success' | |
continue-on-error: true | |
run: git -C KhaTools_linux_arm64 push https://Kode-Robbot:$ROBBOT_PASS@github.com/Kode/KhaTools_linux_arm64.git main --tags | |
env: | |
ROBBOT_PASS: ${{ secrets.ROBBOT_PASS }} | |
- name: Pull | |
if: steps.commit.outcome == 'success' && steps.push1.outcome != 'success' | |
run: git -C KhaTools_linux_arm64 pull --no-rebase | |
- name: Push binary again | |
if: steps.commit.outcome == 'success' && steps.push1.outcome != 'success' | |
continue-on-error: true | |
run: git -C KhaTools_linux_arm64 push https://Kode-Robbot:$ROBBOT_PASS@github.com/Kode/KhaTools_linux_arm64.git main --tags | |
env: | |
ROBBOT_PASS: ${{ secrets.ROBBOT_PASS }} | |
mac-build: | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [macos-14, macos-13] | |
runs-on: ${{ matrix.os }} | |
env: | |
PLATFORM: mac${{ matrix.os == 'macos-14' && '-arm64' || '' }} | |
OPAMYES: 1 | |
MACOSX_DEPLOYMENT_TARGET: 10.13 | |
OCAML_VERSION: 5.1.1 | |
CTYPES: 0.21.1 | |
steps: | |
- uses: actions/checkout@main | |
with: | |
submodules: recursive | |
- name: Cache opam | |
id: cache-opam | |
uses: actions/cache@v4 | |
with: | |
path: ~/.opam/ | |
key: ${{ matrix.os }}-${{ hashFiles('./haxe.opam', './libs/') }} | |
- name: Install Neko from S3 | |
run: | | |
set -ex | |
curl -sSL https://build.haxe.org/builds/neko/$PLATFORM/neko_latest.tar.gz -o $RUNNER_TEMP/neko_latest.tar.gz | |
tar -xf $RUNNER_TEMP/neko_latest.tar.gz -C $RUNNER_TEMP | |
NEKOPATH=`echo $RUNNER_TEMP/neko-*-*` | |
sudo mkdir -p /usr/local/bin | |
sudo mkdir -p /usr/local/include | |
sudo mkdir -p /usr/local/lib/neko | |
sudo ln -s $NEKOPATH/{neko,nekoc,nekoml,nekotools} /usr/local/bin/ | |
sudo ln -s $NEKOPATH/libneko.* /usr/local/lib/ | |
sudo ln -s $NEKOPATH/include/* /usr/local/include/ | |
sudo ln -s $NEKOPATH/*.ndll /usr/local/lib/neko/ | |
echo "NEKOPATH=$NEKOPATH" >> $GITHUB_ENV | |
- name: Print Neko version | |
run: neko -version 2>&1 | |
- name: Install dependencies | |
env: | |
# For compatibility with macOS 10.13 | |
ZLIB_VERSION: 1.3.1 | |
MBEDTLS_VERSION: 2.28.5 | |
PCRE2_VERSION: 10.42 | |
run: | | |
set -ex | |
brew update | |
brew bundle --file=tests/Brewfile --no-upgrade | |
cpanm IPC::System::Simple | |
cpanm String::ShellQuote | |
curl -L https://github.com/madler/zlib/releases/download/v$ZLIB_VERSION/zlib-$ZLIB_VERSION.tar.gz | tar xz | |
cd zlib-$ZLIB_VERSION | |
./configure | |
sudo make && sudo make install | |
cd .. | |
curl -L https://github.com/ARMmbed/mbedtls/archive/v$MBEDTLS_VERSION.tar.gz | tar xz | |
cd mbedtls-$MBEDTLS_VERSION | |
sudo make && sudo make install | |
cd .. | |
curl -L https://github.com/PCRE2Project/pcre2/releases/download/pcre2-$PCRE2_VERSION/pcre2-$PCRE2_VERSION.tar.gz | tar xz | |
cd pcre2-$PCRE2_VERSION | |
./configure --enable-unicode --enable-pcre2-8 --enable-pcre2-16 --enable-pcre2-32 --enable-unicode-properties --enable-pcre2grep-libz --enable-pcre2grep-libbz2 --enable-jit | |
sudo make && sudo make install | |
cd .. | |
- name: Install OCaml libraries | |
if: steps.cache-opam.outputs.cache-hit != 'true' | |
run: | | |
set -ex | |
opam init # --disable-sandboxing | |
opam update | |
opam switch create ${{env.OCAML_VERSION}} | |
eval $(opam env) | |
opam env | |
opam pin add ctypes ${{env.CTYPES}} --yes | |
opam pin add haxe . --no-action | |
opam install haxe --deps-only --assume-depexts | |
opam list | |
ocamlopt -v | |
- name: Set ADD_REVISION=1 for non-release | |
if: ${{ !startsWith(github.ref, 'refs/tags/') }} | |
run: echo "ADD_REVISION=1" >> $GITHUB_ENV | |
- name: Build Haxe | |
run: | | |
set -ex | |
eval $(opam env) | |
opam config exec -- make -s -j`sysctl -n hw.ncpu` STATICLINK=1 "LIB_PARAMS=/usr/local/lib/libz.a /usr/local/lib/libpcre2-8.a /usr/local/lib/libmbedtls.a /usr/local/lib/libmbedcrypto.a /usr/local/lib/libmbedx509.a -cclib '-framework Security -framework CoreFoundation'" haxe | |
otool -L ./haxe | |
- name: Get KhaTools_macos | |
run: git clone https://github.com/Kode/KhaTools_macos.git | |
- name: Copy binary | |
run: cp ./haxe KhaTools_macos/haxe | |
- name: Remove old std | |
run: rm -r KhaTools_macos/std | |
- name: Copy new std | |
run: cp -R std KhaTools_macos/std | |
- name: Set name | |
run: git config --global user.name "Robbot" | |
- name: Set email | |
run: git config --global user.email "robbot2019@robdangero.us" | |
- name: Add everything | |
run: git -C KhaTools_macos add . | |
- name: Commit binary | |
id: commit | |
continue-on-error: true | |
run: git -C KhaTools_macos commit -a -m "Update Haxe binary to $GITHUB_SHA." | |
- name: Tag binary | |
id: tag | |
continue-on-error: true | |
if: steps.commit.outcome == 'success' | |
run: git -C KhaTools_macos tag haxe_$GITHUB_SHA | |
- name: Push binary | |
id: push1 | |
if: steps.commit.outcome == 'success' && steps.tag.outcome == 'success' | |
continue-on-error: true | |
run: git -C KhaTools_macos push https://Kode-Robbot:$ROBBOT_PASS@github.com/Kode/KhaTools_macos.git main --tags | |
env: | |
ROBBOT_PASS: ${{ secrets.ROBBOT_PASS }} | |
- name: Pull | |
if: steps.commit.outcome == 'success' && steps.tag.outcome == 'success' && steps.push1.outcome != 'success' | |
run: git -C KhaTools_macos pull --no-rebase | |
- name: Push binary again | |
if: steps.commit.outcome == 'success' && steps.tag.outcome == 'success' && steps.push1.outcome != 'success' | |
continue-on-error: true | |
run: git -C KhaTools_macos push https://Kode-Robbot:$ROBBOT_PASS@github.com/Kode/KhaTools_macos.git main --tags | |
env: | |
ROBBOT_PASS: ${{ secrets.ROBBOT_PASS }} | |