WIP: Split single job in build-and-test-toolchain.yml
into build and test jobs
#238
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
name: Build and test main toolchain | |
on: | |
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' | |
arch: | |
description: 'Architecture to build for' | |
required: false | |
default: 'x86_64' | |
platform: | |
description: 'Platform to build for' | |
required: false | |
default: 'w64-mingw32' | |
crt: | |
description: 'C runtime to build for' | |
required: false | |
default: 'msvcrt' | |
tag: | |
description: 'Tag to use for the artifact' | |
required: true | |
gcc_module: | |
description: 'GCC module to test' | |
required: false | |
default: '' | |
gcc_test_filter: | |
description: 'GCC test filter' | |
required: false | |
default: '' | |
workflow_call: | |
inputs: | |
binutils_branch: | |
type: string | |
gcc_branch: | |
type: string | |
mingw_branch: | |
type: string | |
arch: | |
type: string | |
platform: | |
type: string | |
crt: | |
type: string | |
tag: | |
type: string | |
gcc_module: | |
type: string | |
gcc_test_filter: | |
type: string | |
env: | |
BINUTILS_BRANCH: ${{ inputs.binutils_branch || 'woarm64' }} | |
GCC_BRANCH: ${{ inputs.gcc_branch || 'woarm64' }} | |
MINGW_BRANCH: ${{ inputs.mingw_branch || 'woarm64' }} | |
ARCH: ${{ inputs.arch || 'x86_64' }} | |
PLATFORM: ${{ inputs.platform || 'w64-mingw32' }} | |
CRT: ${{ inputs.crt || 'msvcrt' }} | |
TAG: ${{ inputs.tag || 'test' }} | |
MODULE: ${{ inputs.gcc_module || '' }} | |
FILTER: ${{ inputs.gcc_test_filter || '' }} | |
CCACHE: 1 | |
RUN_BOOTSTRAP: 1 | |
UPDATE_SOURCES: 1 | |
WSL_WORK_DIR: ~/work | |
WSL_OUTPUT_DIR: /media/output | |
WSL_DISTRIBUTION: Ubuntu-22.04 | |
WSL_USER: root | |
WSLENV: BINUTILS_BRANCH:GCC_BRANCH:MINGW_BRANCH:ARCH:PLATFORM:CRT:TAG:MODULE:FILTER:CCACHE:RUN_BOOTSTRAP:UPDATE_SOURCES:WSL_OUTPUT_DIR:GITHUB_OUTPUT/p:GITHUB_STEP_SUMMARY/p | |
jobs: | |
build-toolchain: | |
name: Build toolchain | |
runs-on: windows-latest | |
defaults: | |
run: | |
shell: wsl-bash {0} | |
steps: | |
- name: Get cache key | |
id: get-cache-key | |
shell: powershell | |
run: | | |
Write-Output "timestamp=$((Get-Date).ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ssZ"))" >> "$env:GITHUB_OUTPUT" | |
- name: Setup WSL | |
uses: Windows-on-ARM-Experiments/setup-wsl@master | |
with: | |
distribution: ${{ env.WSL_DISTRIBUTION }} | |
wsl-shell-user: ${{ env.WSL_USER }} | |
additional-packages: | |
git | |
- name: Checkout repository | |
run: | | |
git clone --depth=1 ${{ github.server_url }}/${{ github.repository }}.git -b ${{ github.head_ref || github.ref_name || 'main' }} ${{ env.WSL_WORK_DIR }} | |
- name: Get WSL paths | |
id: get-wsl-paths | |
run: | | |
${{ env.WSL_WORK_DIR }}/.github/scripts/get-wsl-paths.sh | |
- name: Restore Ccache | |
uses: actions/cache/restore@v4 | |
with: | |
path: ${{ steps.get-wsl-paths.outputs.ccache-dir-path-win }} | |
key: build-and-test-gcc-ccache-${{ steps.get-cache-key.outputs.timestamp }} | |
restore-keys: build-and-test-gcc-ccache- | |
- name: Build toolchain | |
run: | | |
${{ env.WSL_WORK_DIR }}/.github/scripts/build.sh | |
- name: Pack work folder | |
run: | | |
echo ${{ steps.get-wsl-paths.outputs.root-path-wsl }} | |
tar -czf ${{ env.WSL_OUTPUT_DIR }}/work.tar.bz2 -C /root/work . | |
- name: Upload work folder | |
uses: actions/upload-artifact@v4 | |
with: | |
name: work | |
retention-days: 1 | |
path: ${{ steps.get-wsl-paths.outputs.output-path-win }}/work.tar.bz2 | |
- name: Save Ccache | |
if: always() | |
uses: actions/cache/save@v4 | |
with: | |
path: ${{ steps.get-wsl-paths.outputs.ccache-dir-path-win }} | |
key: build-and-test-gcc-ccache-${{ steps.get-cache-key.outputs.timestamp }} | |
test-toolchain: | |
name: Test toolchain | |
needs: [ | |
build-toolchain | |
] | |
runs-on: windows-latest | |
defaults: | |
run: | |
shell: wsl-bash {0} | |
steps: | |
- name: Setup WSL | |
uses: Windows-on-ARM-Experiments/setup-wsl@master | |
with: | |
distribution: ${{ env.WSL_DISTRIBUTION }} | |
wsl-shell-user: ${{ env.WSL_USER }} | |
additional-packages: | |
git | |
- name: Checkout repository | |
run: | | |
git clone --depth=1 ${{ github.server_url }}/${{ github.repository }}.git -b ${{ github.head_ref || github.ref_name || 'main' }} ${{ env.WSL_WORK_DIR }} | |
- name: Install dependencies | |
run: | | |
${{ env.WSL_WORK_DIR }}/.github/scripts/install-dependencies.sh | |
- name: Get WSL paths | |
id: get-wsl-paths | |
run: | | |
${{ env.WSL_WORK_DIR }}/.github/scripts/get-wsl-paths.sh | |
- name: Download work folder | |
uses: actions/download-artifact@v4 | |
with: | |
name: work | |
path: ${{ steps.get-wsl-paths.outputs.output-path-win }} | |
- name: Unpack work folder | |
run: | | |
echo ${{ steps.get-wsl-paths.outputs.root-path-wsl }} | |
tar --overwrite -xzf ${{ env.WSL_OUTPUT_DIR }}/work.tar.bz2 -C /root/work | |
- name: Execute GCC tests | |
run: | | |
${{ env.WSL_WORK_DIR }}/.github/scripts/toolchain/execute-gcc-tests.sh "gcc-tests-${{ env.TAG }}" \ | |
"${{ env.MODULE }}" "${{ env.FILTER }}" | |
- name: Create summary | |
run: | | |
${{ env.WSL_WORK_DIR }}/.github/scripts/toolchain/create-gcc-summary.sh " \ | |
${{ steps.get-wsl-paths.outputs.artifact-path-wsl }}/gcc-tests-${{ env.TAG }}" >> \ | |
${{ steps.get-wsl-paths.outputs.artifact-path-wsl }}/gcc-tests-${{ env.TAG }}/summary.md | |
cat ${{ steps.get-wsl-paths.outputs.artifact-path-wsl }}/gcc-tests-${{ env.TAG }}/summary.md >> $GITHUB_STEP_SUMMARY | |
- name: Group test failures | |
run: | | |
${{ env.WSL_WORK_DIR }}/.github/scripts/toolchain/group-gcc-test-failures.sh "gcc-tests-${{ env.TAG }}" >> $GITHUB_STEP_SUMMARY | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: gcc-tests-${{ env.TAG }} | |
path: ${{ steps.get-wsl-paths.outputs.artifact-path-win }}\gcc-tests-${{ env.TAG }} | |
retention-days: 30 |