Skip to content

Commit a05065c

Browse files
committed
Add workflow doing comparative testing of toolchain branches accross multiple targets
1 parent 558b254 commit a05065c

File tree

3 files changed

+124
-17
lines changed

3 files changed

+124
-17
lines changed

.github/scripts/build.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
source `dirname ${BASH_SOURCE[0]}`/config.sh
44

5-
#if [[ "$RUN_BOOTSTRAP" = 1 ]]; then
6-
# $ROOT_PATH/.github/scripts/install-dependencies.sh
7-
#fi
5+
if [[ "$RUN_BOOTSTRAP" = 1 ]]; then
6+
$ROOT_PATH/.github/scripts/install-dependencies.sh
7+
fi
88

99
if [[ "$CCACHE" = 1 ]]; then
1010
source $ROOT_PATH/.github/scripts/enable-ccache.sh

.github/workflows/build-and-test-toolchain.yml

Lines changed: 48 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
name: Build and test main toolchain
22

33
on:
4-
pull_request:
54
workflow_dispatch:
65
inputs:
76
binutils_branch:
@@ -60,6 +59,8 @@ on:
6059
gcc_test_filter:
6160
type: string
6261

62+
run-name: Build and test ${{ inputs.arch }}-${{ inputs.platform }}-${{ inputs.crt }} toolchain
63+
6364
env:
6465
BINUTILS_BRANCH: ${{ inputs.binutils_branch || 'woarm64' }}
6566
GCC_BRANCH: ${{ inputs.gcc_branch || 'woarm64' }}
@@ -73,6 +74,12 @@ env:
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
@@ -83,36 +90,63 @@ env:
8390
jobs:
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()
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: Comparative test of toolchain branches accross multiple targets
2+
3+
on:
4+
pull_request:
5+
workflow_dispatch:
6+
inputs:
7+
binutils_branch_baseline:
8+
description: 'Baseline Binutils branch'
9+
required: false
10+
default: 'upstream'
11+
binutils_branch_changes:
12+
description: 'Changes Binutils branch'
13+
required: false
14+
default: 'upstream'
15+
gcc_branch_baseline:
16+
description: 'Baseline GCC branch'
17+
required: false
18+
default: 'upstream'
19+
gcc_branch_changes:
20+
description: 'Changes GCC branch'
21+
required: false
22+
default: 'upstream'
23+
mingw_branch_baseline:
24+
description: 'Baseline MinGW branch'
25+
required: false
26+
default: 'upstream'
27+
mingw_branch_changes:
28+
description: 'Changes MinGW branch'
29+
required: false
30+
default: 'upstream'
31+
workflow_call:
32+
inputs:
33+
binutils_branch_baseline:
34+
type: string
35+
binutils_branch_changes:
36+
type: string
37+
gcc_branch_baseline:
38+
type: string
39+
gcc_branch_changes:
40+
type: string
41+
mingw_branch_baseline:
42+
type: string
43+
mingw_branch_changes:
44+
type: string
45+
46+
jobs:
47+
48+
build-and-test-toolchains:
49+
name: Build and test toolchains
50+
51+
strategy:
52+
fail-fast: false
53+
matrix:
54+
arch: [aarch64, x86_64]
55+
platform: [w64-mingw32, pc-linux-gnu]
56+
crt: [ucrt, libc]
57+
exclude:
58+
- platform: w64-mingw32
59+
crt: libc
60+
- platform: pc-linux-gnu
61+
crt: ucrt
62+
63+
uses: ./.github/workflows/test-toolchain.yml
64+
with:
65+
binutils_branch_baseline: ${{ inputs.binutils_branch_baseline }}
66+
binutils_branch_changes: ${{ inputs.binutils_branch_changes }}
67+
gcc_branch_baseline: ${{ inputs.gcc_branch_baseline }}
68+
gcc_branch_changes: ${{ inputs.gcc_branch_changes }}
69+
mingw_branch_baseline: ${{ inputs.mingw_branch_baseline }}
70+
mingw_branch_changes: ${{ inputs.mingw_branch_changes }}
71+
arch: ${{ matrix.arch }}
72+
platform: ${{ matrix.platform }}
73+
crt: ${{ matrix.crt }}

0 commit comments

Comments
 (0)