Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit bc3066b

Browse files
authored
workflows/release-lit: Update workflow and enable trusted publishing with pypi (#174907)
This makes some small improvements to the workflow including using some more modern python packaging modules and also enables the trusted publishing for pypi. This will allow us to publish lit packages to pypi without needing to use an access token. This action also now uses the pypi environment which will only publish files when triggered by an llvm-* tag.
1 parent 6a6d432 commit bc3066b

1 file changed

Lines changed: 57 additions & 0 deletions

File tree

.github/workflows/release-tasks.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,63 @@ jobs:
7373
secrets:
7474
RELEASE_TASKS_USER_TOKEN: ${{ secrets.RELEASE_TASKS_USER_TOKEN }}
7575

76+
# The pypi trusted publishing does not support called workflows, so we
77+
# can't use them here.
78+
release-lit:
79+
name: Release Lit
80+
runs-on: ubuntu-24.04
81+
permissions:
82+
id-token: write # Requred for pypi publishing
83+
environment: pypi
84+
steps:
85+
- name: Checkout LLVM
86+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
87+
with:
88+
ref: "llvmorg-${{ needs.validate-tag.outputs.release-version }}"
89+
90+
- name: Install dependencies
91+
run: |
92+
sudo apt-get update
93+
sudo apt-get install -y python3-build python3-psutil python3-github
94+
95+
- name: Check Permissions
96+
env:
97+
GITHUB_TOKEN: ${{ github.token }}
98+
USER_TOKEN: ${{ secrets.RELEASE_TASKS_USER_TOKEN }}
99+
run: |
100+
./llvm/utils/release/./github-upload-release.py --token "$GITHUB_TOKEN" --user ${{ github.actor }} --user-token "$USER_TOKEN" check-permissions
101+
102+
- name: Test lit
103+
run: |
104+
mkdir build && cd build
105+
export FILECHECK_OPTS='-dump-input-filter=all -vv -color'
106+
cmake ../llvm -DCMAKE_BUILD_TYPE=Release -G Ninja
107+
ninja -v -j $(nproc) check-lit
108+
109+
- name: Package lit
110+
run: |
111+
cd llvm/utils/lit
112+
# Remove 'dev' suffix from lit version.
113+
sed -i 's/ + "dev"//g' lit/__init__.py
114+
python3 -m build
115+
116+
- uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
117+
with:
118+
name: lit-${{ inputs.release-version }}-release-binary
119+
path: |
120+
llvm/utils/lit/dist
121+
122+
- name: Upload lit to test.pypi.org
123+
uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0
124+
with:
125+
repository-url: https://test.pypi.org/legacy/
126+
packages-dir: llvm/utils/lit/dist/
127+
128+
- name: Upload lit to pypi.org
129+
uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0
130+
with:
131+
packages-dir: llvm/utils/lit/dist/
132+
76133
release-binaries:
77134
name: Build Release Binaries
78135
permissions:

0 commit comments

Comments
 (0)