Bump gcarreno/setup-lazarus from 3.2.17 to 3.3.1 #31
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
# ---------------------------------------------------------------------------- | |
# GitHub Action workflow to build FPC to be bundled with CGE downloads | |
# on https://castle-engine.io/download . | |
# | |
# See https://docs.github.com/en/actions for docs. | |
# ---------------------------------------------------------------------------- | |
name: Build | |
# workflow_dispatch allows to call it manually | |
# See https://docs.github.com/en/actions/using-workflows/manually-running-a-workflow | |
on: [push, pull_request, workflow_dispatch] | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
build: | |
name: Build | |
strategy: | |
matrix: | |
# For macOS: | |
# - Old note: Using macos-12, not macos-latest, for Intel mac. | |
# - TODO: "ld: library not found for -lc", | |
# see solutions on https://forum.lazarus.freepascal.org/index.php?topic=61430.15 | |
# - For now, in the end: using self-hosted macos_x64 for Intel mac. | |
runner: [ubuntu-latest, windows-latest, macos_x64, raspberry_pi_64, raspberry_pi_32] | |
include: | |
# Set matrix.is_unix, makes if conditions easier. | |
- is_unix: false | |
- runner: ubuntu-latest | |
is_unix: true | |
- runner: macos_x64 | |
is_unix: true | |
- runner: raspberry_pi_64 | |
is_unix: true | |
- runner: raspberry_pi_32 | |
is_unix: true | |
# Set matrix.needs_fpc_fixes_branch, when you need FPC 3.2.3 (fixes_3_2 branch) | |
- needs_fpc_fixes_branch: false | |
- runner: raspberry_pi_64 | |
needs_fpc_fixes_branch: true | |
runs-on: ${{ matrix.runner }} | |
steps: | |
- uses: actions/checkout@v4 | |
# Get last stable FPC to bootstrap | |
- name: Install FPC+Lazarus | |
if: ${{ matrix.runner == 'windows-latest' || matrix.runner == 'ubuntu-latest' }} | |
uses: gcarreno/[email protected] | |
with: | |
lazarus-version: stable | |
- name: Set environment FPC_BRANCHTAG (!needs_fpc_fixes_branch) | |
if : ${{ ! matrix.needs_fpc_fixes_branch }} | |
run: echo FPC_BRANCHTAG='release_3_2_2' >> $GITHUB_ENV | |
- name: Set environment FPC_BRANCHTAG (needs_fpc_fixes_branch) | |
if : ${{ matrix.needs_fpc_fixes_branch }} | |
run: echo FPC_BRANCHTAG='fixes_3_2' >> $GITHUB_ENV | |
- name: Set environment FPC_VERSION (!needs_fpc_fixes_branch) | |
if : ${{ ! matrix.needs_fpc_fixes_branch }} | |
run: echo FPC_VERSION='3.2.2' >> $GITHUB_ENV | |
- name: Set environment FPC_VERSION (needs_fpc_fixes_branch) | |
if : ${{ matrix.needs_fpc_fixes_branch }} | |
run: echo FPC_VERSION='3.2.3' >> $GITHUB_ENV | |
- name: Set environment FPC_OS | |
run: echo "FPC_OS="`fpc -iTO` >> $GITHUB_ENV | |
- name: Set environment FPC_CPU | |
run: echo "FPC_CPU="`fpc -iTP` >> $GITHUB_ENV | |
- name: Cleanup | |
run: | | |
rm -Rf fpcsrc/ fpc/ fpc-*.zip | |
mkdir -p fpc/ | |
- name: Get FPC sources | |
run: git clone https://gitlab.com/freepascal.org/fpc/source.git --depth 1 --single-branch --branch "${FPC_BRANCHTAG}" fpcsrc | |
- name: Determine bootstrap FPC | |
run: | | |
case $FPC_CPU in | |
x86_64) PPC_NAME=ppcx64 ;; | |
i386) PPC_NAME=ppc386 ;; | |
aarch64) PPC_NAME=ppca64 ;; | |
arm) PPC_NAME=ppcarm ;; | |
# More possible: ppc68k ppcppc ppcsparc ppcarmeb ppcppc64 ppcmips ppcmipsel ppcavr ppcjvm ppc8086 ppcsparc64 | |
*) PPC_NAME=ppc-unknown-name ;; | |
esac | |
echo "For this CPU, the FPC ppcxxx binary is called ${PPC_NAME}" | |
if [ -f "bootstrap-fpc/3.2.2/${PPC_NAME}" ]; then | |
# TODO: For unknown reason, providing FPC=... doesn't work, it's not used by make. | |
# It still complains that we try to build 3.2.2 with 3.2.3, despite we provide FPC=... with 3.2.2. | |
# BOOTSTRAP_FPC=FPC=`pwd`/bootstrap-fpc/3.2.2/${PPC_NAME} | |
BOOTSTRAP_FPC=OVERRIDEVERSIONCHECK=1 | |
echo "BOOTSTRAP_FPC=${BOOTSTRAP_FPC}" >> $GITHUB_ENV | |
echo "Using precompiled FPC for bootstrap: ${BOOTSTRAP_FPC}" | |
fi | |
- name: Determine FPC options | |
if : ${{ matrix.runner == 'macos_x64' }} | |
run: | | |
# Following FpcUpDeluxe: | |
# MacOS 10.14 Mojave and newer have libs and tools in new, yet non-standard directory | |
echo FPC_OPTS='-XR/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -Fl/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib -FD/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin' >> $GITHUB_ENV | |
- name: Build and install FPC | |
run: | | |
cd fpcsrc/ | |
echo "Bootstrap FPC: ${BOOTSTRAP_FPC}" | |
echo "Executing: " make clean all install INSTALL_PREFIX="${GITHUB_WORKSPACE}"/fpc ${BOOTSTRAP_FPC} OPT="${FPC_OPTS}" | |
make clean all install INSTALL_PREFIX="${GITHUB_WORKSPACE}"/fpc ${BOOTSTRAP_FPC} OPT="${FPC_OPTS}" | |
# TODO: enable this | |
# but it makes CGE pack_release job fail with "out of disk space" -- indeed FPC zips are larger. | |
# We need to have some way to auto-download FPC cross-compilers, | |
# to not include them in the CGE release. | |
# | |
# - name: Add cross-compiler to Win64 | |
# if: ${{ matrix.runner != 'windows-latest' }} | |
# run: | | |
# cd fpcsrc/ | |
# make crossall crossinstall OS_TARGET=win64 CPU_TARGET=x86_64 INSTALL_PREFIX="${GITHUB_WORKSPACE}"/fpc OPT="${FPC_OPTS}" | |
# TODO: test and enable | |
# - name: Add cross-compiler to macOS/Aarch64 | |
# if: ${{ matrix.runner == 'macos_x64' }} | |
# run: | | |
# cd fpcsrc/ | |
# make crossall crossinstall OS_TARGET=darwin CPU_TARGET=aarch64 INSTALL_PREFIX="${GITHUB_WORKSPACE}"/fpc OPT="${FPC_OPTS}" | |
- name: (Post install) Make layout simple | |
if: ${{ matrix.is_unix }} | |
run: | | |
# Put ppc* (including and ppcross*), like ppcx64, in fpc/bin/, so that main fpc binary can find it easily | |
mv -f fpc/lib/fpc/"${FPC_VERSION}"/ppc* \ | |
fpc/bin/ | |
# Put units/ as subdirectory of main fpc/ -- this makes it simpler to refer to, and consistent with Windows layout | |
mv -f fpc/lib/fpc/"${FPC_VERSION}"/units fpc/ | |
- name: (Post install) Flatten fpc/bin | |
if: ${{ matrix.runner == 'windows-latest' }} | |
run: | | |
mv -f fpc/bin/x86_64-win64/* fpc/bin/ | |
# Remove empty unneeded dir | |
rm -R fpc/bin/x86_64-win64/ | |
- name: Sources to fpc/src | |
# See https://stackoverflow.com/questions/160608/do-a-git-export-like-svn-export | |
# This way we only copy to fpc/src files from repo (not any compiled stuff, | |
# and "make clean" doesn't really clean everything; and not .git subdir). | |
run: | | |
cd fpcsrc/ | |
mkdir ../fpc/src | |
git archive HEAD | tar -x -C ../fpc/src | |
- name: Archive (zip) | |
if: ${{ matrix.runner != 'windows-latest' }} | |
run: zip -r fpc-${FPC_OS}-${FPC_CPU}.zip fpc/ | |
# Use 7z on Windows to make zip, as it's preinstalled on GH hosted Windows. | |
# ( We could alternatively install zip, e.g. using Chocolatey, | |
# or use PowerShell | |
# "run: Compress-Archive -Path folder/ -Destination new.zip" | |
# see https://stackoverflow.com/questions/74939762/create-zip-file-of-github-reporitory-using-a-workflow-which-runs-on-windows-lat ) | |
- name: Archive (7z) | |
if: ${{ matrix.runner == 'windows-latest' }} | |
run: 7z a fpc-${FPC_OS}-${FPC_CPU}.zip fpc/ | |
# No need for artifacts actually? This job just updates GH release "snapshot", | |
# and other things (like CGE build with bundled FPC) can just download it. | |
# - name: Archive Artifacts | |
# uses: actions/upload-artifact@v4 | |
# with: | |
# name: fpc-${{ env.FPC_OS }}-${{ env.FPC_CPU }}-release | |
# path: "fpc-*.zip" | |
# if-no-files-found: error | |
- name: Release Artifacts | |
if: ${{ github.ref == 'refs/heads/master' }} | |
run: gh release --repo castle-engine/cge-fpc upload snapshot --clobber fpc-*.zip | |
env: | |
GH_TOKEN: ${{ github.token }} |