Skip to content

Cache toolchain build to speed up testing development #112

Cache toolchain build to speed up testing development

Cache toolchain build to speed up testing development #112

Workflow file for this run

name: Build toolchain variants
on:
push:
branches:
- main
pull_request:
workflow_dispatch:
inputs:
binutils_branch:
description: 'Binutils branch to build'
required: false
default: 'woarm64'
gcc_branch:
description: 'GCC branch to build'
required: false
default: 'woarm64'
mingw_branch:
description: 'Mingw branch to build'
required: false
default: 'woarm64'
env:
TOOLCHAIN_PATH: ${{ github.workspace }}/cross
TOOLCHAIN_NAME: aarch64-w64-mingw32-msvcrt
TOOLCHAIN_PACKAGE_NAME: aarch64-w64-mingw32-msvcrt-toolchain.tar.gz
jobs:
build-toolchain:
runs-on: ubuntu-latest
strategy:
matrix:
target: [aarch64-w64-mingw32, x86_64-w64-mingw32]
crt: [msvcrt, ucrt]
env:
BINUTILS_REPO: Windows-on-ARM-Experiments/binutils-woarm64
BINUTILS_BRANCH: ${{ github.event.inputs.binutils_branch }}
BINUTILS_VERSION: binutils-master
GCC_REPO: Windows-on-ARM-Experiments/gcc-woarm64
GCC_BRANCH: ${{ github.event.inputs.gcc_branch }}
GCC_VERSION: gcc-master
MINGW_REPO: Windows-on-ARM-Experiments/mingw-woarm64
MINGW_BRANCH: ${{ github.event.inputs.mingw_branch }}
MINGW_VERSION: mingw-w64-master
TARGET: ${{ matrix.target }}
CRT: ${{ matrix.crt }}
TOOLCHAIN_NAME: ${{ matrix.target }}-${{ matrix.crt }}
TOOLCHAIN_PACKAGE_NAME: ${{ matrix.target }}-${{ matrix.crt }}-toolchain.tar.gz
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
path: ${{ github.workspace }}
- name: Get binutils SHA
id: binutils-sha
run: |
echo ::set-output name=sha::$( git ls-remote https://github.com/${{ env.BINUTILS_REPO }} ${{ env.BINUTILS_BRANCH }} | cut -f1 )
- name: Cache toolchain
id: cache-toolchain
uses: actions/cache@v3
with:
path: ${{ github.workspace }}/${{ env.TOOLCHAIN_PACKAGE_NAME }}
key: ${{ env.TOOLCHAIN_NAME }}-${{ steps.binutils-sha.outputs.sha }}
- name: Checkout binutils
if: steps.cache-toolchain.outputs.cache-hit != 'true'
uses: actions/checkout@v4
with:
repository: ${{ env.BINUTILS_REPO }}
ref: ${{ env.BINUTILS_BRANCH }}
path: ${{ github.workspace }}/code/${{ env.BINUTILS_VERSION }}
- name: Checkout GCC
if: steps.cache-toolchain.outputs.cache-hit != 'true'
uses: actions/checkout@v4
with:
repository: ${{ env.GCC_REPO }}
ref: ${{ env.GCC_BRANCH }}
path: ${{ github.workspace }}/code/${{ env.GCC_VERSION }}
- name: Checkout MinGW
if: steps.cache-toolchain.outputs.cache-hit != 'true'
uses: actions/checkout@v4
with:
repository: ${{ env.MINGW_REPO }}
ref: ${{ env.MINGW_BRANCH }}
path: ${{ github.workspace }}/code/${{ env.MINGW_VERSION }}
- name: Install dependencies
if: steps.cache-toolchain.outputs.cache-hit != 'true'
run: |
.github/scripts/install-dependencies.sh
- name: Install libraries
if: steps.cache-toolchain.outputs.cache-hit != 'true'
run: |
.github/scripts/install-libraries.sh
- name: Build binutils
if: steps.cache-toolchain.outputs.cache-hit != 'true'
run: |
.github/scripts/build-binutils.sh
- name: Build MinGW headers
if: steps.cache-toolchain.outputs.cache-hit != 'true'
run: |
.github/scripts/build-mingw-headers.sh
- name: Build GCC
if: steps.cache-toolchain.outputs.cache-hit != 'true'
run: |
.github/scripts/build-gcc.sh
- name: Build MinGW CRT
if: steps.cache-toolchain.outputs.cache-hit != 'true'
run: |
.github/scripts/build-mingw-crt.sh
- name: Build libgcc
if: steps.cache-toolchain.outputs.cache-hit != 'true'
run: |
.github/scripts/build-libgcc.sh
- name: Build MinGW
if: steps.cache-toolchain.outputs.cache-hit != 'true'
run: |
.github/scripts/build-mingw.sh
- name: Build GCC libs
if: steps.cache-toolchain.outputs.cache-hit != 'true'
run: |
.github/scripts/build-gcc-libs.sh
- name: Pack toolchain
if: steps.cache-toolchain.outputs.cache-hit != 'true'
run: |
.github/scripts/pack-toolchain.sh
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: ${{ env.TOOLCHAIN_PACKAGE_NAME }}
path: ${{ github.workspace }}/${{ env.TOOLCHAIN_PACKAGE_NAME }}
retention-days: 1
build-aarch64-tests:
needs: [build-toolchain]
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
path: ${{ github.workspace }}
- name: Download toolchain
uses: actions/download-artifact@v3
with:
name: ${{ env.TOOLCHAIN_PACKAGE_NAME }}
path: ${{ github.workspace }}
- name: Unpack toolchain
run: |
.github/scripts/unpack-toolchain.sh
- name: Build aarch64-tests
run: |
.github/scripts/build-aarch64-tests.sh
- name: Upload tests artifact
uses: actions/upload-artifact@v3
with:
name: ${{ env.TOOLCHAIN_NAME }} tests
path: tests/build/bin/aarch64-mingw-tests.exe
retention-days: 3
execute-aarch64-tests:
needs: [build-aarch64-tests]
runs-on: [Windows, GCC, ARM64]
steps:
- name: Download ${{ env.TOOLCHAIN_NAME }} tests
uses: actions/download-artifact@v3
with:
name: ${{ env.TOOLCHAIN_NAME }} tests
- name: Execute ${{ env.TOOLCHAIN_NAME }} tests
run:
${{ github.workspace }}\aarch64-mingw-tests.exe
build-openblas:
needs: [build-toolchain]
runs-on: ubuntu-latest
env:
OPENBLAS_REPO: OpenMathLib/OpenBLAS.git
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
path: ${{ github.workspace }}
- name: Checkout OpenBLAS
uses: actions/checkout@v4
with:
repository: ${{ env.OPENBLAS_REPO }}
ref: develop
path: ${{ github.workspace }}/code/OpenBLAS
- name: Download toolchain
uses: actions/download-artifact@v3
with:
name: ${{ env.TOOLCHAIN_PACKAGE_NAME }}
path: ${{ github.workspace }}
- name: Unpack toolchain
run: |
.github/scripts/unpack-toolchain.sh
- name: Build OpenBLAS
run: |
.github/scripts/build-openblas.sh
- name: Pack OpenBLAS tests
run: |
.github/scripts/pack-openblas-tests.sh
- name: Upload tests artifact
uses: actions/upload-artifact@v3
with:
name: ${{ env.TOOLCHAIN_NAME }}-openblas-tests
path: ${{ github.workspace }}/code/OpenBLAS/${{ env.TOOLCHAIN_NAME }}-openblas-tests.zip
retention-days: 3
execute-openblas-tests:
needs: [build-openblas]
runs-on: [Windows, GCC, ARM64]
env:
OPENBLAS_TESTS_PATH: ${{ github.workspace }}/openblas-tests
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
path: ${{ github.workspace }}
- name: Download OpenBLAS tests
uses: actions/download-artifact@v3
with:
name: ${{ env.TOOLCHAIN_NAME }}-openblas-tests
- name: Unpack OpenBLAS tests
run: |
.github/scripts/unpack-openblas-tests.ps1
- name: Execute OpenBLAS tests
run: |
C:\Program` Files\Git\bin\bash.exe .github/scripts/test-openblas.sh