Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

workflows: Refactor release-tasks.yml #69523

Merged
merged 9 commits into from
Jan 18, 2024
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 31 additions & 17 deletions .github/workflows/release-binaries.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,29 @@
name: Release Binaries

on:
push:
tags:
- 'llvmorg-*'
workflow_dispatch:
inputs:
release-version:
description: 'Release Version'
required: true
type: string
upload:
description: 'Upload binaries to the release page'
required: true
default: true
default: false
type: boolean
tag:
description: 'Tag to build'

workflow_call:
inputs:
release-version:
description: 'Release Version'
required: true
type: string
upload:
description: 'Upload binaries to the release page'
required: true
default: false
type: boolean
schedule:
# * is a special character in YAML so you have to quote this string
- cron: '0 8 1 * *'
Expand All @@ -26,21 +35,26 @@ jobs:
prepare:
name: Prepare to build binaries
runs-on: ubuntu-22.04
if: github.repository == 'llvm/llvm-project'
outputs:
release-version: ${{ steps.validate-tag.outputs.release-version }}
flags: ${{ steps.validate-tag.outputs.flags }}
build-dir: ${{ steps.validate-tag.outputs.build-dir }}
rc-flags: ${{ steps.validate-tag.outputs.rc-flags }}
ref: ${{ steps.validate-tag.outputs.ref }}
upload: ${{ steps.validate-tag.outputs.upload }}
release-version: ${{ steps.vars.outputs.release-version }}
flags: ${{ steps.vars.outputs.flags }}
build-dir: ${{ steps.vars.outputs.build-dir }}
rc-flags: ${{ steps.vars.outputs.rc-flags }}
ref: ${{ steps.vars.outputs.ref }}
upload: ${{ steps.vars.outputs.upload }}

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

- name: Validate and parse tag
id: validate-tag
- name: Check Permissions
env:
GITHUB_TOKEN: ${{ github.token }}
run: |
./llvm/utils/release/./github-upload-release.py --token "$GITHUB_TOKEN" --user ${{ github.actor }} check-permissions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the purpose of this permissions check?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I want to make sure that only the release managers are allowed to run this job manually, because we have a limited budget for using the bigger runners and I don't want to use it up.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, makes sense. Wasn't thinking that anyone with commit access is allowed to run the job rather than just the release managers.


- name: Collect Variables
id: vars
# In order for the test-release.sh script to run correctly, the LLVM
# source needs to be at the following location relative to the build dir:
# | X.Y.Z-rcN | ./rcN/llvm-project
Expand All @@ -61,9 +75,9 @@ jobs:
if [ -n "${{ inputs.upload }}" ]; then
upload="${{ inputs.upload }}"
else
upload="true"
upload="false"
fi
bash .github/workflows/set-release-binary-outputs.sh "${{ github.actor }}" "$tag" "$upload"
bash .github/workflows/set-release-binary-outputs.sh "$tag" "$upload"

# Try to get around the 6 hour timeout by first running a job to fill
# the build cache.
Expand Down
88 changes: 88 additions & 0 deletions .github/workflows/release-documentation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
name: Release Documentation

permissions:
contents: read

on:
workflow_dispatch:
inputs:
release-version:
description: 'Release Version'
required: true
type: string
upload:
description: 'Upload documentation'
required: false
type: boolean

workflow_call:
inputs:
release-version:
description: 'Release Version'
required: true
type: string
upload:
description: 'Upload documentation'
required: false
type: boolean

jobs:
release-documentation:
name: Build and Upload Release Documentation
runs-on: ubuntu-latest
env:
upload: ${{ inputs.upload && !contains(inputs.release-version, 'rc') }}
steps:
- name: Checkout LLVM
uses: actions/checkout@v4

- name: Setup Python env
uses: actions/setup-python@v4
with:
cache: 'pip'
cache-dependency-path: './llvm/docs/requirements.txt'

- name: Install Dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
graphviz \
python3-github \
ninja-build \
texlive-font-utils
pip3 install --user -r ./llvm/docs/requirements.txt

- name: Build Documentation
env:
GITHUB_TOKEN: ${{ github.token }}
run: |
./llvm/utils/release/build-docs.sh -release "${{ inputs.release-version }}" -no-doxygen

- name: Create Release Notes Artifact
uses: actions/upload-artifact@v3
with:
name: release-notes
path: docs-build/html-export/

- name: Clone www-releases
if: env.upload
uses: actions/checkout@v4
with:
repository: ${{ github.repository_owner }}/www-releases
ref: main
fetch-depth: 0
path: www-releases

- name: Upload Release Notes
if: env.upload
env:
WWW_RELEASES_TOKEN: ${{ secrets.WWW_RELEASES_TOKEN }}
run: |
mkdir -p ../www-releases/${{ inputs.release-version }}
mv ./docs-build/html-export/* ../www-releases/${{ inputs.release-version }}
cd ../www-releases
git add ${{ inputs.release-version }}
git config user.email "[email protected]"
git config user.name "llvmbot"
git commit -a -m "Add ${{ inputs.release-version }} documentation"
git push "https://[email protected]/${{ github.repository_owner }}/www-releases" main:main
67 changes: 67 additions & 0 deletions .github/workflows/release-doxygen.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Release Doxygen

permissions:
contents: read

on:
workflow_dispatch:
inputs:
release-version:
description: 'Release Version'
required: true
type: string
upload:
description: 'Upload documentation'
required: false
type: boolean

workflow_call:
inputs:
release-version:
description: 'Release Version'
required: true
type: string
upload:
description: 'Upload documentation'
required: false
type: boolean

jobs:
release-doxygen:
name: Build and Upload Release Doxygen
runs-on: ubuntu-latest
permissions:
contents: write
env:
upload: ${{ inputs.upload && !contains(inputs.release-version, 'rc') }}
steps:
- name: Checkout LLVM
uses: actions/checkout@v4

- name: Setup Python env
uses: actions/setup-python@v4
with:
cache: 'pip'
cache-dependency-path: './llvm/docs/requirements.txt'

- name: Install Dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
doxygen \
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't doxygen already listed as a requirement in the pip requirements file?

It might be worth adding the pip cache with setup-python since it makes the install so much faster.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doxygen is not in the requirements file.

graphviz \
python3-github \
ninja-build \
texlive-font-utils
pip3 install --user -r ./llvm/docs/requirements.txt

- name: Build Doxygen
env:
GITHUB_TOKEN: ${{ github.token }}
run: |
./llvm/utils/release/build-docs.sh -release "${{ inputs.release-version }}" -no-sphinx

- name: Upload Doxygen
if: env.upload
run: |
./llvm/utils/release/github-upload-release.py --token "$GITHUB_TOKEN" --release "${{ inputs.release-version }}" --user "${{ github.actor }}" upload --files ./*doxygen*.tar.xz
74 changes: 74 additions & 0 deletions .github/workflows/release-lit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: Release Lit

permissions:
contents: read

on:
workflow_dispatch:
inputs:
release-version:
description: 'Release Version'
required: true
type: string

workflow_call:
inputs:
release-version:
description: 'Release Version'
required: true
type: string

jobs:
release-lit:
name: Release Lit
runs-on: ubuntu-latest
steps:
- name: Checkout LLVM
uses: actions/checkout@v4
with:
ref: "llvmorg-${{ inputs.release-version }}"

- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y python3-setuptools python3-psutil python3-github

- name: Check Permissions
env:
GITHUB_TOKEN: ${{ github.token }}
run: |
./llvm/utils/release/./github-upload-release.py --token "$GITHUB_TOKEN" --user ${{ github.actor }} check-permissions

- name: Setup Cpp
uses: aminya/setup-cpp@v1
with:
compiler: llvm-16.0.6
boomanaiden154 marked this conversation as resolved.
Show resolved Hide resolved
cmake: true
ninja: true

- name: Test lit
run: |
mkdir build && cd build
export FILECHECK_OPTS='-dump-input-filter=all -vv -color'
cmake ../llvm -DCMAKE_BUILD_TYPE=Release -G Ninja
ninja -v -j $(nproc) check-lit

- name: Package lit
run: |
cd llvm/utils/lit
# Remove 'dev' suffix from lit version.
sed -i 's/ + "dev"//g' lit/__init__.py
python3 setup.py sdist

- name: Upload lit to test.pypi.org
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.LLVM_LIT_TEST_PYPI_API_TOKEN }}
repository-url: https://test.pypi.org/legacy/
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is the legacy part of this URL intentional?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this is comes from an example in the README file for this action: https://github.com/pypa/gh-action-pypi-publish

packages-dir: llvm/utils/lit/dist/

- name: Upload lit to pypi.org
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.LLVM_LIT_PYPI_API_TOKEN }}
packages-dir: llvm/utils/lit/dist/
Loading