Build #1682
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: Build | |
| on: | |
| schedule: | |
| - cron: '0 6 * * *' | |
| workflow_dispatch: | |
| branches: | |
| - '**' | |
| permissions: write-all | |
| env: | |
| OBGGCC_BUILD_PARALLEL_LEVEL: 40 | |
| OBGGCC_BUILD_DIRECTORY: /tmp | |
| OBGGCC_RELEASE: '16' | |
| OBGGCC_TARGETS: '*' | |
| jobs: | |
| native-build: | |
| name: 'Native build' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@main | |
| with: | |
| submodules: true | |
| - name: Checkout submodules | |
| run: | | |
| git -C submodules/nz submodule update --init --depth=1 | |
| - name: Install required dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install build-essential autoconf libtool zsh | |
| - name: Check for cache | |
| id: check-cache | |
| uses: actions/cache@main | |
| with: | |
| key: 'cache-${{ env.OBGGCC_RELEASE }}' | |
| lookup-only: true | |
| path: | | |
| /tmp/x86_64-linux-gnu.tar.xz | |
| /tmp/x86_64-linux-gnu.tar.xz.sha256 | |
| - name: Build OBGGCC | |
| if: ${{ steps.check-cache.outputs.cache-hit != 'true' }} | |
| run: | | |
| if [ "${OBGGCC_RELEASE}" = '2.95' ]; then | |
| export OBGGCC_BUILD_PARALLEL_LEVEL='1' | |
| fi | |
| zsh './build.sh' | |
| - name: Generate tarball | |
| if: ${{ steps.check-cache.outputs.cache-hit != 'true' }} | |
| run: | | |
| declare tarball_filename='/tmp/x86_64-linux-gnu.tar.xz' | |
| tar --directory='/tmp' --create --file=- 'obggcc' | xz --threads='0' --extreme --memlimit-compress='100%' --compress -9 > "${tarball_filename}" | |
| sha256sum "${tarball_filename}" | sed 's|/tmp/||' > "${tarball_filename}.sha256" | |
| - name: Upload artifact | |
| if: ${{ steps.check-cache.outputs.cache-hit != 'true' }} | |
| uses: actions/upload-artifact@main | |
| with: | |
| name: native-toolchain | |
| if-no-files-found: error | |
| path: | | |
| /tmp/x86_64-linux-gnu.tar.xz | |
| /tmp/x86_64-linux-gnu.tar.xz.sha256 | |
| - name: Cache artifact | |
| if: ${{ steps.check-cache.outputs.cache-hit != 'true' }} | |
| uses: actions/cache@main | |
| with: | |
| key: 'cache-${{ env.OBGGCC_RELEASE }}' | |
| path: | | |
| /tmp/x86_64-linux-gnu.tar.xz | |
| /tmp/x86_64-linux-gnu.tar.xz.sha256 | |
| cross-build: | |
| name: 'Cross build' | |
| needs: native-build | |
| runs-on: ubuntu-latest | |
| continue-on-error: true | |
| strategy: | |
| matrix: | |
| target: [ | |
| # Windows | |
| 'x86_64-w64-mingw32', | |
| 'i686-w64-mingw32', | |
| # macOS | |
| 'aarch64-unknown-apple-darwin', | |
| 'x86_64-unknown-apple-darwin', | |
| # Linux (musl) | |
| 'aarch64-unknown-linux-musl', | |
| 'x86_64-unknown-linux-musl', | |
| 'armv6-unknown-linux-musleabihf', | |
| 'armv7-unknown-linux-musleabihf', | |
| 'i386-unknown-linux-musl', | |
| # Linux (glibc) | |
| 'x86_64-unknown-linux-gnu', | |
| 'i386-unknown-linux-gnu', | |
| 'arm-unknown-linux-gnueabi', | |
| 'arm-unknown-linux-gnueabihf', | |
| 'aarch64-unknown-linux-gnu', | |
| # FreeBSD | |
| 'x86_64-unknown-freebsd', | |
| 'aarch64-unknown-freebsd', | |
| 'i386-unknown-freebsd', | |
| # NetBSD | |
| 'i386-unknown-netbsdelf', | |
| 'x86_64-unknown-netbsd', | |
| # DragonFly BSD | |
| 'x86_64-unknown-dragonfly', | |
| # Android | |
| 'x86_64-unknown-linux-android', | |
| 'i686-unknown-linux-android21', | |
| 'aarch64-unknown-linux-android', | |
| 'armv7-unknown-linux-androideabi21', | |
| ] | |
| steps: | |
| - uses: actions/checkout@main | |
| with: | |
| submodules: true | |
| - name: Checkout submodules | |
| run: | | |
| git -C submodules/nz submodule update --init --depth=1 | |
| - name: Install required dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install build-essential autoconf libtool zsh | |
| - name: Restore from cache | |
| uses: actions/cache@main | |
| with: | |
| key: 'cache-${{ env.OBGGCC_RELEASE }}' | |
| fail-on-cache-miss: true | |
| path: | | |
| /tmp/x86_64-linux-gnu.tar.xz | |
| /tmp/x86_64-linux-gnu.tar.xz.sha256 | |
| - name: Setup toolchain | |
| run: | | |
| tar --directory='/tmp' --extract --file='/tmp/x86_64-linux-gnu.tar.xz' | |
| mv '/tmp/obggcc' '/tmp/obggcc-toolchain' | |
| - name: Cross-compile OBGGCC to ${{ matrix.target }} | |
| run: | | |
| source './tools/setup_toolchain.sh' | |
| wget 'https://github.com/AmanoTeam/musl-gcc-cross/releases/download/sysroot/x86_64-unknown-linux-musl.tar.xz' | |
| tar -xf 'x86_64-unknown-linux-musl.tar.xz' | |
| sudo ln -s "${PWD}/x86_64-unknown-linux-musl/lib/libc.so" '/lib/ld-musl-x86_64.so.1' | |
| if [[ '${{ matrix.target }}' = *'-linux-musl'* ]]; then | |
| declare -r RAIDEN_TAG='gcc-16' | |
| declare -r RAIDEN_TARBALL='/tmp/toolchain.tar.xz' | |
| declare -r RAIDEN_URL="https://github.com/AmanoTeam/musl-gcc-cross/releases/download/${RAIDEN_TAG}/x86_64-unknown-linux-gnu.tar.xz" | |
| curl --connect-timeout '10' --retry '15' --retry-all-errors --fail --silent --location --url "${RAIDEN_URL}" --output "${RAIDEN_TARBALL}" | |
| tar --directory="$(dirname "${RAIDEN_TARBALL}")" --extract --file="${RAIDEN_TARBALL}" | |
| export RAIDEN_HOME='/tmp/musl-gcc-cross' | |
| export PATH="${RAIDEN_HOME}/bin:${PATH}" | |
| source "${RAIDEN_HOME}/build/autotools/${{ matrix.target }}.sh" | |
| elif [[ '${{ matrix.target }}' = *'-linux-gnu'* ]]; then | |
| declare -r OBGGCC_TAG='gcc-16' | |
| declare -r OBGGCC_TARBALL='/tmp/toolchain.tar.xz' | |
| declare -r OBGGCC_URL="https://github.com/AmanoTeam/obggcc/releases/download/${OBGGCC_TAG}/x86_64-unknown-linux-musl.tar.xz" | |
| curl --connect-timeout '10' --retry '15' --retry-all-errors --fail --silent --location --url "${OBGGCC_URL}" --output "${OBGGCC_TARBALL}" | |
| tar --directory="$(dirname "${OBGGCC_TARBALL}")" --extract --file="${OBGGCC_TARBALL}" | |
| mv '/tmp/obggcc' '/tmp/obggcc-toolchain-bin' | |
| export OBGGCC_ARM_MODE='true' | |
| export OBGGCC_HOME='/tmp/obggcc-toolchain-bin' | |
| # export PATH="${OBGGCC_HOME}/bin:${PATH}" | |
| source "${OBGGCC_HOME}/build/autotools/${{ matrix.target }}.sh" | |
| elif [[ '${{ matrix.target }}' = *'-freebsd' ]]; then | |
| declare -r LOKI_TAG='gcc-16' | |
| declare -r LOKI_TARBALL='/tmp/toolchain.tar.xz' | |
| declare -r LOKI_URL="https://github.com/AmanoTeam/freebsd-gcc-cross/releases/download/${LOKI_TAG}/x86_64-unknown-linux-gnu.tar.xz" | |
| curl --silent --connect-timeout '10' --retry '15' --retry-all-errors --fail --location --url "${LOKI_URL}" --output "${LOKI_TARBALL}" | |
| tar --directory="$(dirname "${LOKI_TARBALL}")" --extract --file="${LOKI_TARBALL}" | |
| export LOKI_HOME='/tmp/freebsd-gcc-cross' | |
| export PATH="${LOKI_HOME}/bin:${PATH}" | |
| source "${LOKI_HOME}/build/autotools/${{ matrix.target }}.sh" | |
| elif [[ '${{ matrix.target }}' = *'-netbsd'* ]]; then | |
| declare -r DAKINI_TAG='gcc-16' | |
| declare -r DAKINI_TARBALL='/tmp/toolchain.tar.xz' | |
| declare -r DAKINI_URL="https://github.com/AmanoTeam/netbsd-gcc-cross/releases/download/${DAKINI_TAG}/x86_64-unknown-linux-gnu.tar.xz" | |
| curl --connect-timeout '10' --retry '15' --retry-all-errors --fail --silent --location --url "${DAKINI_URL}" --output "${DAKINI_TARBALL}" | |
| tar --directory="$(dirname "${DAKINI_TARBALL}")" --extract --file="${DAKINI_TARBALL}" | |
| export DAKINI_HOME='/tmp/netbsd-gcc-cross' | |
| export PATH="${DAKINI_HOME}/bin:${PATH}" | |
| source "${DAKINI_HOME}/build/autotools/${{ matrix.target }}.sh" | |
| elif [[ '${{ matrix.target }}' = *'-dragonfly' ]]; then | |
| declare -r VENTI_TAG='gcc-16' | |
| declare -r VENTI_TARBALL='/tmp/toolchain.tar.xz' | |
| declare -r VENTI_URL="https://github.com/AmanoTeam/dragonfly-gcc-cross/releases/download/${VENTI_TAG}/x86_64-unknown-linux-gnu.tar.xz" | |
| curl --connect-timeout '10' --retry '15' --retry-all-errors --fail --silent --location --url "${VENTI_URL}" --output "${VENTI_TARBALL}" | |
| tar --directory="$(dirname "${VENTI_TARBALL}")" --extract --file="${VENTI_TARBALL}" | |
| export VENTI_HOME='/tmp/dragonfly-gcc-cross' | |
| export PATH="${VENTI_HOME}/bin:${PATH}" | |
| source "${VENTI_HOME}/build/autotools/${{ matrix.target }}.sh" | |
| elif [[ '${{ matrix.target }}' = *'-android'* ]]; then | |
| declare -r PINO_TAG='gcc-16' | |
| declare -r PINO_TARBALL='/tmp/toolchain.tar.xz' | |
| declare -r PINO_URL="https://github.com/AmanoTeam/android-gcc-cross/releases/download/${PINO_TAG}/x86_64-unknown-linux-gnu.tar.xz" | |
| curl --connect-timeout '10' --retry '15' --retry-all-errors --fail --silent --location --url "${PINO_URL}" --output "${PINO_TARBALL}" | |
| tar --directory="$(dirname "${PINO_TARBALL}")" --extract --file="${PINO_TARBALL}" | |
| export PINO_HOME='/tmp/android-gcc-cross' | |
| export PATH="${PINO_HOME}/bin:${PATH}" | |
| source "${PINO_HOME}/build/autotools/${{ matrix.target }}.sh" | |
| elif [[ '${{ matrix.target }}' = *'-mingw32' ]]; then | |
| declare -r MINGW_TAG='gcc-16' | |
| declare -r MINGW_TARBALL='/tmp/toolchain.tar.xz' | |
| declare -r MINGW_URL="https://github.com/AmanoTeam/mingw-gcc-cross/releases/download/${MINGW_TAG}/x86_64-unknown-linux-gnu.tar.xz" | |
| curl --connect-timeout '10' --retry '15' --retry-all-errors --fail --silent --location --url "${MINGW_URL}" --output "${MINGW_TARBALL}" | |
| tar --directory="$(dirname "${MINGW_TARBALL}")" --extract --file="${MINGW_TARBALL}" | |
| export MINGW_HOME='/tmp/mingw-gcc-cross' | |
| export PATH="${MINGW_HOME}/bin:${PATH}" | |
| source "${MINGW_HOME}/build/autotools/${{ matrix.target }}.sh" | |
| elif [[ '${{ matrix.target }}' = *'-darwin' ]]; then | |
| curl \ | |
| --silent \ | |
| --show-error \ | |
| --fail \ | |
| --url 'https://raw.githubusercontent.com/AmanoTeam/darwin-clang-cross/refs/heads/master/main.sh' \ | |
| | bash -s -- install | |
| export DARWIN_HOME='/tmp/darwin-clang-cross' | |
| export PATH="${DARWIN_HOME}/bin:${PATH}" | |
| source "${DARWIN_HOME}/build/autotools/${{ matrix.target }}.sh" | |
| fi | |
| if [ "${OBGGCC_RELEASE}" = '2.95' ]; then | |
| export OBGGCC_BUILD_PARALLEL_LEVEL='1' | |
| fi | |
| zsh './build.sh' | |
| - name: Create logs | |
| if: always() | |
| run: | | |
| declare logs='' | |
| while read file; do | |
| logs+="${file} " | |
| done <<< $(find "/tmp/"*"/build" -wholename '*.log' -o -wholename '*.yaml') | |
| tar --create --file=- ${logs} | xz --threads='0' --compress -9 > '/tmp/logs.tar.xz' | |
| - name: Upload logs | |
| if: always() | |
| uses: actions/upload-artifact@main | |
| with: | |
| name: ${{ matrix.target }}-logs | |
| if-no-files-found: error | |
| path: | | |
| /tmp/logs.tar.xz | |
| - name: Generate tarball | |
| run: | | |
| if [[ '${{ matrix.target }}' = *'-mingw32' ]]; then | |
| declare tarball_filename='/tmp/${{ matrix.target }}.7z' | |
| cd '/tmp' | |
| 7z a "${tarball_filename}" 'obggcc' \ | |
| -t7z \ | |
| -mx=9 \ | |
| -m0=lzma2:d=128m:fb=128 \ | |
| -ms=on \ | |
| -mmt="$(nproc)" | |
| else | |
| declare tarball_filename='/tmp/${{ matrix.target }}.tar.xz' | |
| tar --directory='/tmp' --create --file=- 'obggcc' | xz --threads='0' --extreme --memlimit-compress='100%' --compress -9 > "${tarball_filename}" | |
| fi | |
| sha256sum "${tarball_filename}" | sed 's|/tmp/||' > "${tarball_filename}.sha256" | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@main | |
| with: | |
| name: ${{ matrix.target }} | |
| if-no-files-found: error | |
| path: | | |
| /tmp/${{ matrix.target }}.* | |
| release: | |
| needs: cross-build | |
| runs-on: ubuntu-latest | |
| name: Collect all artifacts | |
| steps: | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@main | |
| - name: Create release | |
| uses: softprops/action-gh-release@master | |
| with: | |
| tag_name: 'gcc-${{ env.OBGGCC_RELEASE }}' | |
| name: 'GCC ${{ env.OBGGCC_RELEASE }}' | |
| files: ./*/*-{unknown,w64}-*.{tar.xz,7z}* | |
| draft: false | |
| prerelease: false | |
| fail_on_unmatched_files: true | |
| body: "* Update to GCC ${{ env.OBGGCC_RELEASE }}" | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |