Skip to content

src: Remove trailing spaces #610

src: Remove trailing spaces

src: Remove trailing spaces #610

Workflow file for this run

# https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-syntax-for-github-actions
name: Build
on:
push:
pull_request:
workflow_dispatch:
# https://github.blog/changelog/2020-07-06-github-actions-manual-triggers-with-workflow_dispatch/
defaults:
run:
shell: bash
jobs:
###########################################################
build:
###########################################################
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
target: [linux, darwin, windows]
architecture: [32, 64, arm64]
build_system: [make, cmake, vs2019]
include:
- target: linux
runner: ubuntu-20.04
haxe_nightly_dir: linux64
archive_ext: tar.gz
- target: darwin
haxe_nightly_dir: mac
archive_ext: tar.gz
- target: darwin
architecture: 64
runner: macos-12
- target: darwin
architecture: arm64
runner: macos-14
- build_system: cmake
cmake_configuration: RelWithDebInfo
- build_system: vs2019
msbuild_configuration: Release
- target: windows
runner: windows-2019 # has VS2019 preinstalled which supports PlatformToolset <= v142, WindowsTargetPlatformVersion 10
haxe_nightly_dir: windows64
archive_ext: zip
- target: windows
build_system: cmake
cmake_generator: Visual Studio 16 2019
- target: windows
architecture: 32
ffmpeg_url: https://github.com/HaxeFoundation/hashlink/files/5648055/ffmpeg-3.4.2-win32-dev.zip
architecture_string: Win32
- target: windows
architecture: 64
ffmpeg_url: https://github.com/HaxeFoundation/hashlink/files/5648056/ffmpeg-3.4.2-win64-dev.zip
architecture_string: x64
exclude:
- target: linux
build_system: vs2019
- target: darwin
build_system: vs2019
- target: linux
architecture: 32
- target: darwin
architecture: 32
- target: linux
architecture: arm64
- target: windows
architecture: arm64
- target: windows
build_system: make
- target: windows
architecture: 32
build_system: cmake
steps:
- name: "SCM Checkout"
uses: actions/checkout@v4
- name: "Add msbuild to PATH"
if: matrix.build_system == 'vs2019'
uses: microsoft/setup-msbuild@v2
with:
vs-version: '[16.0,17.0)'
- name: "Mac homebrew workaround"
if: matrix.target == 'darwin'
run: |
# see https://github.com/Homebrew/homebrew-core/issues/165793#issuecomment-1989441193
# see https://github.com/Homebrew/brew/blob/master/.github/workflows/tests.yml
brew unlink python && brew link --overwrite python
- name: "Install: Required Dev Packages"
run: |
set -eux
case "${{ matrix.target }}${{ matrix.architecture }}" in
linux64)
echo "MARCH=64" >> $GITHUB_ENV
sudo apt-get update -y
sudo apt-get install --no-install-recommends -y \
libmbedtls-dev \
libopenal-dev \
libpng-dev \
libsdl2-dev \
libturbojpeg-dev \
libuv1-dev \
libvorbis-dev \
libsqlite3-dev
;;
darwin*)
brew update
brew bundle
;;
windows*)
curl -fsSL --retry 3 --retry-delay 5 -o /tmp/sdl.zip https://www.libsdl.org/release/SDL2-devel-2.30.2-VC.zip
curl -fsSL --retry 3 --retry-delay 5 -o /tmp/openal.zip https://github.com/kcat/openal-soft/releases/download/1.23.1/openal-soft-1.23.1-bin.zip
curl -fsSL --retry 3 --retry-delay 5 -o /tmp/ffmpeg.zip ${{ matrix.ffmpeg_url }}
7z x /tmp/sdl.zip -oinclude; mv include/SDL2* include/sdl
7z x /tmp/openal.zip -oinclude; mv include/openal* include/openal
7z x /tmp/ffmpeg.zip -oinclude; mv include/ffmpeg* include/ffmpeg
;;
esac
- name: Install haxe
uses: krdlab/setup-haxe@f0a0baa8ccdb1fe4fc316c8f30eb3ca77aa4ea4e
with:
haxe-version: latest
- name: "Configure: Haxelib"
run: |
set -eux
haxelib setup ~/haxelib
haxelib install hashlink
haxelib list
- name: "Build: HashLink"
run: |
set -eux
case "${{ matrix.build_system }}" in
cmake)
case "${{ matrix.target }}${{ matrix.architecture }}" in
windows*)
cmake . -DCMAKE_BUILD_TYPE=${{ matrix.cmake_configuration }} \
-G "${{ matrix.cmake_generator }}" \
-A ${{ matrix.architecture_string }}
;;
*)
cmake . -DCMAKE_BUILD_TYPE=${{ matrix.cmake_configuration }} ;;
esac
cmake --build . --config ${{ matrix.cmake_configuration }}
BUILD_FOLDER=bin
;;
vs2019)
MSBuild.exe hl.sln //nologo //m //clp:ErrorsOnly \
//p:Configuration=${{ matrix.msbuild_configuration }} \
//p:Platform=${{ matrix.architecture_string }}
case "${{ matrix.architecture }}" in
64) BUILD_FOLDER=x64/${{ matrix.msbuild_configuration }} ;;
32) BUILD_FOLDER=${{ matrix.msbuild_configuration }} ;;
esac
echo "WINDOWS_BUILD_FOLDER=$BUILD_FOLDER" >> $GITHUB_ENV
;;
make)
make
sudo make install
if [[ ${{ matrix.target }} == linux ]]; then
sudo ldconfig
fi
BUILD_FOLDER=.
;;
esac
ls -l $BUILD_FOLDER
- name: "Test"
run: |
set -eux
case "${{ matrix.build_system }}" in
cmake)
ctest --verbose --build-config ${{ matrix.cmake_configuration }}
;;
vs2019)
${{ env.WINDOWS_BUILD_FOLDER }}/hl.exe --version
;;
make)
if [[ ${{ matrix.architecture }} != arm64 ]]; then
./hl --version
case ${{ matrix.target }} in
linux) ldd -v ./hl ;;
darwin) otool -L ./hl ;;
esac
haxe -hl hello.hl -cp other/tests -main HelloWorld -D interp
./hl hello.hl
# ensure the executable still works when installed globally
cp hello.hl /tmp
pushd /tmp
hl hello.hl
popd
fi
haxe -hl src/_main.c -cp other/tests -main HelloWorld
make hlc
./hlc
;;
esac
- name: "Package"
run: |
set -eux
case "${{ matrix.target }}${{matrix.architecture}}" in
darwinarm64) platform_name=darwin-arm64 ;;
darwin64) platform_name=darwin ;;
windows*) platform_name=win${{matrix.architecture}} ;;
linux64) platform_name=linux-amd64 ;;
esac
short_commit=$(git rev-parse --short HEAD)
case "${{ matrix.build_system }}" in
cmake)
dist_folder=hashlink-${short_commit}-${platform_name}-cmake
cpack -D CPACK_PACKAGE_FILE_NAME=$dist_folder -C ${{ matrix.cmake_configuration }}
echo "HASHLINK_DISTRIBUTION=bin/$dist_folder.${{ matrix.archive_ext }}" >> $GITHUB_ENV
;;
*)
dist_folder=hashlink-${short_commit}-${platform_name}
make PACKAGE_NAME=$dist_folder MARCH=${{ matrix.architecture }} release
echo "HASHLINK_DISTRIBUTION=$dist_folder.${{ matrix.archive_ext }}" >> $GITHUB_ENV
;;
esac
- name: "Share: build artifact"
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.target }}-${{ matrix.build_system }}-${{ matrix.architecture }}
path: ${{ env.HASHLINK_DISTRIBUTION }}
###########################################################
publish-latest-release:
###########################################################
runs-on: ubuntu-latest
needs:
- build
if: github.ref == 'refs/heads/master'
concurrency: publish-latest-release # https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idconcurrency
steps:
- name: "SCM Checkout"
uses: actions/checkout@v4
- name: "Get: all build artifacts"
uses: actions/download-artifact@v4
- name: "Delete previous 'latest' release"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -eu
gh release delete latest --cleanup-tag --yes || true
- name: "Create 'latest' Release"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -eux
# https://hub.github.com/hub-release.1.html
short_commit=$(git rev-parse --short HEAD)
gh release create latest \
--prerelease \
--title "HashLink Nightly Build" \
"darwin-make-64/hashlink-${short_commit}-darwin.tar.gz#hashlink-latest-darwin.tar.gz" \
"darwin-make-arm64/hashlink-${short_commit}-darwin-arm64.tar.gz#hashlink-latest-darwin-arm64.tar.gz" \
"linux-make-64/hashlink-${short_commit}-linux-amd64.tar.gz#hashlink-latest-linux-amd64.tar.gz" \
"windows-vs2019-32/hashlink-${short_commit}-win32.zip#hashlink-latest-win32.zip" \
"windows-vs2019-64/hashlink-${short_commit}-win64.zip#hashlink-latest-win64.zip"