Skip to content

Commit aa02002

Browse files
authored
workflows: Refactor release-tasks.yml (#69523)
* Split out the lit release job and the documentation build job into their own workflow files. This makes it possible to manually run these jobs via workflow_dispatch. * Improve tag/user validation and ensure it gets run for each release task.
1 parent 67e0f41 commit aa02002

7 files changed

+331
-120
lines changed

.github/workflows/release-binaries.yml

+31-17
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,29 @@
11
name: Release Binaries
22

33
on:
4-
push:
5-
tags:
6-
- 'llvmorg-*'
74
workflow_dispatch:
85
inputs:
6+
release-version:
7+
description: 'Release Version'
8+
required: true
9+
type: string
910
upload:
1011
description: 'Upload binaries to the release page'
1112
required: true
12-
default: true
13+
default: false
1314
type: boolean
14-
tag:
15-
description: 'Tag to build'
15+
16+
workflow_call:
17+
inputs:
18+
release-version:
19+
description: 'Release Version'
1620
required: true
1721
type: string
22+
upload:
23+
description: 'Upload binaries to the release page'
24+
required: true
25+
default: false
26+
type: boolean
1827
schedule:
1928
# * is a special character in YAML so you have to quote this string
2029
- cron: '0 8 1 * *'
@@ -26,21 +35,26 @@ jobs:
2635
prepare:
2736
name: Prepare to build binaries
2837
runs-on: ubuntu-22.04
29-
if: github.repository == 'llvm/llvm-project'
3038
outputs:
31-
release-version: ${{ steps.validate-tag.outputs.release-version }}
32-
flags: ${{ steps.validate-tag.outputs.flags }}
33-
build-dir: ${{ steps.validate-tag.outputs.build-dir }}
34-
rc-flags: ${{ steps.validate-tag.outputs.rc-flags }}
35-
ref: ${{ steps.validate-tag.outputs.ref }}
36-
upload: ${{ steps.validate-tag.outputs.upload }}
39+
release-version: ${{ steps.vars.outputs.release-version }}
40+
flags: ${{ steps.vars.outputs.flags }}
41+
build-dir: ${{ steps.vars.outputs.build-dir }}
42+
rc-flags: ${{ steps.vars.outputs.rc-flags }}
43+
ref: ${{ steps.vars.outputs.ref }}
44+
upload: ${{ steps.vars.outputs.upload }}
3745

3846
steps:
3947
- name: Checkout LLVM
4048
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
4149

42-
- name: Validate and parse tag
43-
id: validate-tag
50+
- name: Check Permissions
51+
env:
52+
GITHUB_TOKEN: ${{ github.token }}
53+
run: |
54+
./llvm/utils/release/./github-upload-release.py --token "$GITHUB_TOKEN" --user ${{ github.actor }} check-permissions
55+
56+
- name: Collect Variables
57+
id: vars
4458
# In order for the test-release.sh script to run correctly, the LLVM
4559
# source needs to be at the following location relative to the build dir:
4660
# | X.Y.Z-rcN | ./rcN/llvm-project
@@ -61,9 +75,9 @@ jobs:
6175
if [ -n "${{ inputs.upload }}" ]; then
6276
upload="${{ inputs.upload }}"
6377
else
64-
upload="true"
78+
upload="false"
6579
fi
66-
bash .github/workflows/set-release-binary-outputs.sh "${{ github.actor }}" "$tag" "$upload"
80+
bash .github/workflows/set-release-binary-outputs.sh "$tag" "$upload"
6781
6882
# Try to get around the 6 hour timeout by first running a job to fill
6983
# the build cache.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
name: Release Documentation
2+
3+
permissions:
4+
contents: read
5+
6+
on:
7+
workflow_dispatch:
8+
inputs:
9+
release-version:
10+
description: 'Release Version'
11+
required: true
12+
type: string
13+
upload:
14+
description: 'Upload documentation'
15+
required: false
16+
type: boolean
17+
18+
workflow_call:
19+
inputs:
20+
release-version:
21+
description: 'Release Version'
22+
required: true
23+
type: string
24+
upload:
25+
description: 'Upload documentation'
26+
required: false
27+
type: boolean
28+
29+
jobs:
30+
release-documentation:
31+
name: Build and Upload Release Documentation
32+
runs-on: ubuntu-latest
33+
env:
34+
upload: ${{ inputs.upload && !contains(inputs.release-version, 'rc') }}
35+
steps:
36+
- name: Checkout LLVM
37+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
38+
39+
- name: Setup Python env
40+
uses: actions/setup-python@v4
41+
with:
42+
cache: 'pip'
43+
cache-dependency-path: './llvm/docs/requirements.txt'
44+
45+
- name: Install Dependencies
46+
run: |
47+
sudo apt-get update
48+
sudo apt-get install -y \
49+
graphviz \
50+
python3-github \
51+
ninja-build \
52+
texlive-font-utils
53+
pip3 install --user -r ./llvm/docs/requirements.txt
54+
55+
- name: Build Documentation
56+
env:
57+
GITHUB_TOKEN: ${{ github.token }}
58+
run: |
59+
./llvm/utils/release/build-docs.sh -release "${{ inputs.release-version }}" -no-doxygen
60+
61+
- name: Create Release Notes Artifact
62+
uses: actions/upload-artifact@v3
63+
with:
64+
name: release-notes
65+
path: docs-build/html-export/
66+
67+
- name: Clone www-releases
68+
if: env.upload
69+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
70+
with:
71+
repository: ${{ github.repository_owner }}/www-releases
72+
ref: main
73+
fetch-depth: 0
74+
path: www-releases
75+
76+
- name: Upload Release Notes
77+
if: env.upload
78+
env:
79+
WWW_RELEASES_TOKEN: ${{ secrets.WWW_RELEASES_TOKEN }}
80+
run: |
81+
mkdir -p ../www-releases/${{ inputs.release-version }}
82+
mv ./docs-build/html-export/* ../www-releases/${{ inputs.release-version }}
83+
cd ../www-releases
84+
git add ${{ inputs.release-version }}
85+
git config user.email "[email protected]"
86+
git config user.name "llvmbot"
87+
git commit -a -m "Add ${{ inputs.release-version }} documentation"
88+
git push "https://[email protected]/${{ github.repository_owner }}/www-releases" main:main

.github/workflows/release-doxygen.yml

+67
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: Release Doxygen
2+
3+
permissions:
4+
contents: read
5+
6+
on:
7+
workflow_dispatch:
8+
inputs:
9+
release-version:
10+
description: 'Release Version'
11+
required: true
12+
type: string
13+
upload:
14+
description: 'Upload documentation'
15+
required: false
16+
type: boolean
17+
18+
workflow_call:
19+
inputs:
20+
release-version:
21+
description: 'Release Version'
22+
required: true
23+
type: string
24+
upload:
25+
description: 'Upload documentation'
26+
required: false
27+
type: boolean
28+
29+
jobs:
30+
release-doxygen:
31+
name: Build and Upload Release Doxygen
32+
runs-on: ubuntu-latest
33+
permissions:
34+
contents: write
35+
env:
36+
upload: ${{ inputs.upload && !contains(inputs.release-version, 'rc') }}
37+
steps:
38+
- name: Checkout LLVM
39+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
40+
41+
- name: Setup Python env
42+
uses: actions/setup-python@v4
43+
with:
44+
cache: 'pip'
45+
cache-dependency-path: './llvm/docs/requirements.txt'
46+
47+
- name: Install Dependencies
48+
run: |
49+
sudo apt-get update
50+
sudo apt-get install -y \
51+
doxygen \
52+
graphviz \
53+
python3-github \
54+
ninja-build \
55+
texlive-font-utils
56+
pip3 install --user -r ./llvm/docs/requirements.txt
57+
58+
- name: Build Doxygen
59+
env:
60+
GITHUB_TOKEN: ${{ github.token }}
61+
run: |
62+
./llvm/utils/release/build-docs.sh -release "${{ inputs.release-version }}" -no-sphinx
63+
64+
- name: Upload Doxygen
65+
if: env.upload
66+
run: |
67+
./llvm/utils/release/github-upload-release.py --token "$GITHUB_TOKEN" --release "${{ inputs.release-version }}" --user "${{ github.actor }}" upload --files ./*doxygen*.tar.xz

.github/workflows/release-lit.yml

+74
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: Release Lit
2+
3+
permissions:
4+
contents: read
5+
6+
on:
7+
workflow_dispatch:
8+
inputs:
9+
release-version:
10+
description: 'Release Version'
11+
required: true
12+
type: string
13+
14+
workflow_call:
15+
inputs:
16+
release-version:
17+
description: 'Release Version'
18+
required: true
19+
type: string
20+
21+
jobs:
22+
release-lit:
23+
name: Release Lit
24+
runs-on: ubuntu-latest
25+
steps:
26+
- name: Checkout LLVM
27+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
28+
with:
29+
ref: "llvmorg-${{ inputs.release-version }}"
30+
31+
- name: Install dependencies
32+
run: |
33+
sudo apt-get update
34+
sudo apt-get install -y python3-setuptools python3-psutil python3-github
35+
36+
- name: Check Permissions
37+
env:
38+
GITHUB_TOKEN: ${{ github.token }}
39+
run: |
40+
./llvm/utils/release/./github-upload-release.py --token "$GITHUB_TOKEN" --user ${{ github.actor }} check-permissions
41+
42+
- name: Setup Cpp
43+
uses: aminya/setup-cpp@v1
44+
with:
45+
compiler: llvm-16.0.6
46+
cmake: true
47+
ninja: true
48+
49+
- name: Test lit
50+
run: |
51+
mkdir build && cd build
52+
export FILECHECK_OPTS='-dump-input-filter=all -vv -color'
53+
cmake ../llvm -DCMAKE_BUILD_TYPE=Release -G Ninja
54+
ninja -v -j $(nproc) check-lit
55+
56+
- name: Package lit
57+
run: |
58+
cd llvm/utils/lit
59+
# Remove 'dev' suffix from lit version.
60+
sed -i 's/ + "dev"//g' lit/__init__.py
61+
python3 setup.py sdist
62+
63+
- name: Upload lit to test.pypi.org
64+
uses: pypa/gh-action-pypi-publish@release/v1
65+
with:
66+
password: ${{ secrets.LLVM_LIT_TEST_PYPI_API_TOKEN }}
67+
repository-url: https://test.pypi.org/legacy/
68+
packages-dir: llvm/utils/lit/dist/
69+
70+
- name: Upload lit to pypi.org
71+
uses: pypa/gh-action-pypi-publish@release/v1
72+
with:
73+
password: ${{ secrets.LLVM_LIT_PYPI_API_TOKEN }}
74+
packages-dir: llvm/utils/lit/dist/

0 commit comments

Comments
 (0)