11name : Build and test main toolchain
22
33on :
4- pull_request :
54 workflow_dispatch :
65 inputs :
76 binutils_branch :
6059 gcc_test_filter :
6160 type : string
6261
62+ run-name : Build and test ${{ inputs.arch }}-${{ inputs.platform }}-${{ inputs.crt }} toolchain
63+
6364env :
6465 BINUTILS_BRANCH : ${{ inputs.binutils_branch || 'woarm64' }}
6566 GCC_BRANCH : ${{ inputs.gcc_branch || 'woarm64' }}
7374 MODULE : ${{ inputs.gcc_module || '' }}
7475 FILTER : ${{ inputs.gcc_test_filter || '' }}
7576
77+ DEFAULT_WINDOWS_RUNNER : ${{ (inputs.arch == 'x86_64' && inputs.platform != 'pc-linux-gnu') && 1 || 0 }}
78+ DEFAULT_UBUNTU_RUNNER : ${{ (inputs.arch == 'x86_64' && inputs.platform == 'pc-linux-gnu') && 1 || 0 }}
79+ SELF_HOSTED_RUNNER : ${{ (inputs.arch != 'x86_64') && 1 || 0 }}
80+ WSL_RUNNER : ${{ ( inputs.platform == 'w64-mingw32') && 1 || 0 }}
81+ WLS_DISTRO : Ubuntu-22.04
82+
7683 TOOLCHAIN_PATH : ~/work/install
7784
7885 CCACHE : 1
8390jobs :
8491 build-and-test-toolchain :
8592 name : Build and test toolchain
86- runs-on : [ Windows, ARM64, WSL]
93+ runs-on : ${{ (inputs.arch == 'x86_64') && ((inputs.platform == 'pc-linux-gnu') && 'ubuntu-latest' || 'windows-latest') || fromJson('[" Windows", " ARM64", " WSL"]') }}
8794
8895 env :
8996 WSLENV : BINUTILS_BRANCH:GCC_BRANCH:MINGW_BRANCH:ARCH:PLATFORM:CRT:TAG:MODULE:FILTER:CCACHE:RUN_BOOTSTRAP:UPDATE_SOURCES:GITHUB_OUTPUT/p:GITHUB_STEP_SUMMARY/p
9097
9198 steps :
92- - name : Get cache key
93- id : get-cache-key
94- shell : powershell
99+ - name : Env
95100 run : |
96- Write-Output "timestamp=$((Get-Date).ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ssZ"))" >> "$env:GITHUB_OUTPUT"
101+ echo DEFAULT_WINDOWS_RUNNER: ${{ env.DEFAULT_WINDOWS_RUNNER }}
102+ echo DEFAULT_UBUNTU_RUNNER: ${{ env.DEFAULT_UBUNTU_RUNNER }}
103+ echo SELF_HOSTED_RUNNER: ${{ env.SELF_HOSTED_RUNNER }}
104+ echo WSL_RUNNER: ${{ env.WSL_RUNNER }}
105+ echo WLS_DISTRO: ${{ env.WLS_DISTRO }}
106+
107+ - name : Install WSL (Vampire/setup-wsl)
108+ if : ${{ (env.WSL_RUNNER == 1) && (env.DEFAULT_WINDOWS_RUNNER == 1) }}
109+ uses : Windows-on-ARM-Experiments/setup-wsl@master
110+ with :
111+ distribution : ${{ env.WLS_DISTRO }}
112+ additional-packages :
113+ git
114+
115+ - name : Install winget
116+ if : false
117+ uses : Cyberboss/install-winget@v1
97118
98- - name : Install WSL
119+ - name : Install WSL (Ubuntu/WSL/.github/actions/wsl-install)
99120 if : false
121+ uses : Ubuntu/WSL/.github/actions/wsl-install@main
122+ with :
123+ distro : ${{ env.WLS_DISTRO }}
124+
125+ - name : Install WSL (wsl --install)
126+ if : ${{ (env.WSL_RUNNER == 1) && (env.SELF_HOSTED_RUNNER == 1) }}
100127 run : |
101- wsl --install --enable-wsl1 --no-launch --distribution Ubuntu-22.04
128+ wsl --set-default-version 1
129+ wsl --install --no-launch --distribution ${{ env.WLS_DISTRO }}
102130
103131 - name : Clean up previous build
132+ if : ${{ (env.WSL_RUNNER == 1) && (env.SELF_HOSTED_RUNNER == 1) }}
104133 run : |
105- wsl whoami
106- wsl rm -rf ~/work
134+ ${{ env.WSL_RUNNER && 'wsl ' || '' }} rm -rf ~/work
107135
108136 - name : Checkout repository
109137 run : |
110- wsl git clone --depth=1 ${{ github.server_url }}/${{ github.repository }}.git -b ${{ github.head_ref || github.ref_name || 'main' }} ~/work
138+ ls -al ~/work
139+ ${{ (env.WSL_RUNNER == 1) && 'wsl ' || '' }} git clone --depth=1 ${{ github.server_url }}/${{ github.repository }}.git -b ${{ github.head_ref || github.ref_name || 'main' }} ~/work
111140
112141 - name : Get WSL paths
113142 id : get-wsl-paths
114143 run : |
115- wsl ~/work/.github/scripts/setup-wsl.sh
144+ ${{ (env.WSL_RUNNER == 1) && 'wsl ' || '' }} ~/work/.github/scripts/setup-wsl.sh
145+
146+ - name : Get cache key
147+ id : get-cache-key
148+ run : |
149+ ${{ (env.WSL_RUNNER == 1) && 'wsl ' || '' }} echo "timestamp=$(date -u --iso-8601=seconds)" >> "$GITHUB_OUTPUT"
116150
117151 - name : Restore Ccache
118152 uses : actions/cache/restore@v4
@@ -123,7 +157,7 @@ jobs:
123157
124158 - name : Build toolchain
125159 run : |
126- wsl ~/work/.github/scripts/build.sh
160+ ${{ (env.WSL_RUNNER == 1) && ' wsl ' || '' }} ~/work/.github/scripts/build.sh
127161
128162 - name : Save Ccache
129163 if : always()
@@ -134,7 +168,7 @@ jobs:
134168
135169 - name : Execute GCC tests
136170 run : |
137- wsl ~/work/.github/scripts/toolchain/execute-gcc-tests.sh "gcc-tests-${{ env.TAG }}" "${{ env.MODULE }}" "${{ env.FILTER }}"
171+ ${{ (env.WSL_RUNNER == 1) && ' wsl ' || '' }} ~/work/.github/scripts/toolchain/execute-gcc-tests.sh "gcc-tests-${{ env.TAG }}" "${{ env.MODULE }}" "${{ env.FILTER }}"
138172
139173 - name : Upload build folder
140174 if : failure()
0 commit comments