forked from pytorch/test-infra
-
Notifications
You must be signed in to change notification settings - Fork 0
149 lines (130 loc) · 5 KB
/
Copy pathbuild-clang.yml
File metadata and controls
149 lines (130 loc) · 5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
name: Build Clang and libomp
on:
pull_request:
paths:
- '.github/workflows/build-clang.yml'
- 'tools/clang-build/**'
workflow_dispatch:
permissions:
id-token: write
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true
jobs:
build:
strategy:
fail-fast: false
matrix:
include:
# Clang 15 - x86_64
- clang-version: "15.0.7"
clang-major: "15"
arch: x86_64
runner: mt-l-x86iamx-8-16
platform: linux-x86_64
container-image: ghcr.io/pytorch/test-infra:cpu-x86_64-1972edf
llvm-targets: "X86"
# Clang 15 - aarch64
- clang-version: "15.0.7"
clang-major: "15"
arch: aarch64
runner: mt-l-arm64g2-6-32
platform: linux-aarch64
container-image: ghcr.io/pytorch/test-infra:cpu-aarch64-1972edf
llvm-targets: "AArch64"
# Clang 18 - x86_64
- clang-version: "18.1.8"
clang-major: "18"
arch: x86_64
runner: mt-l-x86iamx-8-16
platform: linux-x86_64
container-image: ghcr.io/pytorch/test-infra:cpu-x86_64-1972edf
llvm-targets: "X86"
# Clang 18 - aarch64
- clang-version: "18.1.8"
clang-major: "18"
arch: aarch64
runner: mt-l-arm64g2-6-32
platform: linux-aarch64
container-image: ghcr.io/pytorch/test-infra:cpu-aarch64-1972edf
llvm-targets: "AArch64"
name: clang-${{ matrix.clang-major }} (${{ matrix.platform }})
runs-on: ${{ matrix.runner }}
container:
image: ${{ matrix.container-image }}
timeout-minutes: 180
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Install build dependencies
run: |
set -ex
# The test-infra CPU image is AlmaLinux 8 (manylinux_2_28) with gcc,
# make, and Development Tools pre-installed. We just need cmake and
# a few dev libraries for the LLVM build.
dnf install -y \
cmake \
wget xz \
zlib-devel ncurses-devel libxml2-devel libedit-devel
- name: Setup uv and Python 3.12
uses: pytorch/test-infra/.github/actions/setup-uv@main
with:
python-version: "3.12"
activate-environment: true
- name: Install Python build dependencies
run: |
set -ex
# AlmaLinux 8's ninja-build is too old (~1.8) and fails on LLVM's
# multiple-output rules. Install ninja >= 1.11 via uv.
uv pip install ninja==1.11.1.4
cmake --version
ninja --version
gcc --version
- name: Build Clang ${{ matrix.clang-version }}
run: |
chmod +x tools/clang-build/build.sh
tools/clang-build/build.sh \
"${{ matrix.clang-version }}" \
"${GITHUB_WORKSPACE}/clang-install" \
"${{ matrix.llvm-targets }}"
- name: Package artifacts
id: package
run: |
set -ex
ARTIFACT_NAME="clang-${{ matrix.clang-major }}-${{ matrix.platform }}"
cd "${GITHUB_WORKSPACE}/clang-install"
tar czf "${GITHUB_WORKSPACE}/${ARTIFACT_NAME}.tar.gz" .
cd "${GITHUB_WORKSPACE}"
sha256sum "${ARTIFACT_NAME}.tar.gz" > "${ARTIFACT_NAME}.tar.gz.sha256"
echo "artifact-name=${ARTIFACT_NAME}" >> "$GITHUB_OUTPUT"
echo "artifact-path=${GITHUB_WORKSPACE}/${ARTIFACT_NAME}.tar.gz" >> "$GITHUB_OUTPUT"
# Print size for visibility
ls -lh "${ARTIFACT_NAME}.tar.gz"
cat "${ARTIFACT_NAME}.tar.gz.sha256"
- name: Upload artifact to GitHub
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: ${{ steps.package.outputs.artifact-name }}
retention-days: 90
if-no-files-found: error
path: |
${{ steps.package.outputs.artifact-name }}.tar.gz
${{ steps.package.outputs.artifact-name }}.tar.gz.sha256
- name: Configure AWS credentials (OIDC)
if: ${{ github.event_name != 'pull_request' }}
uses: aws-actions/configure-aws-credentials@67fbcbb121271f7775d2e7715933280b06314838 # v1.7.0
with:
role-to-assume: arn:aws:iam::308535385114:role/arc
aws-region: us-east-1
- name: Upload artifact to S3
if: ${{ github.event_name != 'pull_request' }}
uses: seemethere/upload-artifact-s3@baba72d0712b404f646cebe0730933554ebce96a # v5.1.0
with:
if-no-files-found: error
s3-bucket: gha-artifacts
s3-prefix: clang/${{ matrix.platform }}/clang-${{ matrix.clang-major }}
retention-days: 365
path: |
${{ steps.package.outputs.artifact-name }}.tar.gz
${{ steps.package.outputs.artifact-name }}.tar.gz.sha256