Skip to content

[github] GitHub Actions workflows changes #65856

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

Merged
merged 1 commit into from
Sep 12, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 0 additions & 2 deletions .github/workflows/clang-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ permissions:
on:
workflow_dispatch:
push:
ignore-forks: true
branches:
- 'release/**'
paths:
Expand All @@ -15,7 +14,6 @@ on:
- '.github/workflows/llvm-project-tests.yml'
- '!llvm/**'
pull_request:
ignore-forks: true
branches:
- 'release/**'
paths:
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/issue-release-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ jobs:

- name: Backport Commits
run: |
printf "$COMMENT_BODY" |
printf "%s" "$COMMENT_BODY" |
./llvm/utils/git/github-automation.py \
--repo $GITHUB_REPOSITORY \
--repo "$GITHUB_REPOSITORY" \
--token ${{ secrets.RELEASE_WORKFLOW_PUSH_SECRET }} \
release-workflow \
--issue-number ${{ github.event.issue.number }} \
Expand All @@ -84,9 +84,9 @@ jobs:

- name: Create Pull Request
run: |
printf "$COMMENT_BODY" |
printf "%s" "$COMMENT_BODY" |
./llvm/utils/git/github-automation.py \
--repo $GITHUB_REPOSITORY \
--repo "$GITHUB_REPOSITORY" \
--token ${{ secrets.RELEASE_WORKFLOW_PUSH_SECRET }} \
release-workflow \
--issue-number ${{ github.event.issue.number }} \
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/issue-subscriber.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ jobs:
steps:
- name: Setup Automation Script
run: |
curl -O -L https://raw.githubusercontent.com/$GITHUB_REPOSITORY/$GITHUB_SHA/llvm/utils/git/github-automation.py
curl -O -L https://raw.githubusercontent.com/$GITHUB_REPOSITORY/$GITHUB_SHA/llvm/utils/git/requirements.txt
curl -O -L https://raw.githubusercontent.com/"$GITHUB_REPOSITORY"/"$GITHUB_SHA"/llvm/utils/git/github-automation.py
curl -O -L https://raw.githubusercontent.com/"$GITHUB_REPOSITORY"/"$GITHUB_SHA"/llvm/utils/git/requirements.txt
chmod a+x github-automation.py
pip install -r requirements.txt

Expand Down
35 changes: 18 additions & 17 deletions .github/workflows/libclang-abi-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,12 @@ permissions:
on:
workflow_dispatch:
push:
ignore-forks: true
branches:
- 'release/**'
paths:
- 'clang/**'
- '.github/workflows/libclang-abi-tests.yml'
pull_request:
ignore-forks: true
branches:
- 'release/**'
paths:
Expand Down Expand Up @@ -52,32 +50,35 @@ jobs:
- name: Setup Variables
id: vars
run: |
minor_version=0
remote_repo='https://github.com/llvm/llvm-project'
if [ ${{ steps.version.outputs.LLVM_VERSION_MINOR }} -ne 0 -o ${{ steps.version.outputs.LLVM_VERSION_PATCH }} -eq 0 ]; then
if [ ${{ steps.version.outputs.LLVM_VERSION_MINOR }} -ne 0 ] || [ ${{ steps.version.outputs.LLVM_VERSION_PATCH }} -eq 0 ]; then
major_version=$(( ${{ steps.version.outputs.LLVM_VERSION_MAJOR }} - 1))
baseline_ref="llvmorg-$major_version.0.0"

# If there is a minor release, we want to use that as the base line.
minor_ref=$(git ls-remote --refs -t $remote_repo llvmorg-$major_version.[1-9].[0-9] | tail -n1 | grep -o 'llvmorg-.\+' || true)
minor_ref=$(git ls-remote --refs -t "$remote_repo" llvmorg-"$major_version".[1-9].[0-9] | tail -n1 | grep -o 'llvmorg-.\+' || true)
if [ -n "$minor_ref" ]; then
baseline_ref=$minor_ref
baseline_ref="$minor_ref"
else
# Check if we have a release candidate
rc_ref=$(git ls-remote --refs -t $remote_repo llvmorg-$major_version.[1-9].[0-9]-rc* | tail -n1 | grep -o 'llvmorg-.\+' || true)
rc_ref=$(git ls-remote --refs -t "$remote_repo" llvmorg-"$major_version".[1-9].[0-9]-rc* | tail -n1 | grep -o 'llvmorg-.\+' || true)
if [ -n "$rc_ref" ]; then
baseline_ref=$rc_ref
baseline_ref="$rc_ref"
fi
fi
echo "BASELINE_VERSION_MAJOR=$major_version" >> $GITHUB_OUTPUT
echo "BASELINE_REF=$baseline_ref" >> $GITHUB_OUTPUT
echo "ABI_HEADERS=clang-c" >> $GITHUB_OUTPUT
echo "ABI_LIBS=libclang.so" >> $GITHUB_OUTPUT
{
echo "BASELINE_VERSION_MAJOR=$major_version"
echo "BASELINE_REF=$baseline_ref"
echo "ABI_HEADERS=clang-c"
echo "ABI_LIBS=libclang.so"
} >> "$GITHUB_OUTPUT"
else
echo "BASELINE_VERSION_MAJOR=${{ steps.version.outputs.LLVM_VERSION_MAJOR }}" >> $GITHUB_OUTPUT
echo "BASELINE_REF=llvmorg-${{ steps.version.outputs.LLVM_VERSION_MAJOR }}.0.0" >> $GITHUB_OUTPUT
echo "ABI_HEADERS=." >> $GITHUB_OUTPUT
echo "ABI_LIBS=libclang.so libclang-cpp.so" >> $GITHUB_OUTPUT
{
echo "BASELINE_VERSION_MAJOR=${{ steps.version.outputs.LLVM_VERSION_MAJOR }}"
echo "BASELINE_REF=llvmorg-${{ steps.version.outputs.LLVM_VERSION_MAJOR }}.0.0"
echo "ABI_HEADERS=."
echo "ABI_LIBS=libclang.so libclang-cpp.so"
} >> "$GITHUB_OUTPUT"
fi

abi-dump:
Expand Down Expand Up @@ -119,7 +120,7 @@ jobs:
- name: Configure
run: |
mkdir install
cmake -B build -S llvm -G Ninja -DLLVM_ENABLE_PROJECTS=clang -DCMAKE_BUILD_TYPE=Debug -DLLVM_TARGETS_TO_BUILD="" -DLLVM_BUILD_LLVM_DYLIB=ON -DLLVM_LINK_LLVM_DYLIB=ON -DCMAKE_C_FLAGS_DEBUG="-g1 -Og" -DCMAKE_CXX_FLAGS_DEBUG="-g1 -Og" -DCMAKE_INSTALL_PREFIX=$(pwd)/install llvm
cmake -B build -S llvm -G Ninja -DLLVM_ENABLE_PROJECTS=clang -DCMAKE_BUILD_TYPE=Debug -DLLVM_TARGETS_TO_BUILD="" -DLLVM_BUILD_LLVM_DYLIB=ON -DLLVM_LINK_LLVM_DYLIB=ON -DCMAKE_C_FLAGS_DEBUG="-g1 -Og" -DCMAKE_CXX_FLAGS_DEBUG="-g1 -Og" -DCMAKE_INSTALL_PREFIX="$(pwd)"/install llvm
- name: Build
run: ninja -C build/ ${{ needs.abi-dump-setup.outputs.ABI_LIBS }} install-clang-headers
- name: Dump ABI
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/libclc-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ permissions:
on:
workflow_dispatch:
push:
ignore-forks: true
branches:
- 'release/**'
paths:
Expand All @@ -16,7 +15,6 @@ on:
- '!clang/**'
- '!llvm/**'
pull_request:
ignore-forks: true
branches:
- 'release/**'
paths:
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/lld-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ permissions:
on:
workflow_dispatch:
push:
ignore-forks: true
branches:
- 'release/**'
paths:
Expand All @@ -15,7 +14,6 @@ on:
- '.github/workflows/llvm-project-tests.yml'
- '!llvm/**'
pull_request:
ignore-forks: true
branches:
- 'release/**'
paths:
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/lldb-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ permissions:
on:
workflow_dispatch:
push:
ignore-forks: true
branches:
- 'release/**'
paths:
Expand All @@ -16,7 +15,6 @@ on:
- '!clang/**'
- '!llvm/**'
pull_request:
ignore-forks: true
branches:
- 'release/**'
paths:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/llvm-project-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,6 @@ jobs:
run: |
# Make sure all of LLVM libraries that llvm-config needs are built.
ninja -C build
cmake -G Ninja -S libclc -B libclc-build -DLLVM_DIR=$(pwd)/build/lib/cmake/llvm -DLIBCLC_TARGETS_TO_BUILD="amdgcn--;amdgcn--amdhsa;r600--;nvptx--;nvptx64--;nvptx--nvidiacl;nvptx64--nvidiacl"
cmake -G Ninja -S libclc -B libclc-build -DLLVM_DIR="$(pwd)"/build/lib/cmake/llvm -DLIBCLC_TARGETS_TO_BUILD="amdgcn--;amdgcn--amdhsa;r600--;nvptx--;nvptx64--;nvptx--nvidiacl;nvptx64--nvidiacl"
ninja -C libclc-build
ninja -C libclc-build test
22 changes: 12 additions & 10 deletions .github/workflows/llvm-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,13 @@ permissions:
on:
workflow_dispatch:
push:
ignore-forks: true
branches:
- 'release/**'
paths:
- 'llvm/**'
- '.github/workflows/llvm-tests.yml'
- '.github/workflows/llvm-project-tests.yml'
pull_request:
ignore-forks: true
branches:
- 'release/**'
paths:
Expand Down Expand Up @@ -78,12 +76,16 @@ jobs:
- name: Setup Variables
id: vars
run: |
if [ ${{ steps.version.outputs.LLVM_VERSION_MINOR }} -ne 0 -o ${{ steps.version.outputs.LLVM_VERSION_PATCH }} -eq 0 ]; then
echo "BASELINE_VERSION_MAJOR=$(( ${{ steps.version.outputs.LLVM_VERSION_MAJOR }} - 1))" >> $GITHUB_OUTPUT
echo "ABI_HEADERS=llvm-c" >> $GITHUB_OUTPUT
if [ ${{ steps.version.outputs.LLVM_VERSION_MINOR }} -ne 0 ] || [ ${{ steps.version.outputs.LLVM_VERSION_PATCH }} -eq 0 ]; then
{
echo "BASELINE_VERSION_MAJOR=$(( ${{ steps.version.outputs.LLVM_VERSION_MAJOR }} - 1))"
echo "ABI_HEADERS=llvm-c"
} >> "$GITHUB_OUTPUT"
else
echo "BASELINE_VERSION_MAJOR=${{ steps.version.outputs.LLVM_VERSION_MAJOR }}" >> $GITHUB_OUTPUT
echo "ABI_HEADERS=." >> $GITHUB_OUTPUT
{
echo "BASELINE_VERSION_MAJOR=${{ steps.version.outputs.LLVM_VERSION_MAJOR }}"
echo "ABI_HEADERS=."
} >> "$GITHUB_OUTPUT"
fi

abi-dump:
Expand Down Expand Up @@ -125,7 +127,7 @@ jobs:
- name: Configure
run: |
mkdir install
cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Debug -DLLVM_TARGETS_TO_BUILD="" -DLLVM_BUILD_LLVM_DYLIB=ON -DCMAKE_C_FLAGS_DEBUG="-g1 -Og" -DCMAKE_CXX_FLAGS_DEBUG="-g1 -Og" -DCMAKE_INSTALL_PREFIX=$(pwd)/install llvm
cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Debug -DLLVM_TARGETS_TO_BUILD="" -DLLVM_BUILD_LLVM_DYLIB=ON -DCMAKE_C_FLAGS_DEBUG="-g1 -Og" -DCMAKE_CXX_FLAGS_DEBUG="-g1 -Og" -DCMAKE_INSTALL_PREFIX="$(pwd)"/install llvm
- name: Build
# Need to run install-LLVM twice to ensure the symlink is installed (this is a bug).
run: |
Expand All @@ -141,7 +143,7 @@ jobs:
else
touch llvm.symbols
fi
abi-dumper $EXTRA_ARGS -lver ${{ matrix.ref }} -skip-cxx -public-headers ./install/include/${{ needs.abi-dump-setup.outputs.ABI_HEADERS }} -o ${{ matrix.ref }}.abi ./install/lib/libLLVM.so
abi-dumper "$EXTRA_ARGS" -lver ${{ matrix.ref }} -skip-cxx -public-headers ./install/include/${{ needs.abi-dump-setup.outputs.ABI_HEADERS }} -o ${{ matrix.ref }}.abi ./install/lib/libLLVM.so
# Remove symbol versioning from dumps, so we can compare across major versions.
sed -i 's/LLVM_${{ matrix.llvm_version_major }}/LLVM_NOVERSION/' ${{ matrix.ref }}.abi
- name: Upload ABI file
Expand Down Expand Up @@ -188,7 +190,7 @@ jobs:
# FIXME: Reading of gzip'd abi files on the GitHub runners stop
# working some time in March of 2021, likely due to a change in the
# runner's environment.
abi-compliance-checker $EXTRA_ARGS -l libLLVM.so -old build-baseline/*.abi -new build-latest/*.abi || test "${{ needs.abi-dump-setup.outputs.ABI_HEADERS }}" = "llvm-c"
abi-compliance-checker "$EXTRA_ARGS" -l libLLVM.so -old build-baseline/*.abi -new build-latest/*.abi || test "${{ needs.abi-dump-setup.outputs.ABI_HEADERS }}" = "llvm-c"
- name: Upload ABI Comparison
if: always()
uses: actions/upload-artifact@v3
Expand Down
22 changes: 11 additions & 11 deletions .github/workflows/new-prs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,34 +23,34 @@ jobs:
uses: actions/github-script@v6
with:
script: |
var artifacts = await github.rest.actions.listWorkflowRunArtifacts({
const artifacts = await github.rest.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: context.payload.workflow_run.id,
run_id: context.payload.workflow_run.id
});
var matchArtifact = artifacts.data.artifacts.filter((artifact) => {
return artifact.name == "pr"
})[0];
var download = await github.rest.actions.downloadArtifact({
const matchArtifact = artifacts.data.artifacts.find((artifact) =>
artifact.name === 'pr'
);
const download = await github.rest.actions.downloadArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: matchArtifact.id,
archive_format: 'zip',
archive_format: 'zip'
});
var fs = require('fs');
fs.writeFileSync('${{github.workspace}}/pr.zip', Buffer.from(download.data));
const { writeFileSync } = require('node:fs');
writeFileSync('${{ github.workspace }}/pr.zip', Buffer.from(download.data));

- run: unzip pr.zip

- name: "Get PR Number"
id: vars
run:
echo "pr-number=`cat NR`" >> $GITHUB_OUTPUT
echo "pr-number=$(cat NR)" >> "$GITHUB_OUTPUT"

- uses: actions/labeler@v4
with:
configuration-path: .github/new-prs-labeler.yml
# workaround for https://github.com/actions/labeler/issues/112
sync-labels: ''
repo-token: ${{ secrets.ISSUE_SUBSCRIBER_TOKEN }}
pr-number: ${{steps.vars.outputs.pr-number}}
pr-number: ${{ steps.vars.outputs.pr-number }}
26 changes: 13 additions & 13 deletions .github/workflows/pr-subscriber.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,37 +23,37 @@ jobs:
uses: actions/github-script@v6
with:
script: |
var artifacts = await github.rest.actions.listWorkflowRunArtifacts({
const artifacts = await github.rest.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: context.payload.workflow_run.id,
run_id: context.payload.workflow_run.id
});
var matchArtifact = artifacts.data.artifacts.filter((artifact) => {
return artifact.name == "pr"
})[0];
var download = await github.rest.actions.downloadArtifact({
const matchArtifact = artifacts.data.artifacts.find((artifact) =>
artifact.name === 'pr'
);
const download = await github.rest.actions.downloadArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: matchArtifact.id,
archive_format: 'zip',
archive_format: 'zip'
});
var fs = require('fs');
fs.writeFileSync('${{github.workspace}}/pr.zip', Buffer.from(download.data));
const { writeFileSync } = require('node:fs');
writeFileSync('${{ github.workspace }}/pr.zip', Buffer.from(download.data));

- run: unzip pr.zip

- name: Setup Automation Script
run: |
curl -O -L https://raw.githubusercontent.com/$GITHUB_REPOSITORY/main/llvm/utils/git/github-automation.py
curl -O -L https://raw.githubusercontent.com/$GITHUB_REPOSITORY/main/llvm/utils/git/requirements.txt
curl -O -L https://raw.githubusercontent.com/"$GITHUB_REPOSITORY"/main/llvm/utils/git/github-automation.py
curl -O -L https://raw.githubusercontent.com/"$GITHUB_REPOSITORY"/main/llvm/utils/git/requirements.txt
chmod a+x github-automation.py
pip install -r requirements.txt

- name: Update watchers
# https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions#using-an-intermediate-environment-variable
run: |
PR_NUMBER=`cat NR`
LABEL_NAME=`cat LABEL`
PR_NUMBER=$(cat NR)
LABEL_NAME=$(cat LABEL)
./github-automation.py \
--token '${{ secrets.ISSUE_SUBSCRIBER_TOKEN }}' \
pr-subscriber \
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release-binaries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
# | X.Y.Z | -final
run: |
tag="${{ github.ref_name }}"
trimmed=`echo ${{ inputs.tag }} | xargs`
trimmed=$(echo ${{ inputs.tag }} | xargs)
[[ "$trimmed" != "" ]] && tag="$trimmed"
if [ -n "${{ inputs.upload }}" ]; then
upload="${{ inputs.upload }}"
Expand Down Expand Up @@ -92,7 +92,7 @@ jobs:
- name: Set macOS build env variables
if: runner.os == 'macOS'
run: |
echo "MACOSX_DEPLOYMENT_TARGET=10.9" >> $GITHUB_ENV
echo "MACOSX_DEPLOYMENT_TARGET=10.9" >> "$GITHUB_ENV"

- name: Build and test release
run: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release-tasks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
test "${{ github.actor }}" = "tstellar" || test "${{ github.actor }}" = "tru"
echo "${{ github.ref_name }}" | grep -e '^llvmorg-[0-9]\+\.[0-9]\+\.[0-9]\+\(-rc[0-9]\+\)\?$'
release_version=$(echo "${{ github.ref_name }}" | sed 's/llvmorg-//g')
echo "release-version=$release_version" >> $GITHUB_OUTPUT
echo "release-version=$release_version" >> "$GITHUB_OUTPUT"

- name: Install Dependencies
run: |
Expand All @@ -47,7 +47,7 @@ jobs:
- name: Build Documentation
run: |
./llvm/utils/release/build-docs.sh -release ${{ steps.validate-tag.outputs.release-version }}
./llvm/utils/release/github-upload-release.py --token ${{ github.token }} --release ${{ steps.validate-tag.outputs.release-version }} upload --files *doxygen*.tar.xz
./llvm/utils/release/github-upload-release.py --token ${{ github.token }} --release ${{ steps.validate-tag.outputs.release-version }} upload --files ./*doxygen*.tar.xz

- name: Create Release Notes Artifact
uses: actions/download-artifact@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/version-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ jobs:
- name: Version Check
run: |
version=$(grep -o 'LLVM_VERSION_\(MAJOR\|MINOR\|PATCH\) [0-9]\+' llvm/CMakeLists.txt | cut -d ' ' -f 2 | tr "\n" "." | sed 's/.$//g')
.github/workflows/version-check.py $version
.github/workflows/version-check.py "$version"