-
Notifications
You must be signed in to change notification settings - Fork 14.9k
workflows/release-binaries: Run tests on the same runner as the build (#162421) #162926
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
Conversation
@llvm/pr-subscribers-github-workflow Author: Tom Stellard (tstellar) ChangesAlso, ignore the test results since they almost always fail. This allows us to simplify the build process and skip uploading and downloading the build and source directories which are huge. (cherry picked from commit 9f0f6e8) Full diff: https://github.com/llvm/llvm-project/pull/162926.diff 3 Files Affected:
diff --git a/.github/workflows/release-binaries-save-stage/action.yml b/.github/workflows/release-binaries-save-stage/action.yml
deleted file mode 100644
index f08088c7bc56f..0000000000000
--- a/.github/workflows/release-binaries-save-stage/action.yml
+++ /dev/null
@@ -1,44 +0,0 @@
-name: Save Stage
-description: >-
- Upload the source and binary directories from a build stage so that they
- can be re-used in the next stage. This action is used to the release
- binaries workflow into multiple stages to avoid the 6 hour timeout on
- the GitHub hosted runners.
-inputs:
- build-prefix:
- description: "Directory containing the build directory."
- required: true
- type: 'string'
-
-permissions:
- contents: read
-
-runs:
- using: "composite"
- steps:
- # We need to create an archive of the build directory, because it has too
- # many files to upload.
- - name: Package Build and Source Directories
- shell: bash
- run: |
- # Remove .git/config to avoid leaking GITHUB_TOKEN stored there.
- # See https://unit42.paloaltonetworks.com/github-repo-artifacts-leak-tokens/
- rm -Rf .git/config
- # Windows does not support symlinks, so we need to dereference them.
- tar --exclude build/ ${{ (runner.os == 'Windows' && '-h') || '' }} -c . | zstd -T0 -c > ../llvm-project.tar.zst
- mv ../llvm-project.tar.zst .
- tar -C ${{ inputs.build-prefix }} -c build/ | zstd -T0 -c > build.tar.zst
-
- - name: Upload Stage 1 Source
- uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 #v4.3.0
- with:
- name: ${{ runner.os }}-${{ runner.arch }}-${{ github.job }}-source
- path: llvm-project.tar.zst
- retention-days: 2
-
- - name: Upload Stage 1 Build Dir
- uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 #v4.3.0
- with:
- name: ${{ runner.os}}-${{ runner.arch }}-${{ github.job }}-build
- path: build.tar.zst
- retention-days: 2
diff --git a/.github/workflows/release-binaries-setup-stage/action.yml b/.github/workflows/release-binaries-setup-stage/action.yml
deleted file mode 100644
index f5e5db27e6595..0000000000000
--- a/.github/workflows/release-binaries-setup-stage/action.yml
+++ /dev/null
@@ -1,59 +0,0 @@
-name: Setup Stage
-description: >-
- Setup the next stage of the release binaries workflow. This sets up the
- environment correctly for a new stage of the release binaries workflow
- and also restores the source and build directory from the previous stage.
-
-inputs:
- previous-artifact:
- description: >-
- A unique descriptor for the artifact from the previous stage. This will
- be used to construct the final artifact pattern, which is:
- $RUNNER_OS-$RUNNER_ARCH-$PREVIOUS_ARTIFACT-*
- required: false
- type: 'string'
-
-outputs:
- build-prefix:
- description: "Directory containing the build directory."
- value: ${{ steps.build-prefix.outputs.build-prefix }}
-
-runs:
- using: "composite"
- steps:
- - name: Install Ninja
- uses: llvm/actions/install-ninja@22e9f909d35b50bd1181709564bfe816eaeaae81 # main
-
- - name: Setup Windows
- if: startsWith(runner.os, 'Windows')
- uses: llvm/actions/setup-windows@main
- with:
- arch: amd64
-
- - name: Set Build Prefix
- id: build-prefix
- shell: bash
- run: |
- build_prefix=`pwd`
- if [ "${{ runner.os }}" = "Linux" ]; then
- sudo chown $USER:$USER /mnt/
- build_prefix=/mnt/
- fi
- echo "build-prefix=$build_prefix" >> $GITHUB_OUTPUT
-
- - name: Download Previous Stage Artifact
- if: ${{ inputs.previous-artifact }}
- id: download
- uses: actions/download-artifact@6b208ae046db98c579e8a3aa621ab581ff575935 # v4.1.1
- with:
- pattern: ${{ runner.os }}-${{ runner.arch }}-${{ inputs.previous-artifact }}-*
- merge-multiple: true
-
- - name: Unpack Artifact
- if: ${{ steps.download.outputs.download-path }}
- shell: bash
- run: |
- tar --zstd -xf llvm-project.tar.zst
- rm llvm-project.tar.zst
- tar --zstd -C ${{ steps.build-prefix.outputs.build-prefix}} -xf build.tar.zst
- rm build.tar.zst
diff --git a/.github/workflows/release-binaries.yml b/.github/workflows/release-binaries.yml
index c113b42dc8ed4..765cd06469977 100644
--- a/.github/workflows/release-binaries.yml
+++ b/.github/workflows/release-binaries.yml
@@ -194,40 +194,30 @@ jobs:
runs-on: ${{ needs.prepare.outputs.build-runs-on }}
steps:
- - name: Checkout Actions
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- with:
- ref: ${{ (github.event_name == 'pull_request' && github.sha) || 'main' }}
- sparse-checkout: |
- .github/workflows/
- sparse-checkout-cone-mode: false
- # Check out outside of working directory so the source checkout doesn't
- # remove it.
- path: workflows
-
- # actions/checkout does not support paths outside of the GITHUB_WORKSPACE.
- # Also, anything that we put inside of GITHUB_WORKSPACE will be overwritten
- # by future actions/checkout steps. Therefore, in order to checkout the
- # latest actions from main, we need to first checkout out the actions inside of
- # GITHUB_WORKSPACE (see previous step), then use actions/checkout to checkout
- # the code being built and the move the actions from main back into GITHUB_WORKSPACE,
- # becasue the uses on composite actions only reads workflows from inside GITHUB_WORKSPACE.
- - shell: bash
- run: mv workflows ../workflows-main
-
- name: Checkout LLVM
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
ref: ${{ needs.prepare.outputs.ref }}
- - name: Copy main workflows
- shell: bash
- run: |
- mv ../workflows-main .
+ - name: Install Ninja
+ uses: llvm/actions/install-ninja@a1ea791b03c8e61f53a0e66f2f73db283aa0f01e # main
+
+ - name: Setup Windows
+ if: startsWith(runner.os, 'Windows')
+ uses: llvm/actions/setup-windows@main
+ with:
+ arch: amd64
- - name: Setup Stage
+ - name: Set Build Prefix
id: setup-stage
- uses: ./workflows-main/.github/workflows/release-binaries-setup-stage
+ shell: bash
+ run: |
+ build_prefix=`pwd`
+ if [ "${{ runner.os }}" = "Linux" ]; then
+ sudo chown $USER:$USER /mnt/
+ build_prefix=/mnt/
+ fi
+ echo "build-prefix=$build_prefix" >> $GITHUB_OUTPUT
- name: Configure
id: build
@@ -258,17 +248,11 @@ jobs:
path: |
${{ needs.prepare.outputs.release-binary-filename }}
- # Clean up some build files to reduce size of artifact.
- - name: Clean Up Build Directory
- shell: bash
+ - name: Run Tests
+ # These almost always fail so don't let them fail the build and prevent the uploads.
+ continue-on-error: true
run: |
- find ${{ steps.setup-stage.outputs.build-prefix }}/build -iname ${{ needs.prepare.outputs.release-binary-filename }} -delete
- find ${{ steps.setup-stage.outputs.build-prefix }}/build -iname _CPack_Packages -prune -exec rm -r {} +
-
- - name: Save Stage
- uses: ./workflows-main/.github/workflows/release-binaries-save-stage
- with:
- build-prefix: ${{ steps.setup-stage.outputs.build-prefix }}
+ ninja -C ${{ steps.setup-stage.outputs.build-prefix }}/build stage2-check-all
upload-release-binaries:
name: "Upload Release Binaries"
@@ -327,31 +311,3 @@ jobs:
--release ${{ needs.prepare.outputs.release-version }} \
upload \
--files ${{ needs.prepare.outputs.release-binary-filename }}*
-
- test-release:
- name: "Test Release"
- needs:
- - prepare
- - build-release-package
- if: >-
- github.repository_owner == 'llvm'
- runs-on: ${{ needs.prepare.outputs.test-runs-on }}
- steps:
- - name: Checkout Actions
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- with:
- ref: ${{ (github.event_name == 'pull_request' && github.sha) || 'main' }}
- sparse-checkout: |
- .github/workflows/
- sparse-checkout-cone-mode: false
- path: workflows
- - name: Setup Stage
- id: setup-stage
- uses: ./workflows/.github/workflows/release-binaries-setup-stage
- with:
- previous-artifact: build-release-package
-
- - name: Run Tests
- shell: bash
- run: |
- ninja -C ${{ steps.setup-stage.outputs.build-prefix }}/build stage2-check-all
|
…llvm#162421) Also, ignore the test results since they almost always fail. This allows us to simplify the build process and skip uploading and downloading the build and source directories which are huge. (cherry picked from commit 9f0f6e8)
916ee3a
to
18593ab
Compare
@tstellar (or anyone else). If you would like to add a note about this fix in the release notes (completely optional). Please reply to this comment with a one or two sentence description of the fix. When you are done, please add the release:note label to this PR. |
Also, ignore the test results since they almost always fail. This allows us to simplify the build process and skip uploading and downloading the build and source directories which are huge.
(cherry picked from commit 9f0f6e8)