fix(deps): bump actions/download-artifact from 3 to 4 #417
Workflow file for this run
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
# 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] | |
build_system: [make, cmake, vs2019] | |
include: | |
- target: linux | |
runner: ubuntu-20.04 | |
haxe_nightly_dir: linux64 | |
archive_ext: tar.gz | |
- target: darwin | |
runner: macos-12 | |
haxe_nightly_dir: mac | |
archive_ext: tar.gz | |
- 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: windows | |
build_system: make | |
steps: | |
- name: "SCM Checkout" | |
uses: actions/checkout@v4 | |
- name: Add msbuild to PATH | |
if: matrix.build_system == 'vs2019' | |
uses: microsoft/setup-msbuild@v1 | |
with: | |
vs-version: '[16.0,17.0)' | |
- 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 list --formula | xargs brew uninstall --force --ignore-dependencies | |
brew list --cask | xargs brew uninstall --force --ignore-dependencies | |
brew update | |
brew bundle | |
brew link mbedtls@2 --force # needed for CMake | |
;; | |
windows*) | |
curl -fsSL --retry 3 --retry-delay 5 -o /tmp/sdl.zip https://www.libsdl.org/release/SDL2-devel-2.0.5-VC.zip | |
curl -fsSL --retry 3 --retry-delay 5 -o /tmp/openal.zip https://openal-soft.org/openal-binaries/openal-soft-1.17.2-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: Neko" | |
run: | | |
set -eux | |
case "${{ matrix.target }}" in | |
linux) | |
sudo apt-get install --no-install-recommends -y neko | |
;; | |
darwin) | |
brew install neko | |
;; | |
windows) | |
choco install --no-progress neko -y | |
nekopath=$(find C:/ProgramData/chocolatey/lib/neko -name neko.dll -printf '%h\n') | |
echo "NEKOPATH=$nekopath" >> $GITHUB_ENV | |
;; | |
esac | |
neko || true # print neko version | |
- name: "Install: Haxe latest" | |
run: | | |
set -eux | |
download_url="https://build.haxe.org/builds/haxe/${{ matrix.haxe_nightly_dir }}/haxe_latest.${{ matrix.archive_ext }}" | |
echo "Downloading [$download_url]..." | |
if [[ ${{ matrix.target }} == windows ]]; then | |
curl -fsSL --retry 3 --retry-delay 5 "$download_url" -o /tmp/haxe.zip | |
7z x /tmp/haxe.zip -o/tmp | |
mv -v /tmp/haxe_* /tmp/haxe | |
cygpath -w '/tmp/haxe/' >> $GITHUB_PATH | |
echo "HAXE_STD_PATH=$(cygpath -w '/tmp/haxe/std')" >> $GITHUB_ENV | |
else | |
mkdir /tmp/haxe | |
curl -fsSL --retry 3 --retry-delay 5 "$download_url" -o /tmp/haxe.tar.gz | |
tar xzvf /tmp/haxe.tar.gz -C /tmp/haxe --strip-components=1 | |
echo "/tmp/haxe/" >> $GITHUB_PATH | |
echo "HAXE_STD_PATH=/tmp/haxe/std" >> $GITHUB_ENV | |
fi | |
/tmp/haxe/haxe --version | |
- 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) | |
./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 | |
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 | |
darwin*) 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@v3 | |
with: | |
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" | |
run: | | |
set -eu | |
api_base_url="$GITHUB_API_URL/repos/$GITHUB_REPOSITORY" | |
# delete 'latest' github release | |
release_id=$(curl -fsL -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/$GITHUB_REPOSITORY/releases | jq -r '.[] | select(.tag_name == "latest") | .id') | |
if [[ -n $release_id ]]; then | |
echo "Deleting release [$api_base_url/releases/$release_id]..." | |
curl -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -fsSL -X DELETE "$api_base_url/releases/$release_id" | |
fi | |
# delete 'latest' git tag | |
tag_url="$api_base_url/git/refs/tags/latest" | |
if curl -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -fsLo /dev/null --head "$tag_url"; then | |
echo "Deleting tag [$tag_url]..." | |
curl -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -fsSL -X DELETE "$tag_url" | |
fi | |
- 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" \ | |
"artifact/hashlink-${short_commit}-darwin.tar.gz#hashlink-latest-darwin.tar.gz" \ | |
"artifact/hashlink-${short_commit}-linux-amd64.tar.gz#hashlink-latest-linux-amd64.tar.gz" \ | |
"artifact/hashlink-${short_commit}-win32.zip#hashlink-latest-win32.zip" \ | |
"artifact/hashlink-${short_commit}-win64.zip#hashlink-latest-win64.zip" |