Skip to content

Commit 417a9b1

Browse files
kaadambryanpkc
authored andcommitted
[workflows] Setup Windows x64/arm64 GitHub action for Classic Flang LLVM
* Extend pre-compile_llvm workflow with a Windows job which defines build strategy for X64 and ARM64 architectures to produce prebuilt LLVM binaries for both platform. Currently Windows on ARM job is disabled, until an official will be available. * Also enable Classic Flang LLVM testing on Windows x64 only. Some tests are failing on Windows on ARM, so we don't run tests on WoA until they are fixed.
1 parent cb6399f commit 417a9b1

File tree

2 files changed

+90
-6
lines changed

2 files changed

+90
-6
lines changed

.github/workflows/llvm-project-tests.yml

Lines changed: 36 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,17 +74,29 @@ jobs:
7474
# We're using a specific version of macOS due to:
7575
# https://github.com/actions/virtual-environments/issues/5900
7676
- macOS-11
77+
- windows-latest
78+
include:
79+
# Enable Windows on ARM build, when an official
80+
# self-hosted machine is available.
81+
# - os: self-hosted
82+
# target: AArch64
83+
# arch: arm64
84+
- os: windows-latest
85+
arch: amd64
86+
7787
steps:
7888
- name: Setup Windows
79-
if: startsWith(matrix.os, 'windows')
89+
if: startsWith(matrix.os, 'windows') || startsWith(matrix.os, 'self')
8090
uses: llvm/actions/setup-windows@main
8191
with:
82-
arch: amd64
83-
# On Windows, starting with win19/20220814.1, cmake choose the 32-bit
84-
# python3.10.6 libraries instead of the 64-bit libraries when building
85-
# lldb. Using this setup-python action to make 3.10 the default
86-
# python fixes this.
92+
arch: ${{ matrix.arch }}
93+
# By default CMake chooses the most recent 32-bit libraries instead of
94+
# the 64-bit libraries when building and testing LLVM or Clang.
95+
# 32 bit version causes a memory error during the testing.
96+
# On 'windows-latest' GitHub image (VS2022) 3.11 (32bit) version is installed.
97+
# Using this setup-python action to make 3.11 (64bit) the default
8798
- name: Setup Python
99+
if: ${{ matrix.os != 'self-hosted' }}
88100
uses: actions/setup-python@v5
89101
with:
90102
python-version: ${{ inputs.python_version }}
@@ -94,10 +106,18 @@ jobs:
94106
# actions/checkout deletes any existing files in the new git directory,
95107
# so this needs to either run before ccache-action or it has to use
96108
# clean: false.
109+
- name: Setup psutil
110+
# psutil is not available on Windows on ARM.
111+
if: startsWith(matrix.os, 'windows')
112+
run: pip install psutil
113+
- name: Check tools
114+
run: python --version
97115
- uses: actions/checkout@v4
98116
with:
99117
fetch-depth: 250
100118
- name: Setup ccache
119+
# ccache is not available for Windows on ARM.
120+
if: ${{ matrix.os != 'self-hosted' }}
101121
uses: hendrikmuhs/ccache-action@v1
102122
with:
103123
# A full build of llvm, clang, lld, and lldb takes about 250MB
@@ -111,6 +131,16 @@ jobs:
111131
max-size: 2G
112132
key: ${{ matrix.os }}
113133
variant: sccache
134+
- name: Test clang Windows
135+
# Some LLVM tests are failing on Windows On ARM,
136+
# so this step is skipped on WoA until they are fixed.
137+
if: ${{ matrix.os == 'windows-latest' }}
138+
run: |
139+
$pcount = $($(Get-WmiObject -class Win32_ComputerSystem).numberoflogicalprocessors)
140+
python .\scripts\build_llvm_project.py -d build -t ${{ matrix.target }} --cmake-param=-DLLVM_ENABLE_ASSERTIONS=ON -j $pcount
141+
cd build
142+
ninja check-all
143+
shell: powershell
114144
- name: Test clang macOS
115145
if: ${{ matrix.os == 'macOS-11'}}
116146
env:

.github/workflows/pre-compile_llvm.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ on:
88

99
jobs:
1010
build:
11+
name: Ubuntu Linux
1112
runs-on: ubuntu-20.04
1213
strategy:
1314
matrix:
@@ -80,3 +81,56 @@ jobs:
8081
with:
8182
name: llvm_build_${{ matrix.target }}_${{ matrix.cc }}_${{ matrix.version }}_${{ steps.extract_branch.outputs.branch }}
8283
path: llvm_build.tar.gz
84+
85+
build-win:
86+
name: Windows build
87+
runs-on: ${{ matrix.os }}
88+
strategy:
89+
matrix:
90+
include:
91+
- os: windows-latest
92+
arch: amd64
93+
target: X86
94+
# Enable Windows on ARM build, when an official
95+
# self-hosted machine is available.
96+
# - os: self-hosted
97+
# arch: arm64
98+
# target: AArch64
99+
100+
steps:
101+
- uses: actions/checkout@v3
102+
103+
- name: Setup Windows
104+
uses: llvm/actions/setup-windows@main
105+
with:
106+
arch: ${{ matrix.arch }}
107+
108+
- name: Setup Ninja
109+
uses: llvm/actions/install-ninja@main
110+
111+
- name: Check tools
112+
run: |
113+
git --version
114+
cmake --version
115+
clang --version
116+
ninja --version
117+
python --version
118+
119+
- name: Extract branch name
120+
id: extract_branch
121+
run: echo "branch=$(("${{ github.ref }}" -split "/")[-1])" >> $env:GITHUB_OUTPUT
122+
123+
- name: Build llvm
124+
shell: powershell
125+
run: |
126+
$pcount = $($(Get-WmiObject -class Win32_ComputerSystem).numberoflogicalprocessors)
127+
python .\scripts\build_llvm_project.py -d build -t ${{ matrix.target }} --cmake-param=-DLLVM_ENABLE_ASSERTIONS=ON -j $pcount -v
128+
cd ..
129+
7z a llvm_build.7z $pwd/classic-flang-llvm-project/
130+
Copy-Item llvm_build.7z -Destination $pwd/classic-flang-llvm-project/
131+
132+
- name: Upload llvm
133+
uses: actions/upload-artifact@v3
134+
with:
135+
name: llvm_build_win_${{ matrix.arch }}_clangcl_${{ steps.extract_branch.outputs.branch }}
136+
path: ${{ github.workspace }}\llvm_build.7z

0 commit comments

Comments
 (0)