[CI] simplify CI and fix build #692
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.uint.cloudmunity/t/github-actions-does-not-respect-skip-ci/17325/8) | |
name: CI | |
on: [push, pull_request] | |
jobs: | |
linux-build: | |
runs-on: ubuntu-20.04 | |
env: | |
PLATFORM: linux64 | |
OPAMYES: 1 | |
strategy: | |
fail-fast: false | |
matrix: | |
ocaml: ["4.08.1"] | |
# ocaml: ["4.08.1", "5.0.0"] | |
steps: | |
- uses: actions/checkout@main | |
with: | |
submodules: recursive | |
- name: Cache opam | |
id: cache-opam | |
uses: actions/cache@v3.0.11 | |
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/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/*.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 | |
opam config exec -- make -s haxelib | |
make -s package_unix | |
ls -l out | |
ldd -v ./haxe | |
ldd -v ./haxelib | |
# https://stackoverflow.com/questions/58033366/how-to-get-current-branch-within-github-actions | |
- name: Extract branch name | |
id: extract_branch | |
shell: bash | |
run: echo "branch=${GITHUB_REF#refs/heads/}" >> $GITHUB_OUTPUT | |
- name: Build xmldoc | |
if: matrix.ocaml == '4.08.1' | |
run: | | |
set -ex | |
make -s xmldoc | |
cat >extra/doc/info.json <<EOL | |
{ | |
"commit": "$GITHUB_SHA", | |
"branch": "${{ steps.extract_branch.outputs.branch }}" | |
} | |
EOL | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: linuxBinaries${{ (matrix.ocaml == '5.0.0' && '_ocaml5') || '' }} | |
path: out | |
- name: Upload xmldoc artifact | |
uses: actions/upload-artifact@v4 | |
if: matrix.ocaml == '4.08.1' | |
with: | |
name: xmldoc | |
path: extra/doc |