Update Bison directives to current syntax #311
This file contains hidden or 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
| name: GNU Legacy Toolchain CI | |
| on: | |
| workflow_dispatch: | |
| schedule: | |
| # Following POSIX cron syntax, run every Monday morning at 5:30 AM UTC | |
| # https://pubs.opengroup.org/onlinepubs/9699919799/utilities/crontab.html#tag_20_25_07 | |
| - cron: '30 5 * * 1' | |
| push: | |
| # branches: [ master ] | |
| pull_request: | |
| # branches: [ master ] | |
| env: | |
| # Debian package search: https://www.debian.org/distrib/packages | |
| UBUNTU_BUILD_DEPENDS: git-restore-mtime autoconf autopoint automake m4 make binutils gcc g++ gobjc gcc-multilib bison flex libtool gawk gettext texinfo file libisl-dev dejagnu stow | |
| UBUNTU_GCC4_BUILD_DEPENDS: libglib2.0-dev libgmp-dev libmpfr-dev libmpc-dev zip unzip mono-runtime libmono-2.0-dev | |
| # after adding i386 multiarch via `sudo dpkg --add-architecture i386` | |
| UBUNTU_MULTIARCH_i386_BUILD_DEPENDS: libc6:i386 libc6-dev:i386 linux-libc-dev:i386 | |
| # RPM package search: https://rpm.pbone.net/search_simple_2 | |
| # openSUSE package-only (no content) search: https://software.opensuse.org/ | |
| # NOTE: openSUSE appears to lack a package for git-restore-mtime, so this will need to be installed manually | |
| openSUSE_BUILD_DEPENDS: autoconf gettext-tools automake m4 make binutils gcc gcc-c++ gcc-objc glibc-devel glibc-devel-32bit bison flex libtool gawk gettext-runtime texinfo file libisl23 dejagnu stow | |
| openSUSE_GCC4_BUILD_DEPENDS: mono-core libmono-2_0-devel glib2-devel glibc-devel gmp-devel mpfr-devel mpc-devel | |
| # libisl23, which is a version-specific package of ISL, appeasrs to be included as a dependency of other package(s) | |
| # Cygwin package search: https://cygwin.com/packages/ | |
| # Cygwin package list: https://cygwin.com/packages/package_list.html | |
| # Cygwin-official Action: https://github.com/marketplace/actions/install-cygwin-action | |
| CYGWIN_BUILD_DEPENDS: autoconf automake m4 make binutils gcc-core gcc-g++ gcc-objc bison flex libtool gawk gettext gettext-devel gettext-debuginfo texinfo file libisl-devel libncurses-devel dejagnu stow tree | |
| CYGWIN_GCC44_BUILD_DEPENDS: libglib2.0-devel libgmp-devel libmpfr-devel libmpc-devel zip unzip | |
| # Cygwin lacks packages for Mono, so the "gcc44" toolchain set is unsupported unless Mono is built and installed manually | |
| CYGWIN_GCC44_MISSING_DEPENDS: mono-runtime libmono-2.0-devel | |
| # If these older source package releases will not build without disabling Fortify and/or run without buffer overflow errors, | |
| # then "make CPPFLAGS=-U_FORTIFY_SOURCE" might be necessary | |
| # Passing that to this older configure might not work, as should otherwise seem doable per | |
| # the link https://www.gnu.org/software/automake/manual/html_node/Flag-Variables-Ordering.html | |
| BUILD_DIR: build | |
| OUTPUT_DIR: outputs | |
| SYSROOT_DIR: sysroot | |
| # Prevent the Cygwin profile script from doing an automatic `cd ${HOME}` | |
| CHERE_INVOKING: 1 | |
| CYGWIN: winsymlinks:native | |
| # Common arguments for `make all` | |
| # * Add "--keep-going" to apply this flag to the "make all" commands | |
| COMMON_MAKE_ALL_ARGS: --output-sync=target | |
| defaults: | |
| run: | |
| shell: bash | |
| jobs: | |
| build_toolchain_job: | |
| name: ${{ matrix.toolchain-set }} targeting ${{ matrix.target-system }} on ${{ matrix.os }}-${{ matrix.platform }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ "ubuntu-latest", "windows-latest" ] | |
| platform: [ "x86_64", "x86" ] | |
| target-system: [ "h8300-hitachi-coff" ] | |
| toolchain-set: [ "binutils216", "gdb5", "gcc3", "gdb5,gcc3", "gcc44", "gdb5,gcc3,gcc44", ] | |
| exclude: | |
| - os: ubuntu-latest | |
| platform: x86 | |
| - os: windows-latest | |
| toolchain-set: gcc44 | |
| - os: windows-latest | |
| toolchain-set: gdb5,gcc3,gcc44 | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - name: Get latest from version control | |
| uses: actions/checkout@v6 | |
| with: | |
| # git-restore-mtime-bare uses the ref log to find the correct timestamp | |
| # for each file. This requires a full git history. The default value (1) | |
| # creates a shallow checkout. | |
| fetch-depth: 0 | |
| # Fix timestamps (needed to prevent some files from attempting to regenerate and failing during build). | |
| # While a GitHub Action is available, as a reference for those who might be replicating this build locally, | |
| # we will install its Debian package and use the script included in this repository | |
| # that runs this Git command directly. | |
| # NOTE: The "fix-mtime" script takes a really long time under Cygwin, | |
| # so we will bypass that part of the build and execute this action instead. | |
| - name: Restore source timestamps | |
| if: runner.os == 'Windows' | |
| uses: chetan/git-restore-mtime-action@v2 | |
| - name: Update build environment | |
| if: contains(matrix.os, 'ubuntu') | |
| run: sudo apt-get --assume-yes update | |
| - name: Install build dependencies | |
| if: contains(matrix.os, 'ubuntu') | |
| run: sudo apt-get --assume-yes install $UBUNTU_BUILD_DEPENDS $UBUNTU_GCC4_BUILD_DEPENDS | |
| # Cygwin action docs – https://github.com/marketplace/actions/install-cygwin-action | |
| - name: Setup Cygwin Environment | |
| if: runner.os == 'Windows' | |
| uses: cygwin/cygwin-install-action@v6 | |
| with: | |
| platform: ${{ matrix.platform }} | |
| packages: ${{ env.CYGWIN_BUILD_DEPENDS }} | |
| # Fix timestamps (needed to prevent some files from attempting to regenerate and failing during build) | |
| # While a GitHub Action is available, use the Git command directly | |
| # as a reference for those who might be replicating this build locally | |
| # NOTE: This step takes a really long time under Cygwin, | |
| # so we will bypass this when on Windows and use the available GitHub action instead. | |
| - name: Fix source timestamps | |
| if: runner.os != 'Windows' | |
| run: ./fix-mtime | |
| - name: Setup the build and output directories | |
| run: mkdir -p $BUILD_DIR $OUTPUT_DIR | |
| # Run the build steps | |
| - name: Configure the build | |
| run: cd $BUILD_DIR && echo "Current working directory is '$PWD'" && ../sym-combined/${{ matrix.target-system }}-configure --prefix=$(realpath -L -s ../$SYSROOT_DIR) --toolchain-sets=${{ matrix.toolchain-set }} | |
| # Execute the build. For the jobs arg, use a POSIX-standard version of `nproc`. | |
| - name: Execute the build | |
| run: cd $BUILD_DIR && echo "Current working directory is '$PWD'" && make $COMMON_MAKE_ALL_ARGS --jobs=$(getconf _NPROCESSORS_ONLN) | |
| # Test the completed build | |
| - name: Test install the new build to a sysroot | |
| run: cd $BUILD_DIR && echo "Current working directory is '$PWD'" && make install | |
| - name: List the files installed to the sysroot | |
| run: tree --dirsfirst "$(realpath -s "$SYSROOT_DIR")" | |
| # Post the build output as an artifact | |
| # Before archiving, tar the host installation output to preserve file permission | |
| # c.f. https://github.com/actions/upload-artifact?tab=readme-ov-file#permission-loss | |
| # To avoid including a "." or other unwanted directory, c.f. https://stackoverflow.com/a/39530409 | |
| - name: Tar the host installation snapshot to preserve file permissions | |
| run: find $SYSROOT_DIR -printf "%P\n" | sort | tar --verbose --create --file $OUTPUT_DIR/[${{ matrix.os }}-${{ matrix.platform }}]_${{ matrix.target-system }}-${{ matrix.toolchain-set }}.tar --no-recursion --directory=$SYSROOT_DIR --files-from=- | |
| - name: Archive the host installation snapshot tar file | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| name: "[${{ matrix.os }}-${{ matrix.platform }}]_${{ matrix.target-system }}-${{ matrix.toolchain-set }}_${{ github.run_id }}.${{ github.run_number }}.${{ github.run_attempt }}" | |
| path: "${{ env.OUTPUT_DIR }}/[${{ matrix.os }}-${{ matrix.platform }}]_${{ matrix.target-system }}-${{ matrix.toolchain-set }}.tar" | |
| - name: Install the new build using Stow | |
| if: runner.os != 'Windows' | |
| run: cd $BUILD_DIR && echo "Current working directory is '$PWD'" && sudo make stow | |
| - name: Check always if any version-controlled files were modified | |
| if: always() && runner.os != 'Windows' | |
| run: git status | |
| - name: Show always any diffs of version-controlled files | |
| if: always() && runner.os != 'Windows' | |
| run: git diff | |
| # For quicker continuous integration feedback, run just the RCX-configured build as a job | |
| build_cross_RCX_job: | |
| name: Build GCC v3 w/GDB v5 for the RCX on ${{ matrix.os }} | |
| env: | |
| Toolchain: gdb5,gcc3 | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| os: [ ubuntu-latest ] | |
| steps: | |
| - name: Get latest from version control | |
| uses: actions/checkout@v6 | |
| with: | |
| # git-restore-mtime-bare uses the ref log to find the correct timestamp | |
| # for each file. This requires a full git history. The default value (1) | |
| # creates a shallow checkout. | |
| fetch-depth: 0 | |
| - name: Update build environment | |
| run: sudo apt-get --assume-yes update | |
| - name: Install build dependencies | |
| run: sudo apt-get --assume-yes install $UBUNTU_BUILD_DEPENDS | |
| # Fix timestamps (needed to prevent some files from attempting to regenerate and failing during build) | |
| - name: Restore source timestamps | |
| run: ./fix-mtime | |
| - name: Setup the build directory | |
| run: mkdir -p $BUILD_DIR $OUTPUT_DIR | |
| # Run the build steps | |
| - name: Configure the build | |
| run: | | |
| cd $BUILD_DIR | |
| echo "Current working directory: $PWD" | |
| ../sym-combined/rcx-lego-configure --prefix=$(realpath -L -s ../$SYSROOT_DIR) | |
| # Execute the build. For the jobs arg, use a POSIX-standard version of `nproc`. | |
| - name: Execute the build | |
| run: | | |
| cd $BUILD_DIR | |
| echo "Current working directory: $PWD" | |
| make $COMMON_MAKE_ALL_ARGS --jobs=$(getconf _NPROCESSORS_ONLN) all | |
| # Test install the completed build | |
| - name: Test install the new build to a sysroot | |
| run: | | |
| cd $BUILD_DIR | |
| echo "Current working directory is '$PWD'" | |
| make install | |
| - name: List the files installed to the sysroot | |
| run: tree --dirsfirst "$(realpath -s "$SYSROOT_DIR")" | |
| # Post the build output as an artifact | |
| # Before archiving, tar the host installation output to preserve file permission | |
| # c.f. https://github.com/actions/upload-artifact?tab=readme-ov-file#permission-loss | |
| # To avoid including a "." or other unwanted directory, c.f. https://stackoverflow.com/a/39530409 | |
| - name: Tar the host installation snapshot to preserve file permissions | |
| run: find $SYSROOT_DIR -printf "%P\n" | sort | tar --verbose --create --file $OUTPUT_DIR/RCX_${{ matrix.os }}.tar --no-recursion --directory=$SYSROOT_DIR --files-from=- | |
| - name: Archive the host installation snapshot tar file | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| name: "RCX_${{ matrix.os }}_${{ github.run_id }}.${{ github.run_number }}.${{ github.run_attempt }}" | |
| path: "${{ env.OUTPUT_DIR }}/RCX_${{ matrix.os }}.tar" | |
| - name: Install the new build using Stow | |
| run: | | |
| cd $BUILD_DIR | |
| echo "Current working directory is '$PWD'" | |
| sudo make stow | |
| - name: Check always if any version-controlled files were modified | |
| run: git status | |
| - name: Show always any diffs of version-controlled files | |
| run: git diff | |
| # build_native_job: | |
| # name: Build a native compiler (non-cross-compiling) | |
| # runs-on: ${{ matrix.os }} | |
| # strategy: | |
| # matrix: | |
| # os: [ ubuntu-latest ] | |
| # | |
| # steps: | |
| # - name: Get latest from version control | |
| # uses: actions/checkout@v6 | |
| # with: | |
| # # git-restore-mtime-bare uses the ref log to find the correct timestamp | |
| # # for each file. This requires a full git history. The default value (1) | |
| # # creates a shallow checkout. | |
| # fetch-depth: 0 | |
| # | |
| # - name: Update build environment | |
| # run: sudo apt-get --assume-yes update | |
| # | |
| # - name: Install build dependencies | |
| # run: sudo apt-get --assume-yes install $UBUNTU_BUILD_DEPENDS $UBUNTU_GCC4_BUILD_DEPENDS | |
| # | |
| # # Fix timestamps (needed to prevent some files from attempting to regenerate and failing during build) | |
| # - name: Restore source timestamps | |
| # run: ./fix-mtime | |
| # | |
| # - name: Setup the build directory | |
| # run: mkdir -p $BUILD_DIR_TOOLCHAIN | |
| # | |
| # - name: Configure the build | |
| # run: | | |
| # cd $BUILD_DIR_TOOLCHAIN | |
| # echo "Current working directory: $PWD" | |
| # ../../sym-combined/native-configure --prefix=$GITHUB_WORKSPACE/$SYSROOT_DIR | |
| # | |
| # - name: Execute the build | |
| # run: | | |
| # cd $BUILD_DIR_TOOLCHAIN | |
| # echo "Current working directory: $PWD" | |
| # make --keep-going | |
| # | |
| # - name: Test install the new build to a sysroot | |
| # run: | | |
| # cd $BUILD_DIR_TOOLCHAIN | |
| # echo "Current working directory: $PWD" | |
| # make DESTDIR=$GITHUB_WORKSPACE/$SYSROOT_DIR install | |
| # | |
| # # Before archiving, tar the host installation output to preserve file permission | |
| # # c.f. https://github.com/actions/upload-artifact?tab=readme-ov-file#permission-loss | |
| # # To avoid including a "." or other unwanted directory, c.f. https://stackoverflow.com/a/39530409 | |
| # - name: Tar the host installation snapshot to preserve file permissions | |
| # run: find $SYSROOT_DIR -printf "%P\n" | sort | tar --verbose --create --file build/native-gpc_install.tar --no-recursion --directory=$SYSROOT_DIR --files-from=- | |
| # | |
| # - name: Archive the host installation snapshot tar file | |
| # uses: actions/upload-artifact@v6 | |
| # with: | |
| # name: native-gpc_install_[runner~${{ matrix.os }}]_run${{ github.run_id }}.${{ github.run_number }}.${{ github.run_attempt }} | |
| # path: build/native-gpc_install.tar | |
| # | |
| # - name: Install the new build | |
| # run: | | |
| # cd $BUILD_DIR_TOOLCHAIN | |
| # echo "Current working directory: $PWD" | |
| # sudo make install |